How to do that when you click on the graph, on the point (shows the value at that point)?
And how it make if i have 4 graph on one view.
Any examples?
Thanks for Help!
Look at the example apps included with Core Plot. The Plot Gallery has an example of adding a label when the user clicks a plot. The Mac version of CPTTestApp shows another technique of drawing a crosshairs over the selected point on a scatter plot.
Each plot has its own delegate that will be notified of the click. The delegate methods all have the sending plot as one of the parameters so you can use the same delegate object to handle more than one plot.
Related
I need to show a graph in my iOS app something like
We have been using CorePlot for all the graphs and now I need to add a new kind as shown above. I found I could draw a graph like the above with CPTRangePlot. My problem is I can only draw a horizontal graph as shown below.
Is there any way to make it vertical? For a single curve we can easily do that by switching the value on X-axis and Y-axis. But for this kind of "range plot", I could not find a way to make it work for drawing the upper-bound and lower-bound lines and filling range with color can only be achieved on a normal horizontal graph. And yes, I can easily rotate the container view by 90 degrees, as I did in my testbed app. But I just cannot do this in our current app because this new added "range plot" graph is not the only one on the view. We have many other curves sharing the same plot space. So is there any hidden property or method to achieve the job? Thanks in advance!
I just added a fillDirection property to the range plot to enable this feature. You'll need to use the latest code from the release-2.3 branch.
enter image description hereFor Example In high charts take bar chart.In Bar chart if i clicked on one data point the other data points should disable.Please find the image
You can call Point.select() function on point from another chart in select event. If you want to get rid of that point, use Point.remove() function instead.
API Reference:
http://api.highcharts.com/highcharts/Point.select
http://api.highcharts.com/highcharts/Point.remove
http://api.highcharts.com/highcharts/plotOptions.column.point.events.select
Example:
http://jsfiddle.net/ha7jxztv/
Using Core Plot's CPTScatterPlot, I've made a bubble chart that looks like the above.
I've implemented plotSymbolWasSelectedAtRecordIndex in my delegate so I can detect when the user touches one of the bubbles. Using this screenshot as an example, I want to be able to highlight the yellow bubble and bring it in front of the red one when the user touches it. In graphical terms, I want to set the Z order of the selected CPTPlotSymbol to be higher than the others. How can I accomplish that? I'm able to highlight the selected bubble by drawing it in a different color in my symbolForScatterPlot method, but I can't seem to find a way to make it draw in front of the overlapping symbol.
Core Plot draws the data points in the order they appear in the datasource. You'll need to reorder the data so the top-most bubble is at the last index and call -reloadData on the plot to tell it to refresh its data. If you have the data points in an array, sort it by the desired z-index (back to front) and use the sorted array to feed the datasource.
I want to use core-plot for drawing line graph dynamically. data won't come at a time, we will be receiving point by point dynamically.
Is it possible to draw the chart dynamically using core-plot i.e drawing point by point as on when we receive the (x,y) point?
Please help me, Thanks.
Yes, you can do this reasonably easily. For each received data point, append it to an array of values to display. As these data points come in, call -reloadData on the Core Plot graph (or just the particular plot) to redraw the graph, passing in the array you just added a value to in response to the -numbersForPlot:field:recordIndexRange: delegate method.
If you need to adjust the plot range to track your data points (for a moving ticker), recalculate the new CPPlotRange for the X axis and set the plot space's xRange property to that.
Use the CPTestApp-iPhone, AAPLot, or StockPlot examples as templates for how to set up the line chart overall, and modify from that starting point.
I do something similar to this on the Mac in a scientific application:
(source: sunsetlakesoftware.com)
Sounds like you could make use of a demo project I put together and wrote about here (not core plot related though).
It draws a EKG graph but should easily be modified to use another input than the repeated "heart beat"...See line 320 in EAGLView.m where the indata is entered into the array.
I had drawn a pie chart using core-plot. I need to display the item name when a particular slice is touched. can anyone suggest me a solution to achieve this?
You can handle individual slice events by implementing CPPieChartDelegate methods. Declare CPPieChartDelegate protocol and implement the method (void)pieChart:sliceWasSelectedAtRecordIndex: . Set the delegate of piechart to self(controller). This method gives you which slice(index) is selected. And now for drawing the label, you have to re-draw the pie chart, specifying which slice to be labeled. You can set empty string to labels for other slices.
The iPhone version of CPTTestApp (in the Core Plot examples folder) shows how to display the selected slice index. It displays the index in the graph title, but you just as easily display it in a Core Plot annotation or in a separate UI control.