Highcharts更新分组数据点颜色 [英] Highcharts update grouped data point color

查看:149
本文介绍了Highcharts更新分组数据点颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以更新分组数据集中单个点的颜色?我似乎无法找到一种可靠地设置颜色的方法。



小提琴可以找到 here 展示这个问题。

解决方案

因为它们不能通过构造函数选项专门定位(因为我们不知道Highcharts算法会生成哪些点)。

更重要的是,Higcharts doesn' t允许在分组点上执行更新功能。



作为解决方法,您的罐改变点的SVG元素的CSS:

  chart.series [0] .groupedData [0] .graphic.css({
color:'red'
});

现场演示: http://jsfiddle.net/BlackLabel/9ey2yq3u/



API参考: https://api.highcharts.com/class-reference /Highcharts.SVGElement#css


Is there any way to update the color of a single point in a grouped data set? I can't seem to find a way to reliably set the colors.

A fiddle can be found here demonstrating the issue.

解决方案

Points are grouped during the rendering process of the chart so they cannot be specifically targeted via constructor options (because we don't know which points will be generated by Highcharts algorithms).

What is more, Higcharts doesn't allow performing update function on the grouped point.

As a workaround your can change the CSS of point's SVG element:

chart.series[0].groupedData[0].graphic.css({
    color: 'red'
});

Live demo: http://jsfiddle.net/BlackLabel/9ey2yq3u/

API reference: https://api.highcharts.com/class-reference/Highcharts.SVGElement#css

这篇关于Highcharts更新分组数据点颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆