更改 CSS Angular Kendo Chart - 设置线条值为 0 的样式
I would like to change the CSS style of the grid line in which the value is zero.
How can I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的事情是根据点的值更改标记颜色。您可以将系列标记的颜色/背景/边框颜色属性设置为函数而不是字符串并返回所需的颜色:
这是一个 DEMO
与标记相比,更改线条的颜色更为复杂。您可以将渐变应用于颜色高于 0 和颜色低于 0 的线条。
在页面上的任何位置定义 SVG 渐变:
然后在脚本中找到数据集的最小值和最大值并更新渐变停止偏移:
最后,在图表渲染上,将渐变应用于线条:
这是另一个 DEMO
The easiest thing would be to change the Marker color based on value of the point. You can set the color/background/border color property of the series markers to a function instead of a string and return desired color:
Here is a DEMO
Changing the color of the line as opposed to the markers is more complicated. You can apply a gradient to the line with color for above 0 and color for below 0.
Define an SVG gradient anywhere on the page:
Then in script find min and max of your dataset and update the gradient stop offsets:
Finally, on chart render, apply the gradient to the line:
Here is another DEMO