|
@@ -2,62 +2,63 @@ import React from 'react';
|
2
|
2
|
import { Card } from 'antd';
|
3
|
3
|
import * as echarts from 'echarts/core';
|
4
|
4
|
import Chart from '@/components/chart';
|
|
5
|
+import { getStatIssueLoc } from '@/service/stat';
|
5
|
6
|
|
6
|
7
|
export default (props) => {
|
7
|
8
|
|
8
|
|
- const option = {
|
9
|
|
- tooltip: {
|
10
|
|
- trigger: 'axis',
|
11
|
|
- axisPointer: {
|
12
|
|
- type: 'cross',
|
13
|
|
- label: {
|
14
|
|
- backgroundColor: '#FB9900'
|
15
|
|
- }
|
16
|
|
- }
|
17
|
|
- },
|
18
|
|
- grid: {
|
19
|
|
- left: '3%',
|
20
|
|
- bottom: '3%',
|
21
|
|
- width: '92%',
|
22
|
|
- height: '90%',
|
23
|
|
- containLabel: true
|
24
|
|
- },
|
25
|
|
- xAxis: [
|
26
|
|
- {
|
27
|
|
- type: 'category',
|
28
|
|
- data: ['公益宣传', '环境卫生', '基础设施', '文明素养', '公共秩序', '其他'],
|
29
|
|
- // boundaryGap: true,
|
30
|
|
- axisTick: {
|
31
|
|
- alignWithLabel: true,
|
|
9
|
+ const [option, setOption] = React.useState({});
|
|
10
|
+
|
|
11
|
+ React.useEffect(() => {
|
|
12
|
+ getStatIssueLoc().then(res => {
|
|
13
|
+ setOption({
|
|
14
|
+ tooltip: {
|
|
15
|
+ trigger: 'axis',
|
|
16
|
+ axisPointer: {
|
|
17
|
+ type: 'cross',
|
|
18
|
+ label: {
|
|
19
|
+ backgroundColor: '#FB9900'
|
|
20
|
+ }
|
|
21
|
+ }
|
32
|
22
|
},
|
33
|
|
- axisLabel: {
|
34
|
|
- interval: 0,
|
35
|
|
- }
|
36
|
|
- }
|
37
|
|
- ],
|
38
|
|
- yAxis: [
|
39
|
|
- {
|
40
|
|
- type: 'value',
|
41
|
|
- minInterval: 1
|
42
|
|
- }
|
43
|
|
- ],
|
44
|
|
- series: [
|
45
|
|
- {
|
46
|
|
- type: 'bar',
|
47
|
|
- barWidth: '20%',
|
48
|
|
- itemStyle: {
|
49
|
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
50
|
|
- { offset: 0, color: '#FB9900' },
|
51
|
|
- { offset: 1, color: '#FFD38F' }
|
52
|
|
- ])
|
|
23
|
+ grid: {
|
|
24
|
+ top: 20,
|
|
25
|
+ left: 40,
|
|
26
|
+ bottom: 100,
|
|
27
|
+ right: 40,
|
53
|
28
|
},
|
54
|
|
- data: [2, 1, 2, 3, 2, 1]
|
55
|
|
- }
|
56
|
|
- ]
|
57
|
|
- };
|
|
29
|
+ xAxis: [
|
|
30
|
+ {
|
|
31
|
+ type: 'category',
|
|
32
|
+ data: res.map(x => x.name),
|
|
33
|
+ axisLabel: {
|
|
34
|
+ rotate: 45,
|
|
35
|
+ }
|
|
36
|
+ }
|
|
37
|
+ ],
|
|
38
|
+ yAxis: [
|
|
39
|
+ {
|
|
40
|
+ type: 'value',
|
|
41
|
+ minInterval: 1
|
|
42
|
+ }
|
|
43
|
+ ],
|
|
44
|
+ series: [
|
|
45
|
+ {
|
|
46
|
+ type: 'bar',
|
|
47
|
+ itemStyle: {
|
|
48
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
49
|
+ { offset: 0, color: '#FB9900' },
|
|
50
|
+ { offset: 1, color: '#FFD38F' }
|
|
51
|
+ ])
|
|
52
|
+ },
|
|
53
|
+ data: res.map(x => x.value)
|
|
54
|
+ }
|
|
55
|
+ ]
|
|
56
|
+ })
|
|
57
|
+ })
|
|
58
|
+ }, []);
|
58
|
59
|
|
59
|
60
|
return (
|
60
|
|
- <Card title="点位分类" extra={'只显示本年度问题数前10的点位'}>
|
|
61
|
+ <Card title="点位分类">
|
61
|
62
|
<Chart option={option} style={props.style}></Chart>
|
62
|
63
|
</Card>
|
63
|
64
|
)
|