You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
2.6 KiB

import React, { useEffect, useRef, useState } from 'react'
import Highcharts from 'highcharts'
import HighchartsReact from 'highcharts-react-official'
import { Col, Row } from 'reactstrap'
import { format_angka } from '../util'
import collect from 'collect.js'
import $ from 'jquery'
const ZonaPengawasan = ({ dataSend }) => {
const base_url = '<?=base_url()?>'
const refChart = useRef(null)
const refChart2 = useRef(null)
const [dataAll, setDataAll] = useState(null)
// const [dataZpLuarKpp, setDataZpLuarKpp] = useState(null)
useEffect(() => {
$.get({
url: base_url + 'kewilayahan/kytp/sebaranZonaPengawasan',
dataType: 'json',
type: 'POST',
data: {
...dataSend
},
success: (data) => {
setDataAll(data.all)
}
})
}, [dataSend])
const optionsChart = (data, title) => {
const total_wp = collect(data).sum('y')
return {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
zoomType: 'xy',
height: '300'
},
title: {
text: title,
style: { fontSize: '10px' }
},
tooltip: {
pointFormat: '<b>{point.percentage:.1f}%</b><br>: {point.y} dari ' + format_angka(total_wp) + ' total Lokasi KPDL'
},
accessibility: {
point: {
valueSuffix: '%'
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
style: { fontSize: '10px' },
format: '{point.name}: <br> {point.percentage:.1f} %'
}
}
// series: pie_click
},
series: [
{
name: '',
data
}
]
}
}
return (
<>
<Row className="center">
<Col md="12">
<HighchartsReact
ref={refChart}
highcharts={Highcharts}
options={optionsChart(dataAll, 'Sebarann Zona Pengawasan yang telah dilakukan kegiatan MATOA/KPDL')}
/>
<div className="center text-center">
<span className="text-center">Sebaran Lokasi Usaha atas WP Terdaftar</span>
</div>
</Col>
{/* <Col md="6">
<HighchartsReact ref={refChart} highcharts={Highcharts} options={optionsChart(dataZpLuarKpp, "Zona Pengawasan Luar KPP")} />
<div className="center text-center">
<span>KPP Terdaftar {"<>"} KPP Zona</span>
</div>
</Col> */}
</Row>
</>
)
}
export default ZonaPengawasan