Highcharts 笔记

图例白色,第二种方法是饼状图

//方法一:
legend: { 
    itemStyle:{
        color:"#fff"
    }
},
//方法二:
plotOptions: {
    pie: {
        allowPointSelect: true,
        cursor: 'pointer',
        dataLabels: {
            enabled: true,
            format: '<b>{point.name}</b>: {point.percentage:.1f} %',
            style: {
                color: "#fff",
                textOutline: "none"
            }
        }
    }
},

背景透明

chart: { 
    backgroundColor: 'rgba(0,0,0,0)'
},

颜色为渐变

var colors = ['#76d0ff','#90ebff','#9ff0f5','#58dad0','#caf0c2' ];
Highcharts.getOptions().colors = Highcharts.map(colors, function (color) {
    return {
        radialGradient: { cx:0, cy: -0.8,r:2.3 },
        stops: [[0, color], [2, Highcharts.Color(color).brighten(14).get('rgb')] // darken 
        ]
    };
});

x轴和y轴的字体颜色

xAxis: { 
    labels: { 
        style:{
            color:"#fff"
        }
    }
},

图例位置更改

legend: {
    layout: 'horizontal',// 图例数据项的布局。布局类型: "horizontal" 或 "vertical" 即水平布局和垂直布局 默认是:horizontal (ps:就是横竖排列)
    align: 'right',// 设定图例在图表区中的水平对齐方式,合法值有left,center 和 right。
    verticalAlign: 'top', // 垂直对齐标准
    y: -20, // 水平偏移
    x:0, // 竖直偏移
    itemMarginTop: 5, // 图例项顶部外边距
    itemMarginBottom: 3, // 图例项底部外边距
    floating: true, // 是否浮动,浮动则在图表中显示图例 
}, 

x轴文字旋转度数

xAxis: { 
    labels: { 
        rotation: 0    
    }
},

图例设置边框和颜色(注意大小写)

legend: {
    borderWidth: 1, 
    borderColor:"#fff", 
},

x轴和y轴的轴颜色

xAxis: {   
    lineColor: '#38edff' 
},
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值