views:

33

answers:

1

How to plot negative 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. Please suggest any examples or any sample code would work.

TIA

+1  A: 

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.

Brad Larson