Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight a single plot symbol on a line - Core Plot

I'm making an iPhone app that uses Core Plot at one point in the application. I'm drawing a graph using a CPTScatterPlot and along the line I have CPTPlotSymbol plot symbols.

the graph is looking really good after some customizing but what I want to do is give the user a bit better visual representation of where exactly on the graph the current material is referring to.

I would like to "highlight" individual plot symbols along my line. I have the location on the xAxis of the point I want to manipulate. I have not been able to find any example of this or even a suggestion that it's possible, it seems to be possible for pie charts and bar plots though.

If it is not possible to change or manipulate the actual plot symbol at a point I'm quite happy to simply draw something over the symbol. If so, is there a way to get the x,y coordinates (in relation to the screen) of each plot symbol? Or will I have to calculate that from my data? My data varies a_lot so I'm simply auto resizing the plot area at the moment.

thanks!

like image 352
dantastic Avatar asked Aug 06 '26 19:08

dantastic


1 Answers

You can implement the -symbolForScatterPlot:recordIndex: datasource method to customize the plot symbol at each point. Return nil if you don't want a symbol drawn at the given index. The Mac version of CPTTestApp (in the Core Plot examples folder) has a plot symbol demo that shows how to use this method.

like image 158
Eric Skroch Avatar answered Aug 09 '26 13:08

Eric Skroch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!