Show a threshold line in Flex Chart

感情迁移 提交于 2019-12-12 04:32:28

问题


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.

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?


回答1:


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.

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>


来源:https://stackoverflow.com/questions/6826094/show-a-threshold-line-in-flex-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!