1.2.5 • Published 5 days ago

@igloo-ui/area-chart v1.2.5

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 days ago

AreaChart

The area chart is a line chart with shading below the line. This area chart depicts score over time.

Installation

To install @igloo-ui/area-chart in your project, you will need to run the following command using npm:

npm install @igloo-ui/area-chart

If you prefer Yarn, use the following command instead:

yarn add @igloo-ui/area-chart

Usage

Then to use the component in your code just import it!

import AreaChart from '@igloo-ui/area-chart';

const nFormatter = (num) => {
  const lookup = [
    { value: 1, symbol: '' },
    { value: 1e3, symbol: 'k' },
    { value: 1e6, symbol: 'M' },
    { value: 1e9, symbol: 'B' },
    { value: 1e12, symbol: 'T' },
  ];
  const digits = 2;
  const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
  const item = lookup
    .slice()
    .reverse()
    .find(function (item) {
      return num >= item.value;
    });
  return item
    ? (num / item.value).toFixed(digits).replace(rx, '$1') + item.symbol
    : '0';
};

<AreaChart
  scoreFormatter={nFormatter}
  dateRange={{
    start: '2022-10-01',
    end: '2022-10-07',
  }}
  dataSet={[
    {
      dateTimeStamp: '2022-10-01',
      score: 48878,
      name: 'sent',
      secondaryName: 'sent',
    },
    {
      dateTimeStamp: '2022-10-02',
      score: 49879,
      name: 'sent',
      secondaryName: 'sent',
    },
    {
      dateTimeStamp: '2022-10-03',
      score: 33587,
      name: 'sent',
      secondaryName: 'sent',
    },
    {
      dateTimeStamp: '2022-10-04',
      score: 45445,
      name: 'sent',
      secondaryName: 'sent',
    },
    {
      dateTimeStamp: '2022-10-05',
      score: 34534,
      secondaryScore: 30000,
      name: 'sent',
      secondaryName: 'sent',
    },
    {
      dateTimeStamp: '2022-10-06',
      score: 34555,
      secondaryScore: 52677,
      name: 'sent',
      secondaryName: 'sent',
    },
    {
      dateTimeStamp: '2022-10-07',
      score: 67897,
      name: 'sent',
      secondaryName: 'sent',
    },
  ]}
/>;
1.2.5

5 days ago

1.2.4

13 days ago

1.2.3

20 days ago

1.2.2

3 months ago

1.2.1

3 months ago

1.2.0

4 months ago

1.1.1

4 months ago

1.1.0

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

9 months ago

0.6.3

10 months ago

0.6.2

10 months ago

0.6.1

10 months ago

0.6.0

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

2 years ago