void SetupBarPlots() { // Create a plot that uses the data source method var inputSocket = new List<float> { 30, 20, 10, 20, 10, 55 }; var barPlot = new CPTBarPlot { DataSource = new BarSourceData (inputSocket), BaseValue = 0, BarOffset = (NSDecimal)(-0.25), Identifier = (NSString) "Bar Plot 1" }; graph.AddPlot (barPlot); barPlot.Fill = new CPTFill (CPTColor.BrownColor); graph.AddPlot (barPlot, graph.DefaultPlotSpace); var space = graph.DefaultPlotSpace as CPTXYPlotSpace; space.ScaleToFitPlots (new CPTPlot [] { barPlot}); decimal newYMax = (decimal)space.YRange.MaxLimit + (decimal)space.YRange.MaxLimit * 0.2m; space.YRange = new CPTPlotRange (-4, new NSDecimalNumber (newYMax.ToString ()).NSDecimalValue); decimal newXMax = (decimal)space.XRange.MaxLimit + 2; decimal newXMin = (decimal)space.XRange.MinLimit - 1; space.XRange = new CPTPlotRange (new NSDecimalNumber (newXMin.ToString ()).NSDecimalValue, new NSDecimalNumber (newXMax.ToString ()).NSDecimalValue); }
void SetupBarPlots() { // Create a plot that uses the data source method var inputSocket = new List <float> { 30, 20, 10, 20, 10, 55 }; var barPlot = new CPTBarPlot { DataSource = new BarSourceData(inputSocket), BaseValue = 0, BarOffset = (NSDecimal)(-0.25), Identifier = (NSString)"Bar Plot 1" }; graph.AddPlot(barPlot); barPlot.Fill = new CPTFill(CPTColor.BrownColor); graph.AddPlot(barPlot, graph.DefaultPlotSpace); var space = graph.DefaultPlotSpace as CPTXYPlotSpace; space.ScaleToFitPlots(new CPTPlot [] { barPlot }); decimal newYMax = (decimal)space.YRange.MaxLimit + (decimal)space.YRange.MaxLimit * 0.2m; space.YRange = new CPTPlotRange(-4, new NSDecimalNumber(newYMax.ToString()).NSDecimalValue); decimal newXMax = (decimal)space.XRange.MaxLimit + 2; decimal newXMin = (decimal)space.XRange.MinLimit - 1; space.XRange = new CPTPlotRange(new NSDecimalNumber(newXMin.ToString()).NSDecimalValue, new NSDecimalNumber(newXMax.ToString()).NSDecimalValue); }
public override CPTFill GetBarFill(CPTBarPlot barPlot, int recordIndex) { if (Math.Abs(data [recordIndex].Y - minVal) < float.Epsilon) { return(new CPTFill(CPTColor.RedColor)); } if (Math.Abs(data [recordIndex].Y - maxVal) < float.Epsilon) { return(new CPTFill(CPTColor.GreenColor)); } return(null); }
public override CPTFill GetBarFill(CPTBarPlot barPlot, int recordIndex) { if (data[recordIndex].Y == minVal) { return(new CPTFill(CPTColor.RedColor)); } else if (data[recordIndex].Y == maxVal) { return(new CPTFill(CPTColor.GreenColor)); } return(null); }
public override CPTFill GetBarFill(CPTBarPlot barPlot, uint recordIndex) { if (Math.Abs (data [(int)recordIndex].Y - minVal) < float.Epsilon) return new CPTFill (CPTColor.RedColor); if (Math.Abs (data [(int)recordIndex].Y - maxVal) < float.Epsilon) return new CPTFill (CPTColor.GreenColor); return null; }
public override void BarSelected(CPTBarPlot plot, int recordIndex) { Console.WriteLine("Selected at {0}", recordIndex); }
public override void BarSelected (CPTBarPlot plot, int recordIndex) { Console.WriteLine ("Selected at {0}", recordIndex); }
public override CPTFill GetBarFill(CPTBarPlot barPlot, int recordIndex) { if (data[recordIndex].Y == minVal ) return new CPTFill (CPTColor.RedColor); else if (data[recordIndex].Y == maxVal ) return new CPTFill (CPTColor.GreenColor); return null; }