基于已有代码增加2021、2022年车流量统计图表 - JS代码示例
this.define("car", function () {\n o2.load(echartUrl, function () {\n // 基于准备好的dom,初始化echarts实例\n var myCar = echarts.init(document.getElementById('car'));\n options = {\n title: {\n text: "车流量统计",\n left: 'right',\n textStyle: {\n color: '#fff'\n }\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: { type: 'shadow' },\n\n },\n legend: {\n x: 'center',\n y: '0',\n icon: 'circle',\n itemGap: 8,\n textStyle: {\n color: 'rgba(255,255,255,.5)',\n fontSize: 16\n },\n itemWidth: 10,\n itemHeight: 10,\n },\n grid: {\n left: '0',\n top: '30',\n right: '15',\n bottom: '0',\n containLabel: true\n },\n xAxis: {\n type: 'category',\n data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '2021年1月', '2021年2月', '2021年3月', '2021年4月', '2021年5月', '2021年6月', '2021年7月', '2021年8月', '2021年9月', '2021年10月', '2021年11月', '2021年12月', '2022年1月', '2022年2月', '2022年3月', '2022年4月', '2022年5月', '2022年6月', '2022年7月'],\n axisLine: { show: false },\n\n axisLabel: {\n textStyle: {\n color: 'rgba(255,255,255,.6)',\n fontSize: 14\n }\n },\n },\n\n yAxis: {\n type: 'value',\n splitNumber: 4,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: {\n color: 'rgba(255,255,255,0.05)'\n }\n },\n axisLabel: {\n textStyle: {\n color: 'rgba(255,255,255,.6)',\n fontSize: 14\n },\n },\n },\n series: [{\n name: '入场车流量',\n type: 'bar',\n barWidth: '15%',\n itemStyle: {\n normal: {\n color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{\n offset: 0,\n color: '#8bd46e'\n }, {\n offset: 1,\n color: '#03b48e'\n }]),\n barBorderRadius: 11,\n }\n\n },\n data: [6609, 7502, 7948, 6589, 7403, 7086, 4547, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000, 21000, 22000, 23000]\n\n },\n {\n name: '出场车流量',\n type: 'bar',\n barWidth: '15%',\n itemStyle: {\n normal: {\n color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{\n offset: 0,\n color: '#3893e5'\n }, {\n offset: 1,\n color: '#248ff7'\n }]),\n barBorderRadius: 11,\n }\n },\n data: [6541, 7430, 7860, 6426, 6998, 6970, 4357, 5500, 6500, 7500, 8500, 9500, 10500, 11500, 12500, 13500, 14500, 15500, 16500, 17500, 18500, 19500, 20500, 21500, 22500, 23500]\n\n },\n\n\n ]\n };\n myCar.setOption(options);\n window.addEventListener("resize", function () {\n car.resize();\n });\n }.bind(this));\n\n})
原文地址: https://www.cveoy.top/t/topic/p06s 著作权归作者所有。请勿转载和采集!