|
|
@@ -14,7 +14,7 @@ class ChartDataBar extends React.Component {
|
|
|
series: [
|
|
|
{
|
|
|
data: [44, 55, 41, 64, 22, 43, 21, 44, 42, 67, 43, 86, 42, 99, 131, 313],
|
|
|
- name: 'jumlah laporan',
|
|
|
+ name: "jumlah laporan",
|
|
|
},
|
|
|
],
|
|
|
options: {
|
|
|
@@ -39,7 +39,7 @@ class ChartDataBar extends React.Component {
|
|
|
},
|
|
|
},
|
|
|
|
|
|
- colors: ['#B2B0D2'],
|
|
|
+ colors: ["#B2B0D2"],
|
|
|
dataLabels: {
|
|
|
enabled: true,
|
|
|
offsetX: -6,
|
|
|
@@ -63,9 +63,8 @@ class ChartDataBar extends React.Component {
|
|
|
// name: ["LLDikti I", "LLDikti II", "LLDikti III", "LLDikti IV", "LLDikti V", "LLDikti VI", "LLDikti VII", "LLDikti VIII", "LLDikti IX", "LLDikti X", "LLDikti XI", "LLDikti XII", "LLDikti XIII", "LLDikti XIV", "LLDikti XV", "LLDikti XVI"]
|
|
|
},
|
|
|
fill: {
|
|
|
- colors: ['#B2B0D2'],
|
|
|
- }
|
|
|
-
|
|
|
+ colors: ["#B2B0D2"],
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
}
|
|
|
@@ -73,14 +72,28 @@ class ChartDataBar extends React.Component {
|
|
|
async componentDidMount() {
|
|
|
const { token } = this.props;
|
|
|
const data = await jumlahLaporan(token);
|
|
|
- console.log(data.data);
|
|
|
+ this.setState((prevState) => ({
|
|
|
+ ...prevState,
|
|
|
+ series: [{ data: data.data.map((e) => e.jumlah_laporan), name: "jumlah laporan" }],
|
|
|
+ options: {
|
|
|
+ ...prevState.options,
|
|
|
+ xaxis: {
|
|
|
+ categories: data.data.map((e) => e._id),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
return (
|
|
|
- <div id="chart">
|
|
|
- <ReactApexChart options={this.state.options} series={this.state.series} type="bar" height={430} />
|
|
|
- </div>
|
|
|
+ <Card className="card-default">
|
|
|
+ <CardBody>
|
|
|
+ <div id="chart">
|
|
|
+ <ReactApexChart options={this.state.options} series={this.state.series} type="bar" height={400} />
|
|
|
+ </div>
|
|
|
+ </CardBody>
|
|
|
+ </Card>
|
|
|
+
|
|
|
);
|
|
|
}
|
|
|
}
|