echarts 折线图配置项
var option = { // 折线对应的标题 legend: { data: ['总收入', '订单笔数'], right: 10, top: 3 }, // 布局位置 grid: { top: '50px', left: '4%', right: '2%', bottom: '4%', containLabel: true }, // 横坐标刻度文字数据展示 xAxis: { type: 'category', splitLine: { show: false }, boundaryGap: false, axisLabel: { textStyle: { fontSize: 10, color: '#333' } }, axisLine: { // 线的自定义样式 lineStyle: { // 线的颜色 color: { type: 'linear', colorStops: [{ offset: 0, color: '#E15D68' // 0% 处的颜色 }, { offset: 1, color: '#2AB7FE' // 100% 处的颜色 }], }, }, }, // 数据 data: this.data.trendServerData[name], }, // 纵坐标配置,数组【0】在左边,【1】在右边 yAxis: [{ type: 'value', nameTextStyle: { fontSize: 12 }, splitLine: { show: false }, axisTick: { show: false }, // 线的配置 axisLine: { show: true, lineStyle: { color: '#E15D68', } }, // 字体的配置 axisLabel: { color: '#666', fontSize: 12, textStyle: { fontSize: 15, color: '#E15D68' } } }, { type: 'value', nameTextStyle: { fontSize: 12 }, splitLine: { show: false }, axisTick: { show: false }, // 线的配置 axisLine: { show: true, lineStyle: { color: '#2AB7FE', } }, // 字体的配置 axisLabel: { color: '#666', fontSize: 12, textStyle: { fontSize: 15, color: '#2AB7FE' } } }], // 折线数据填充 series: [{ // 和legend中的data对应 name: '订单笔数', type: 'line', symbolSize: 2, yAxisIndex: 1, // 数据源 data: this.data.trendData[name].number, // 每个点上显示对应的数据 label: { show: true, formatter: function (data) { return data.value; } }, // 线的样式设置 itemStyle: { normal: { color: '#3CA3FF', lineStyle: { //线的颜色 color: '#3CA3FF' }, width: 1 } } }, { // 和legend中的data对应 name: '总收入', type: 'line', symbolSize: 2, yAxisIndex: 0, // 数据源 data: this.data.trendData[name].amount, // 每个点上显示对应的数据 label: { show: true, formatter: function (data) { return data.value; } }, // 线的样式设置 itemStyle: { normal: { color: '#F56379', lineStyle: { //线的颜色 color: '#F56379' }, width: 1 } } } ] };


浙公网安备 33010602011771号