Skip to content

Commit 99fc60a

Browse files
committed
set legend
1 parent 6c58f91 commit 99fc60a

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/pages/lottery/ballChart.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require('echarts/lib/chart/line');
1010
// 引入提示框和标题组件
1111
require('echarts/lib/component/tooltip');
1212
require('echarts/lib/component/title');
13+
require('echarts/lib/component/legend');
1314

1415
@inject('ballChartStore')
1516
@observer
@@ -116,7 +117,20 @@ export default class BallChart extends React.Component<IProps> {
116117
title: {
117118
text: '红球分布图'
118119
},
119-
tooltip: {},
120+
tooltip: {
121+
trigger: 'axis',
122+
axisPointer: {
123+
// lineStyle: {
124+
// color: '#ddd'
125+
// }
126+
},
127+
backgroundColor: 'rgba(255,255,255,1)',
128+
// padding: [5, 10],
129+
textStyle: {
130+
color: '#7588E4',
131+
},
132+
extraCssText: 'box-shadow: 0 0 5px rgba(0,0,0,0.3)'
133+
},
120134
grid: {
121135
left: '2%',
122136
right: '2%',
@@ -127,9 +141,14 @@ export default class BallChart extends React.Component<IProps> {
127141
data: reds.map(v => v.name)
128142
},
129143
yAxis: {},
144+
legend: {
145+
right: 20,
146+
orient: 'horizontal',
147+
data: ['红球1','红球2','红球3','红球4','红球5','红球6']
148+
},
130149
series: series,
131150
// color: ['#f54646','#f5464685','#f5464670','#f5464655','#f5464640','#f5464625']
132-
color: ['#f54646','#c23531','#2f4554', '#61a0a8', '#d48265', '#91c7ae','#749f83', '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3']
151+
color: ['#f54646','#c23531','#2f4554', '#61a0a8', '#d48265', '#6e7074','#749f83', '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3']
133152
})
134153
})
135154
}

0 commit comments

Comments
 (0)