-
Notifications
You must be signed in to change notification settings - Fork 1
/
DonutChart3.js
62 lines (54 loc) · 1.54 KB
/
DonutChart3.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React from "react";
import ReactApexChart from "react-apexcharts";
import ReactDOM from "react-dom";
// code taken and modified from: https://apexcharts.com/react-chart-demos/pie-charts/gradient-donut/
// last visited: 9.11.19
/**
* Donut Chart
*
* @param something
*
* @visComp
* @props {string} type [gradient]
* @props {boolean} dataLabelsEnabled [true]
*/
class DonutChart3 extends React.Component {
constructor(props) {
super(props);
this.state = {
options: {
dataLabels: {
enabled: this.props.type
},
fill: {
type: this.props.type,
},
legend: {
formatter: function(val, opts) {
return val + " - " + opts.w.globals.series[opts.seriesIndex]
}
},
responsive: [{
breakpoint: 480,
options: {
chart: {
width: 200
},
legend: {
position: 'bottom'
}
}
}]
},
series: [44, 55, 41, 17, 15],
}
}
render() {
return (
<div id="chart">
<ReactApexChart options={this.state.options} series={this.state.series} type="donut" width="100%" />
</div>
);
}
}
export default DonutChart3;