5 Answers, 1 is accepted
0
Hi,
Thank you for writing.
You can get the location of data point in the chart by using locationOfPoint:inSeries method of TKChartSeriesRender. Consider the code below:
I am not sure if I understand correctly the second part of the question. Could you please explain if you need the tap point coordinates on the chart's plot area or you need the data point that is on that location?
I am looking forward to your reply.
Regards,
Adrian
Telerik
Thank you for writing.
You can get the location of data point in the chart by using locationOfPoint:inSeries method of TKChartSeriesRender. Consider the code below:
TKChartSeriesRender *render = [[TKChartSeriesRender alloc] init];
CGPoint point = [render locationOfPoint:dataPoint inSeries:series];
I am not sure if I understand correctly the second part of the question. Could you please explain if you need the tap point coordinates on the chart's plot area or you need the data point that is on that location?
I am looking forward to your reply.
Regards,
Adrian
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Stephen
Top achievements
Rank 1
answered on 05 Apr 2016, 02:37 PM
I've not been able to get this to work. The point returned is always at location 0:0. Could you post the swift version of this code? Perhaps I'm translating incorrectly.
Thank you,
-Stephen
0
Hi, Stephen,
You are correct. It returns point at location 0:0 because the render's bounds are zero rectangle. To fix this you should set its bounds property:
Regards,
Adrian
Telerik
You are correct. It returns point at location 0:0 because the render's bounds are zero rectangle. To fix this you should set its bounds property:
let render = TKChartSeriesRender(chart: chart)
render.bounds = chart.plotView.bounds
let point = render.locationOfPoint(dataPoints[0], inSeries: series)
Regards,
Adrian
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Stephen
Top achievements
Rank 1
answered on 08 Apr 2016, 02:25 PM
Thanks Adrian. This works much better!
However one of the instances where I'll use this functionality is to draw a custom marker on a specific point when the chart first appears. I've found this solution will still return 0,0 unless I add a delay. Perhaps because the renderer hasn't completed its work yet.... Is there a way to tell when the chart is finished drawing?
Thanks,
-Steve
0
Hello, Stephen,
TKChart does not notify when it is rendered on the screen, however you can use UIViewController's viewDidAppear method where the chart will be on screen. You can also take a look at annotations in TKChart in our documentation. Maybe using annotations would be easier to achieve your scenario.
I hope this helps.
Regards,
Adrian
Telerik
TKChart does not notify when it is rendered on the screen, however you can use UIViewController's viewDidAppear method where the chart will be on screen. You can also take a look at annotations in TKChart in our documentation. Maybe using annotations would be easier to achieve your scenario.
I hope this helps.
Regards,
Adrian
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items