Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1690
Moving crosshairPoint
posted

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

Parents
  • 30692
    Verified Answer
    Offline posted

    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

Reply Children