ECharts坐标轴是否显示和修改显示颜色改变字体颜色


var  myChart = echarts.init(document.getElementById('box'));
option = {
            color: ['#3398DB'],
             title: {
                text: '总收益',
                x:'center',
                top:'2%',
            },               
            //  在坐标轴上显示数据
            label:{
                normal:{
                    show: true,
                    textStyle:{color:'#d27d39',fontSize:"18"},
                    position: 'top'
                },                
            },    
            tooltip : {
                trigger: 'axis',
                axisPointer : {            // 坐标轴指示器,坐标轴触发有效
                    type : 'line'        // 默认为直线,可选为:'line' | 'shadow'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis : [
                {
                    type : 'category',
                    data : ['1/30', '1/31', '2/1', '2/2', '2/3'],
                    axisTick: {
                        alignWithLabel: true
                    },                        
                    // 控制网格线是否显示
                    splitLine: {
                            show: false,
                            //  改变轴线颜色
                            lineStyle: {
                                // 使用深浅的间隔色
                                color: ['red']
                            }                            
                    },
                    //  改变x轴颜色
                    axisLine:{
                        lineStyle:{
                            color:'#df0af8',
//                            width:8,//这里是为了突出显示加上的,可以去掉
                        }
                    },                         
                    //  改变x轴字体颜色和大小
                    axisLabel: {
                        textStyle: {
                            color: '#21abfa',
                            fontSize:'16'
                        },
                    },                        
                }
            ],
            yAxis : [
                {
                    //  隐藏y轴
                    axisLine: {show: false},
                    // 去除y轴上的刻度线
                    axisTick: {
                            show: false
                    },                    
                    // 控制网格线是否显示
                    splitLine: {
                            show: true,
                            //  改变轴线颜色
                            lineStyle: {
                                // 使用深浅的间隔色
                                color: ['red']
                            }                            
                    },
                    //  改变y轴字体颜色和大小
                    axisLabel: {
                        textStyle: {
                            color: '#ef4c13',
                            fontSize:'16'
                        },
                    },                    
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'总收益',
                    type:'bar',
                    barWidth:'30%',  //  调节柱形图宽度的大小
                    itemStyle:{
                            normal:{
                                color:'#4e76b5'
                            },
                        },            
                    data:[10, 52, 200, 334, 390]
                }
            ]
};

 myChart.setOption(option);





  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值