1. 将Y周设置为百分比 %
yAxis: {axisLabel: {show: true,interval: 'auto',formatter: '{value} %'},},
2. 将折线图的提示值设置为百分比
series:[{type: 'line',label:{formatter:'{c} %'}}]
3. 线图下载
// 直接保存图片option:{toolbox: {show: true,feature: {dataZoom: { // 区域缩放yAxisIndex: 'none'},dataView: {readOnly: false}, // 查看数据magicType: {type: ['line', 'bar']}, // 图形切换restore: {}, //刷新saveAsImage: {} //保存图片}},}//将图转为base64——JS写法var myChart = echarts.init(document.getElementById(element));myChart.setOption(option);var myChartPic = myChart.getDataURL({pixelRatio: 2,backgroundColor: '#fff'})
4 待整理
echarts
1. 修改坐标轴颜色
aAxis:{
axisLine:{
lineStyle:{
color:’#fff’
}
}
}
2. 修改柱图颜色
series:[
{
color:’’, //图实体颜色
backgroundStyle:{
color:’’, // 图背景色
}
}
]
3. 修改坐标轴字体大小
aAxis:{
axisLabel:{
fontSize:18
}
}
4. 设置柱状图每一条的宽度
series:{
barWidth:10
}
5. canvas的背景大小会影响位置,通过绝对定位确认位置
style={{position:’absolute’,top:-1,left:-1}}
/>
6. 给饼图设置颜色
series: [
{
type: ‘pie’,
…
data: [
{value: 335, name: ‘直接访问’,itemStyle:{normal:{color:’#FE0000’}}},
{value: 310, name: ‘邮件营销’,itemStyle:{normal:{color:’#F29700’}}},
{value: 234, name: ‘联盟广告’,itemStyle:{normal:{color:’#F29700’}}},
]
}
]
7. 设置行线(分隔线)样式
yAxis:{
splitLine:{
lineStyle:{
type:’dashed’,
}
},
}
