繁体   English   中英

如何为 highcharts 的每一列添加 class 名称?

[英]How to add class name for each columns of highcharts?

  • 一个额外的、单独的 class 名称,用于数据点的 higharts 列的图形表示。

$('#cpm-graph-chart').highcharts({
    chart: {
        type: 'column'
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0,
        },
        series: {
            cursor: 'pointer'
        }
    },
    series: [{
        name: 'Graph',
        data: [0, 2, 4, 6],
        dataLabels: {
            enabled: true,
        }
    }]
});

现场演示: http://jsfiddle.net/BlackLabel/d2hnse0g/

您可以使用className选项为每个点添加额外的单独 class 名称:

series: [{
    data: [{
            y: 0,
            className: 'point-one'
        },
        {
            y: 2,
            className: 'point-two'
        },
        ...
    ],
    ...
}]

现场演示: http://jsfiddle.net/BlackLabel/1cmp0s69/

API 参考: https://api.highcharts.com/highcharts/series.column.data.className

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM