Hi all...
I want to use custom labels. I will implement my own labels. But i have to know point values of my data array. For example my line series data source;
categorySource = [[IGCategorySeriesDataSourceHelper alloc] init];
categorySource.values = dataArray;
categorySource.labels=labelArray;
After chart drawn i want to get CGPoint value of specific data array rows. For example i need the x coordinate of fifth element of my array. So i can put my custom label at that x coordinate under x axis.
Hi,
The chart view allows you to specify custom labels at render time by using -labelForAxis delegate method. The chart view doesn't exactly deal in CGPoints when it comes to labels. It's more like it tells you what the current label is for a given data point and gives you an option to change it to another string.
I'm attaching a sample that places a custom label at index 5.
thanks for reply, but my problem is not the texts of labels,
i want to use special border etc., you can look sample image.
i prepare my labels but i dont know where to put them,
like
-(UIView*)chartView:(IGChartView*)chartView viewForTooltipWithItemlist:(NSDictionary*)itemlist atPoint:(CGPoint)point
method, i need point coordinates of data points :) So i can place my own graphic content for labels.
For example second data points X coordinate ?
Thank you very much, that's the answer I was looking for.
[xAxis convertToScreen:] solves all my problems..
The chart doesn't support this behavior. The only way to do this would be to manage your own set of UILabels and use them instead of the chart's internal labels. Keep in mind that every time the chart zooms or pans, you will have to remove and re-add your labels.
To get the X coordinate you can use [xAxis convertToScreen:] method. You pass in the index of your data point and get the screen position in pixels.Similar, for the Y coordinate you can use [yAxis convertToScreen:] and pass in yAxis.visibleMinimumValue. This should give you the bottom of the y axis in screen pixels.
Hopefully that helps you.