问题
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