1.0.0 • Published 6 months ago

@lg-charts/legend v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

Charts Legend

npm (scoped)

Installation

PNPM

pnpm add @lg-charts/legend

Yarn

yarn add @lg-charts/legend

NPM

npm install @lg-charts/legend

Example

To use the Legend, ensure your Legend instance and corresponding chart components are wrapped in a SeriesProvider instance.

import { Chart, ChartCard } from '@lg-charts/core';
import { Legend } from '@lg-charts/legend';
import { SeriesProvider } from '@lg-charts/series-provider';

const App = () => {
  const lineData = getLineData(); // use a fetch endpoint or pass down line data
  const series = lineData.map(({name}) => name);

  return (
    <SeriesProvider series={series}>
      <Legend series={series}>
      <Chart>
        {lineData.map(({ data, name }) => (
          <Line key={name} data={data} name={name} />
        ))}
      </Chart>
    </SeriesProvider>
  );
};

Properties

Legend

PropTypeDescriptionDefault
seriesArray<string>An array of series names representing the data series to be displayed in the legend.
seriesNameFormatter (optional)(name: string) => React.ReactNodeA function that formats the series name. The function is called with the series name as an argument.
showSelectAll (optional)booleanDetermines whether or not to show the select all checkbox.true
1.0.0

6 months ago

0.2.5

6 months ago

0.2.4

7 months ago

0.2.3

7 months ago

0.2.2

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.1

8 months ago