How to plot nagative values on graph in core plot?
I am able to draw lines with positive decimal values but in case of negative values my graph shows nothing neither on axis nor on graph.
开发者_JAVA百科How do I do it?
You should simply need to set the plot ranges to encompass the negative values you wish to display. For example:
CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)lineChart.defaultPlotSpace;
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-10.0f) length:CPDecimalFromFloat(20.0f)];
plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-10.0f) length:CPDecimalFromFloat(20.0f)];
will show values from -10 to 10 in X and Y.
精彩评论