query when reloading data in core plot - core-plot

As part of my app, the user can select a different location which has different data to be graphed. The initial location's data plots fine through ViewDidLoad, when the location is changed, under viewDidAppear, [graph reloadData] is called which works fine for the plots but the X & Y axis's are all wrong due to different values. is there an easy way to redraw the axis's? otherwise i might have to much around with separate methods for parts of the graph creation?

Update the xRange and/or yRange of the plot space at the same time you call -reloadData to update the plots. You can also update any of the labeling properties if needed.

Related

iOS Core Plot Get visible labels X axis

I am using Core Plot and I am really still new to it. I have searched but could not find the answer. I have allowsUserInteraction enabled. I have implemented zoom in/out with that. I want to be able to get first and last visible label on X axis every time when user has zoomed in/out. I know that there is willChangePlotRangeTo I have called there expandRangeByFactor method on my CPTMutablePlotRange. I want to be able to get every time text from first and last visible label on X axis. Is there any delegate method that I have missed?
Whenever you need to find out what the current axis labels are, call -layoutIfNeeded on the axis to make sure the labels are up-to-date and get the set of labels from the axisLabels property. Since it's a set, the collection is unordered. You'll have to search the whole set to find the first and last ones. Each label has a tickLocation that is the location along the axis and a contentLayer that is the label displayed at the location. The automatic axis labels are always CPTTextLayer objects, so you can extract the text property from there.

Highcharts :: Need to split y-axis from primary body of chart. Can I display this axis separately from the Highchart?

I have a situation where I need to remove all margins from a highchart and remove the x/y axis so it fills a series of columns in a table completely.
I did that, no problem. Chart goes to the extremes as needed.
What I need now is that pesky yaxis I already removed...but displayed in a table cell outside of the existing highcharts object.
It would seem easy, as though I could just set the overflow property of yaxis to 'visible' and play with the offset...which would work however this would only work if I wanted to re-position the axis within the boundaries of the highchart object. I want him in a different cell entirely.
Is there anyone who has had experience in this situation? Is it going to require me to have a secondary highchart with only a y-axis?
Best answer gets a green check.
EDIT :: I now have dispersed each 'day' into their own column (more bars coming per day [scheduled,actual,etc...]). In order to keep the scales lined up, I manipulate the yAxis:max property and set them all to a derived value.
In the open column (currently w/ text Hourly Trends) is where I would put an additional highchart module with no series data but with the same min/max/tickInterval.
The next big leap will be to see the data is alive and changes w/ schedule. May have to start another thread for that one, no?
Create a new HC object with no data but only the yAxis (making sure it is the right scale, etc). Perhaps add the same series of data to it but hide the series? Add it to the location you want. This seems kludge and not very good practice. Each business use is different but why would you want this?
EDIT based on comment of business rules:
Why not come at this from a different direction and have the individual chart elements (the bars/points/etc) be a single point chart. This way you have one chart per column. You can then set up the yAxis to be text and not worry about the position. If we could see an example of the page layout and the desired result that would help.

iOS Coreplot realtime data

I need to dinamically update a scatterplot graph with realtime data. The data are speed (Y axis) depending on time (X axis).
As soon as I have new speed data, I add data to the datasource array then call [graph reloadData] to update the graph. And this is good, but how to automatically make the graph scrolling on x axis in order that the new data is always on screen?
Thanks.
Solution found: need to update this property ((CPTXYPlotSpace *)graph.defaultPlotSpace).xRange

How to Set Plot Position in Core Plot

I need to draw multiple plots. How can I set the position of each plot in codes instead of setting one by one in storyboard?
The image I want to achieve is here. In this image, each small curve is a plot. So there are in total 20 x 15 small plots. I need to position and feed different data for each of them. But I don't want to set their positions one by one coz it's tedious.
Do you need to allow user interaction or frequently update the plots? If not, your best bet is to use one graph with a single plot. Render it into small images, once for each plot, changing the data each time. Draw the images into a view laid out in your grid.
If you can't use the image approach, you'll probably run out of memory long before setting up 300 individual graphs. Instead, use one graph with a single plot space if possible. Offset and scale the data values for each plot so they appear in the appropriate section. Use as few plots as you can (one for each line style). Separate the line segments with empty (NAN or nil) data values.

How to display live core plot graph in iPad? [duplicate]

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.

Resources