0
votes

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.

Chart with Threshold line

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
Doesn't seem to be an option on the standard component. Create a new class and extend ColumnChart. Then add a new function to calculate it out. :) - The_asMan
ok, thanks. any pointers on where to start? :) - midhunhk
Not really besides what I posted in the comment above lol. I would imagine your biggest issue is going to be placement of the line. Why not start there. - The_asMan

1 Answers

0
votes

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>