Quellcode durchsuchen

fe-32 ej2-react-charts 饼状图

master
Chunxian Zhang vor 2 Jahren
Ursprung
Commit
2ec31b8711
1 geänderte Dateien mit 46 neuen und 0 gelöschten Zeilen
  1. +46
    -0
      lazy-timer-fe/src/components/Charts/Pie.jsx

+ 46
- 0
lazy-timer-fe/src/components/Charts/Pie.jsx Datei anzeigen

@ -0,0 +1,46 @@
import React from 'react';
import { AccumulationChartComponent, AccumulationSeriesCollectionDirective, AccumulationSeriesDirective, AccumulationLegend, PieSeries, AccumulationDataLabel, Inject, AccumulationTooltip } from '@syncfusion/ej2-react-charts';
import { useStateContext } from '../../contexts/ContextProvider';
const Doughnut = ({ id, data, legendVisiblity, height }) => {
const { currentMode } = useStateContext();
return (
<AccumulationChartComponent
id={id}
legendSettings={{ visible: legendVisiblity, background: 'white' }}
height={height}
background={currentMode === 'Dark' ? '#33373E' : '#fff'}
tooltip={{ enable: true }}
>
<Inject services={[AccumulationLegend, PieSeries, AccumulationDataLabel, AccumulationTooltip]} />
<AccumulationSeriesCollectionDirective>
<AccumulationSeriesDirective
name="Sale"
dataSource={data}
xName="x"
yName="y"
innerRadius="40%"
startAngle={0}
endAngle={360}
radius="70%"
explode
explodeOffset="10%"
explodeIndex={2}
dataLabel={{
visible: true,
name: 'text',
position: 'Inside',
font: {
fontWeight: '600',
color: '#fff',
},
}}
/>
</AccumulationSeriesCollectionDirective>
</AccumulationChartComponent>
);
};
export default Doughnut;

Laden…
Abbrechen
Speichern