New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@elastic/charts

Package Overview
Dependencies
Maintainers
57
Versions
401
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elastic/charts

Elastic-Charts data visualization library

  • 7.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
164K
increased by8.62%
Maintainers
57
Weekly downloads
 
Created

What is @elastic/charts?

@elastic/charts is a powerful charting library developed by Elastic. It provides a wide range of chart types and is designed to be highly customizable and performant. It is particularly well-suited for creating complex, data-driven visualizations in web applications.

What are @elastic/charts's main functionalities?

Line Chart

This code sample demonstrates how to create a simple line chart using @elastic/charts. The LineSeries component is used to define the data and the axes for the chart.

import { Chart, LineSeries, Settings } from '@elastic/charts';

const data = [
  { x: 0, y: 2 },
  { x: 1, y: 3 },
  { x: 2, y: 5 },
  { x: 3, y: 7 },
];

const LineChart = () => (
  <Chart>
    <Settings showLegend={true} legendPosition="right" />
    <LineSeries
      id="lineSeries"
      xScaleType="linear"
      yScaleType="linear"
      xAccessor="x"
      yAccessor="y"
      data={data}
    />
  </Chart>
);

Bar Chart

This code sample demonstrates how to create a bar chart using @elastic/charts. The BarSeries component is used to define the data and the axes for the chart.

import { Chart, BarSeries, Settings } from '@elastic/charts';

const data = [
  { x: 'A', y: 30 },
  { x: 'B', y: 80 },
  { x: 'C', y: 45 },
  { x: 'D', y: 60 },
];

const BarChart = () => (
  <Chart>
    <Settings showLegend={true} legendPosition="right" />
    <BarSeries
      id="barSeries"
      xScaleType="ordinal"
      yScaleType="linear"
      xAccessor="x"
      yAccessor="y"
      data={data}
    />
  </Chart>
);

Pie Chart

This code sample demonstrates how to create a pie chart using @elastic/charts. The Partition component is used to define the data and the structure of the pie chart.

import { Chart, Partition, Settings } from '@elastic/charts';

const data = [
  { category: 'A', value: 30 },
  { category: 'B', value: 80 },
  { category: 'C', value: 45 },
  { category: 'D', value: 60 },
];

const PieChart = () => (
  <Chart>
    <Settings showLegend={true} legendPosition="right" />
    <Partition
      id="pieChart"
      data={data}
      valueAccessor={(d) => d.value}
      valueFormatter={(d) => `${d} %`}
      layers={[
        {
          groupByRollup: (d) => d.category,
          shape: {
            fillColor: (d) => d.category === 'A' ? 'red' : 'blue',
          },
        },
      ]}
    />
  </Chart>
);

Other packages similar to @elastic/charts

FAQs

Package last updated on 05 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc