Hi,
I am trying to make a moving crosshairPoint, i.e. based on igVideoPlayer progress event set positions of igDataChart's crosshairPoint to corresponding series item:
progress: function (evt, ui) {
...
$("#chart").igDataChart("option", "crosshairPoint", { x: data[i].Timestamp, y: data[i].Rating });
}
However I see on a screen just horizontal line, i.e. X coordinate is wrong and crosshair point is somewhere outside the chart. For positioning I use the same array which is specified in chart's dataSource. Did I miss something ?
Thanks,
Ed
Ed,
The crosshair point should be set in "world coordinates". So it is not even relative to the current zoom of the chart. If you set the x coordinate to .5 it will be halfway along the axis range. So if you wanted to convert an axis value to a crosshair value you'd need to determine how far your value is between the minimum and maximum of the range of that axis:
var xValue = (axisValue - axisMinimum) / (axisMaximum - axisMinimum);
Does that make sense?
-Graham
BTW, if you aren't setting your axis range explicitly you may need to acquire it from the chart which you can do by calling the getActualMinimumValue(axisName) or getActualMaximumValue(axisName) methods.