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
140
Howto get candlestick data in IGFinancialPriceSeries?
posted

I have built a candlestick chart by IGFinancialPriceSeries:

How can I get the candlestick's data by viewForTooltipWithItemlist ?

A futher question:

If the chartview's setting likes these:

infraChart.zoomDisplayType = IGChartZoomHorizontal;
infraChart.maximumZoomScale = 3.0f;
infraChart.minimumZoomScale = 0.5f;

After I scale or drag it, can I use viewForTooltipWithItemlist method to get the data of candlestick in series?

Thanks.

  • 26458
    Verified Answer
    Offline posted

    Hi,

    If you look at the itemList parameter, it's a dictionary, where the value is the data point you pressed on and the key is the series.
    If you only have one series in the chart, you can access the data point by simply using
    IGOHLCPoint *dataPoint = (IGOHLCPoint*)[itemList valueForKey:@"yourSeriesKey"];

    If you have multiple series in the chart, it's best to use the delegate method with an added CGPoint parameter, like so:

    -(UIView *)chartView:(IGChartView *)chartView viewForTooltipWithItemlist:(NSDictionary *)itemlist atPoint:(CGPoint)point
    {
        IGSeries *s = [chartView findSeriesAtPoint:point];
        IGOHLCPoint *dataPoint = (IGOHLCPoint*)[itemlist valueForKey:s.key];    

        //rest of implementation
    }

    The code will work equally well after zooming/panning.