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月'],\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]\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]\n\n },\n\n\n ]\n };\n myCar.setOption(options);\n window.addEventListener("resize", function () {\n car.resize();\n });\n }.bind(this));\n\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月', '8月', '9月', '10月', '11月', '12月'],\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: [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000]\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: [2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000]\n\n },\n\n\n ]\n };\n myCar.setOption(options);\n window.addEventListener("resize", function () {\n car.resize();\n });\n }.bind(this));\n\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月', '8月', '9月', '10月', '11月', '12月'],\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: [3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000]\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: [4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000]\n\n },\n\n\n ]\n };\n myCar.setOption(options);\n window.addEventListener("resize", function () {\n car.resize();\n });\n }.bind(this));\n\n})

Echarts图表:车流量统计,添加2021、2022年数据 - JavaScript代码

原文地址: https://www.cveoy.top/t/topic/p07d 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录