|
|
@@ -4,6 +4,7 @@ import { Container, Row, Col, Card, CardHeader, CardBody } from "reactstrap";
|
|
|
import { connect } from "react-redux";
|
|
|
import { jumlahLaporan } from "@/actions/pelaporan";
|
|
|
import dynamic from "next/dynamic";
|
|
|
+import { getjumlahStatusLaporan } from "../../actions/graph";
|
|
|
const ReactApexChart = dynamic(() => import("react-apexcharts"), { ssr: false });
|
|
|
|
|
|
|
|
|
@@ -11,7 +12,7 @@ class ChartRadarB extends React.Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
|
|
|
- this.radar = {
|
|
|
+ this.state = {
|
|
|
series: [
|
|
|
{
|
|
|
name: 'Keberatan',
|
|
|
@@ -52,12 +53,30 @@ class ChartRadarB extends React.Component {
|
|
|
},
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+ async componentDidMount() {
|
|
|
+ const { token } = this.props;
|
|
|
+ const data = await getjumlahStatusLaporan(this.props.token);
|
|
|
+ this.setState((prevState) => ({
|
|
|
+ ...prevState,
|
|
|
+ series: [{ data: data.data.map((e) => e.jumlah_keberatan), name: "Keberatan" }
|
|
|
+ , { data: data.data.map((e) => e.jumlah_banding), name: "Banding" },
|
|
|
+ { data: data.data.map((e) => e.jumlah_pemantauan_perbaikan), name: "Pemantauan perbaikan" },
|
|
|
+ { data: data.data.map((e) => e.jumlah_pencabutan_sanksi), name: "Pencabutan sanksi" }],
|
|
|
+ options: {
|
|
|
+ ...prevState,
|
|
|
+ xaxis: {
|
|
|
+ categories: data.data.map((data) => data.pembina.name),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }));
|
|
|
+ }
|
|
|
render() {
|
|
|
return (
|
|
|
<Card className="card-default">
|
|
|
<CardBody>
|
|
|
<div id="chart">
|
|
|
- <ReactApexChart options={this.radar.options} series={this.radar.series} type="radar" height={400} />
|
|
|
+ <ReactApexChart options={this.state.options} series={this.state.series} type="radar" height={400} />
|
|
|
</div>
|
|
|
</CardBody>
|
|
|
</Card>
|