简体   繁体   中英

Override Highcharts waterfall isSum() value

对于瀑布图,不幸的是,如果将其设置为isSum() ,有一种方法可以覆盖列标签上显示的值,因为每列传递的值都是四舍五入的,因此与最后一次与我们的excel数据比较时会有差异列设置为isSum()

You can define a data label for each column individually.

{
            name: 'Balance',
            isSum: true,
            color: Highcharts.getOptions().colors[1],
            dataLabels: {
                format: 'my data label'
            }

example: http://jsfiddle.net/wjhjjtcz/1/

formatter callback might be usefull in this case. You can check if the point is sum and depending on that information change its text - you wouldn't have to define a data label for each isSum manually.

dataLabels: {
            enabled: true,
            formatter: function () {
                    if (this.point.isSum) {
                    return 'is sum';
                }
                return Highcharts.numberFormat(this.y / 1000, 0, ',') + 'k';
            },

example: http://jsfiddle.net/wjhjjtcz/2/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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