I've got a line chart showing a dollar value over time. Think of it as the 
balance of a savings account. It goes up and down every month or so. What I'm 
trying to do is overlay little widgets on top of that line on the chart to 
represent events that may or may not have affected the line's value. This is 
actually similar to the Yahoo Finance stock chart with the event overlays. 

Anyway, it's easy enough to add a CartesianDataCanvas as an annotation element 
to my line chart and then add children to it. It has a nice little addDataChild 
method that allows you to specify an x axis value and a y axis value and it 
figures out what the corresponding x and y coordinates are and places the child 
there. Great so far. 

Say my line series data provider looks like this:
{date:new Date(2009, 1, 1), balance:100}
{date:new Date(2009, 2, 8), balance:140}
{date:new Date(2009, 3, 5), balance:95}

If I have an event for 1/1/2009, I can look up that the balance was 100 on that 
day and place the event widget at [1/1/2009, 100]. However, if I have an event 
on 1/15/2009, from looking at the data provider above, I know that the balance 
was still 100, but because the line is diagonally vectoring towards the next 
value of 140, my data point is misplaced if I put it at [1/15/2009, 100]. 

Is there a way to get the line's y value given an x value?
or
Can I change my line chart to not draw diagonal lines and instead draw square 
lines so I won't have this problem?

Ryan

Reply via email to