echart1() {
				var myChart = echarts.init(document.getElementById('echart1'));
				var option = {
					tooltip: {
						trigger: 'axis',
						axisPointer: {
							type: 'shadow'
						}
					},
					grid: {
						top: '18%',
						right: '1%',
						left: '1%',
						bottom: '1%',
						containLabel: true
					},
					xAxis: [{
						type: 'category',
						data: ['城关镇', '云雾山镇', '曾溪镇', '中池镇', '后柳镇', '喜河镇', '池河镇', '迎丰镇', '熨斗镇', '两河镇', '饶峰镇'],
						axisLine: {
							lineStyle: {
								color: '#335e83'
							}
						},
						axisLabel: {
							margin: 10,
							color: '#6b98fa',
							textStyle: {
								fontSize: 12
							},
							rotate: 45,

						},
					}],
					yAxis: [{
						name: "单位:人次",
						nameTextStyle: {
							color: "#6b98fa"
						},
						splitNumber: 3,
						axisLabel: {
							formatter: '{value}',
							color: '#6b98fa',
						},
						axisLine: {
							show: false,
						},
						splitLine: {
							show: true,
							lineStyle: {
								color: '#335e83'
							}
						},
					}],
					series: [{
						type: 'bar',
						data: [100, 50, 70, 103, 55, 88, 56, 103, 155, 88, 56],
						barWidth: '20px',
						itemStyle: {
							normal: {
								color: function(params) {
									var colorList = ['#9a60b3', '#fc8352', '#3ca272', '#72c0de', '#ee6666',
										'#fbc958', '#a4d48c', '#5470c6', '#0096da', '#ffb400',
										'#00a1a3'
									];
									return colorList[params.dataIndex]
								},
								barBorderRadius: [5, 5, 0, 0]
							}
						},
						label: {
							normal: {
								show: true,
								fontSize: 12,
								color: '#fff',
								position: 'top',
							}
						}
					}]
			
				};
				// 使用刚指定的配置项和数据显示图表。
				myChart.setOption(option);
			},

By lxcss

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注