I have two graphs which have variable range of X and Y values.
The following graph-scaling was attained of using the scaleToFitPlots:(NSArray *)plots method.
But my intention is to get the scaling look like following and I can't find any suitable method in CorePlot framework to accomplish it. Some pointers on it would be very appreciated.
If you already know the ranges you want displayed, skip calling -scaleToFitPlots: and set the xRange and yRange directly.
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.
I am using ios-charts library to draw charts on a swift2 app. I am wondering if, for a given X value, I can change its Y associated value by a drag and drop gesture on the chart.
If this is not possible on this library, is it possible to do such a thing using another library?
technically you can. Every time you scroll/zoom the chart, it will trigger a redraw, so everything is redrawing, you can decide your own logic how you want the y axis value changed.
It has two parts:
In computeAxisValues in y axis renderer, the y axis labels(values) are determined. Then in renderAxisLabels, it is drawn using the calculated values.
So you can take a look at these functions and implement your logic. Note, it's your responsibility to make sure what you are doing is valid in your scenario, because if something weird happens, you may not get support on github, because it's not a bug, and sometimes not easy to answer.
I'm working with a CorePlot scatter plot, and I'm having trouble putting the finishing touches on the axis label styling. I'd like for the plot to overlap above the Y-axis labels, but the opposite is happening. I've scoured the documentation, but can't find any options to do this.
Here's the output:
I've tried manipulating the ZPosition of both the plot & axis labels, but that doesn't seem to be working:
[plot setZPosition:99];
[axisSet.yAxis.axisLabels each:^(CPTAxisLabel *label) {
[label.contentLayer setZPosition:-1];
}];
Note - Objective Sugar used for loop comprehension
Any ideas as to how to accomplish this?
The plot area has a property called topDownLayerOrder that allows you to rearrange the different graph elements in exactly this way.
I have searched for answers to this using various combinations of the following search terms, with no results to speak of: highcharts, highstock, area, centerpoint, zero, center.
I am simply wondering if, when configuring an area-chart, it is possible to change the point around which the plot's fill is centered. By default, charts fill from zero to the data-line, but there are situations where a user may wish to see how their plot varies around a non-zero base-line.
Is there a way to accomplish this in the highcharts/highstock API?
Thanks,
Justin
If I understand correctly, you are just talking about the y axis min:
http://api.highcharts.com/highcharts#yAxis.min
If that doesn't do what you are asking for, then perhaps threshold will:
http://api.highcharts.com/highcharts#plotOptions.area.threshold
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.