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

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

问题描述

我坚持要求在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,该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图表中显示阈值线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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