how to create static line in coreplot
Posted
by
Rémi Bédard-Couture
on Stack Overflow
See other posts from Stack Overflow
or by Rémi Bédard-Couture
Published on 2012-04-02T20:00:06Z
Indexed on
2012/04/02
23:30 UTC
Read the original article
Hit count: 226
I am trying to make my control lines static so instead of being displayed as part of the graph(the control lines are moving with the graph), they would be displayed like an axis
the app can only scroll horizontally
i'm talking about the two red line and the green line(which i put over the x axis)
this is how i do my lines:
// Center line
CPTScatterPlot *centerLinePlot = [[CPTScatterPlot alloc] init];
centerLinePlot.identifier = kCenterLine;
CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle];
lineStyle.lineWidth = 2.0;
lineStyle.lineColor = [CPTColor greenColor];
centerLinePlot.dataLineStyle = lineStyle;
centerLinePlot.dataSource = self;
[graph addPlot:centerLinePlot];
but maybe it has something to do with the displayed range:
////////ajuste la portion a voir
if(data.Resultats.count>10)
{
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(data.Resultats.count - 10) length:CPTDecimalFromDouble(10)];
}
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(RangeMin) length:CPTDecimalFromDouble(RangeMax-RangeMin)];
// Adjust visible ranges so plot symbols along the edges are not clipped
CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy];
CPTMutablePlotRange *yRange = [plotSpace.yRange mutableCopy];
//place l'axe x sur la ligne de controle pour voir les WorkOrders
x.orthogonalCoordinateDecimal = CPTDecimalFromDouble(center);
//x.orthogonalCoordinateDecimal = yRange.location;
//y.orthogonalCoordinateDecimal = xRange.location;
//x.visibleRange = xRange;
//y.visibleRange = yRange;
//x.gridLinesRange = yRange;
//y.gridLinesRange = xRange;
[xRange expandRangeByFactor:CPTDecimalFromDouble(1.15)];//1.05
[yRange expandRangeByFactor:CPTDecimalFromDouble(1.15)];
plotSpace.xRange = xRange;
plotSpace.yRange = yRange;
© Stack Overflow or respective owner