echarts 使用问题记录
只记录遇到的问题
1. 添加缩放滚动
加dataZoom配置 (详情需查看echarts配置手册)
也可以将show设置为false就不会显示那个滚动图,但是依然有滚动效果
1 dataZoom: [ 2 { 3 show: true, 4 realtime: true, 5 start: 0, // 数据窗口范围起始百分比 6 end: 78, // 数据窗口范围结束百分比 7 x: "6%", // 水平安放位置,默认为根据grid参数适配,可选为: 8 // {number}(x坐标,单位px) 9 // y: {number}, // 垂直安放位置,默认为根据grid参数适配,可选为: 10 width: "65%", // 指定宽度,横向布局时默认为根据grid参数适配 11 // height: {number}, // 指定高度,纵向布局时默认为根据grid参数适配 12 bottom: "0%", 13 // backgroundColor: 'rgba(0,0,0,0)', // 背景颜色 14 // dataBackgroundColor: '#eee', // 数据背景颜色 15 // fillerColor: 'rgba(144,197,237,0.2)', // 填充颜色 16 // handleColor: 'rgba(70,130,180,0.8)' // 手柄颜色 17 } 18 ],
2. legend 设置单选
修改图例legend颜色,配置color数组,对应图例即可
1 1 "legend":{ 2 2 "orient":"horizontal", // 横向布局 3 3 "icon":"circle", 4 4 "bottom":"3%", // 距离容器底部 5 5 "itemHeight":9, // 图列标记图形的高度 6 6 "textStyle":{ // 文本样式 7 7 "color":"#666", 8 8 "fontSize":12 9 9 }, 10 10 selectedMode: 'single', // 设置单选 11 11 },
3. 一般echarts里面配色都是默认的,如果需要修改,就加上 color:[]配置项
4. 全图默认背景 backgroundColor: '#ff0090'
浙公网安备 33010602011771号