Am new to coreplot framework, rite now am working in barchart model and got some idea bt now i want to do double sided barChart (i need y axis both left and right corner)
OtherWise i need to move this following range value for y coordinate when i move over the different x position on the graph....
plotSpace.globalYRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromInteger(0) length:CPDecimalFromInteger(100)];
plotSpace.yRange =plotSpace.globalYRange;
Thanks in advance
You can add as many axes as you need. If you want both y-axes to have the same scale, you can use a single plot space. See the Mac version of CPTestApp for an example of adding a third axis to the graph.
Related
Now vaadin set X axis on min vertical value(bottom) and Y axis on min horizontal value (left), but i will like set axes on middle
I'm afraid that axis are always in left and bottom of the plot area.
One thing you can do is set the min at negative, or leave it automatic, and add a plotline with value 0 for both axes. That way you can visualize the chart's quadrants.
If you're using java API you can use addPlotLine method in xAxis or yAxis classes. You can check the java tab in the boxplot demo
I am creating scatter graph, I need to change the x and y positions in scatter graph. Graph always starts with (0,0) positions but i need to show the starting points (7000, 800). Is there any way to change the x and y positions in scatter graph in core plot.
After showing the graph need to draw the line manually and get those values to search the properties.
Please help me.
Thanks in advance.
to set the point where the co-ordinates meet you have to set the orthogonal co-ordinate decimal
x.orthogonalCoordinateDecimal = CPTDecimalFromString(#"800");
y.orthogonalCoordinateDecimal = CPTDecimalFromString(#"740000");
and for setting the range of values to be plotted set the visibleRange for both the axes
These are features of the "plot space" in Core Plot. It defines the coordinate mapping between the plot area (basically the rectangle that contains all plot drawing) in data coordinates and the view in drawing coordinates. The xRange and yRange control the x and y range of the plot space, respectively.
The plot space converts coordinates in both directions—from data to view when drawing and from view to data when (for example) responding to touch events on a plot. See the plot space docs for a list of the available coordinate conversion methods.
https://github.com/djw/core-plot/tree/9282845bddbb8c40ff314bbfa158beff797c91f7/examples
This states that the isFloatingAxis property has been removed from at least version 0.9.
Does anyone know how to float the x axis without this property? In other words, if I want the origin of the graph to be (0,6000) lets say, how can I maintain the x axis inside the plot range, while the y axis is NOT set to:
y.orthogonalCoordinateDecimal = CPTDecimalFromInt(0);
I was able to figure this out by looking in the CPTTestApp example from the CorePlot_0.9 folder. I looked in the class files and found this in Controller.m:
x.axisConstraints = [CPTConstraints constraintWithUpperOffset:132];
For now, this is holding my x axis in the same spot so I can change the orthogonalCoordinateDecimal to 6000 or whatever without the x axis and labels disappearing.
This code should help you. It sets the x-axis to range from 0-6000, and makes visible only that part on plot:
axisSet.xAxis.visibleRange =[CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(0) length:CPTDecimalFromInt(6000)];
axisSet.xAxis.gridLinesRange = axisSet.xAxis.visibleRange;
I am implementing core plot framework for graph plot, but I am not able to understand following issues :
How to change the scaling point on XY axis. For example right now by deafault it is showing points on x axis is 1,2,3,4,5....etc and on y axis 1,2,3,4,5,....etc and I want on y axis 100,200,300,400,...etc.
How to set the coordinate of whole graph, means as I run my app the graph is totally downside and not visible and to see the graph I have to drag it upside.
Please help me out ASAP.
Thanks in advance.
You control the visible data using the xRange and yRange of the plot space. See this question for an example.
There are several options for setting up the labels, controlled by the labelingPolicy property. One of the pages in the Plot Gallery example app shows samples of all of the labeling policies. Which one you choose depends on how much you know about the range of data that will be displayed and whether the user can scroll and/or zoom the graph.
1) y_axis.majorIntervalLength = CPTDecimalFromString(100); // for 100 ,200 .....
2)
plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.allowsUserInteraction = YES;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-0.99) length:CPTDecimalFromFloat(7.5)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-4.9) length:CPTDecimalFromFloat(45)];
// you can visible directly graph... or you can set start location as 1st parameter and length as 2nd parameter
I'm working with core plot on iPhone now, and I'm trying to set up the ScatterPlot graph in such a way that [0,0] coordinates are always at the same place (that is 40 pixels from the left and 40 pixels from the bottom)
I just wasted 4 hours trying to get this to work, and still have no idea, help!
Bonus question - how to set up axises to make only the >0 parts visible?
graph.plotAreaFrame.paddingBottom = 40.0;
graph.plotAreaFrame.paddingLeft = 40.0;
Bonus:
Setting the padding will move the axes and plot area so your origin is offset from the left and bottom by 40px.