在 Flex Chart 中显示阈值线 [英] Show a threshold line in Flex Chart

查看:18
本文介绍了在 Flex Chart 中显示阈值线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我坚持要求在 ColumnChart 上显示水平线以指示阈值水平.我将图表中的数据作为 ArrayCollection.

I am stuck with a requirement to display a horizontal line on a ColumnChart to indicate a threshold level. I have the data to the Chart as an ArrayCollection.

所以我的问题是:是否可以获取 y 轴上显示的值的位置?我想我将能够在图表顶部放置一条线或 1px 高的画布来实现这一点.或者更好的是,是否有任何我可能忽略的内置功能,或者是否有一些开放库可以实现这样的功能?

So my question here : Is it possible to get the location of a value that is shown on the y axis? I think I will be able to place a line or 1px high canvas on top of the Chart to achieve this. Or better, is there any built in functionality that i may have overlooked or is there some open library that can achieve something like this?

推荐答案

最简单的解决方案是将 LineSeries 添加到图表中,对于 X 轴上的每个项目,它在 Y 轴上具有相同的值.

The easiest solution is to add a LineSeries to your chart which has the same value on the Y-axis for each item on the X-axis.

您的数据提供者可以按如下方式生成,柱形图使用结果"作为其 yField,折线图使用阈值"作为其 yField.

Your dataprovider could be produced as follows, with the column chart using "result" for its yField and the line chart using "threshold" as its yField.

<dataset>
  <dataitem>
     <time>16:00</time>
     <result>170</result>
     <threshold>350</threshold>
  </dataitem>
  <dataitem>
     <time>17:00</time>
     <result>430</result>
     <threshold>350</threshold>
  </dataitem>
  <dataitem>
     <time>18:00</time>
     <result>250</result>
     <threshold>350</threshold>
  </dataitem>
</dataset>

这篇关于在 Flex Chart 中显示阈值线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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