为echarts的叠加柱状图设置颜色
2016-12-29 15:28
1166 查看
1、废话少说,直接上代码(前提先引入echarts先关文件)
var myChart = echarts.init(document.getElementById('chartOne'));
// 指定图表的配置项和数据
var option = {
title: {
text: '近'+days+'天各类型通知发布数量',
textStyle: {
color: '#c23531',
fontSize: 14
}
},
tooltip : {
trigger: 'axis',
axisPointer : {
type : 'shadow'
}
},
legend: {
data:['扶贫局通知','云平台通知','其他']
},
grid: {
left: '3%',
right: '2%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
data : xAData //X轴坐标
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'扶贫局通知',
type:'bar',
//data:fu,
data:[11,33,45],
//设置柱体颜色
itemStyle:{
normal:{color:'#ab78ba'}
}
},
{
name:'云平台通知',
type:'bar',
//data:yun,
data:[11,28,45],
//设置柱体颜色
itemStyle:{
normal:{color:'#72b201'}
}
},
{
name:'其他',
type:'bar',
//data:qi,
data:[22,33,66],
//设置柱体颜色
itemStyle:{
normal:{color:'#08a9f2'}
}
}
]
};
myChart.setOption(option);
2、效果截图
var myChart = echarts.init(document.getElementById('chartOne'));
// 指定图表的配置项和数据
var option = {
title: {
text: '近'+days+'天各类型通知发布数量',
textStyle: {
color: '#c23531',
fontSize: 14
}
},
tooltip : {
trigger: 'axis',
axisPointer : {
type : 'shadow'
}
},
legend: {
data:['扶贫局通知','云平台通知','其他']
},
grid: {
left: '3%',
right: '2%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
data : xAData //X轴坐标
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'扶贫局通知',
type:'bar',
//data:fu,
data:[11,33,45],
//设置柱体颜色
itemStyle:{
normal:{color:'#ab78ba'}
}
},
{
name:'云平台通知',
type:'bar',
//data:yun,
data:[11,28,45],
//设置柱体颜色
itemStyle:{
normal:{color:'#72b201'}
}
},
{
name:'其他',
type:'bar',
//data:qi,
data:[22,33,66],
//设置柱体颜色
itemStyle:{
normal:{color:'#08a9f2'}
}
}
]
};
myChart.setOption(option);
2、效果截图
相关文章推荐
- echarts折线图柱状图的坐标轴的颜色及样式的设置
- echarts 柱状图 ,颜色和显示设置
- echarts 柱状图 ,颜色和显示设置并设置折线的颜色
- echarts折线图柱状图的坐标轴的颜色及样式的设置
- 介绍一篇“让echarts柱状图的每个柱子显示不同的颜色”的好博客
- echarts柱状图,改变柱状颜色
- Extjs设置柱状图柱子颜色和每条柱子颜色
- echarts+ajax+json动态生成多个不同随机颜色的柱状图
- ECharts 设置折线颜色和小圆点颜色
- 使用Echarts柱形图表动态加载数据且颜色的独立设置 bar
- Echarts之柱状图获取点击柱子事件&自定义柱子颜色&类目轴纵向排列
- highcharts图表组件实战经验篇:如何设置柱状图柱子立体(颜色渐变)效果类似3D效果之linearGradient和stops
- echarts 颜色设置
- jQuery插件echarts设置折线图中折线线条颜色和折线点颜色的方法
- Echarts 柱状图颜色控制
- echarts如何给柱形图的每个柱子设置不同颜色
- echarts 设置图表数据颜色
- Echarts-柱状图柱图宽度设置
- echarts-设置折线图中折线线条颜色和折线点颜色
- jfreechart柱状图设置指定两种颜色