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 } } } ] };
本文作者:冷闲欧巴
本文链接:https://www.cnblogs.com/bkings/p/16148476.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!