Selaa lähdekoodia

fe-35 ej2-react-charts Stacked Chart

master
Chunxian Zhang 2 vuotta sitten
vanhempi
commit
53d3a60cdd
1 muutettua tiedostoa jossa 31 lisäystä ja 0 poistoa
  1. +31
    -0
      lazy-timer-fe/src/components/Charts/Stacked.jsx

+ 31
- 0
lazy-timer-fe/src/components/Charts/Stacked.jsx Näytä tiedosto

@ -0,0 +1,31 @@
import React from 'react';
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, StackingColumnSeries, Tooltip } from '@syncfusion/ej2-react-charts';
import { stackedCustomSeries, stackedPrimaryXAxis, stackedPrimaryYAxis } from '../../data/dummy';
import { useStateContext } from '../../contexts/ContextProvider';
const Stacked = ({ width, height }) => {
const { currentMode } = useStateContext();
return (
<ChartComponent
id="charts"
primaryXAxis={stackedPrimaryXAxis}
primaryYAxis={stackedPrimaryYAxis}
width={width}
height={height}
chartArea={{ border: { width: 0 } }}
tooltip={{ enable: true }}
background={currentMode === 'Dark' ? '#33373E' : '#fff'}
legendSettings={{ background: 'white' }}
>
<Inject services={[StackingColumnSeries, Category, Legend, Tooltip]} />
<SeriesCollectionDirective>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
{stackedCustomSeries.map((item, index) => <SeriesDirective key={index} {...item} />)}
</SeriesCollectionDirective>
</ChartComponent>
);
};
export default Stacked;

Ladataan…
Peruuta
Tallenna