private void AddTrace(GraphPane pane, PlottableDataEnum dataName) { double dataFreq; // 0 = 100hz; 1 = 50hz; 2 = 20hz; 3 = 10hz; -1 = disable switch (GetDataRate()) { case 0: dataFreq = 1d / 100d; break; case 1: dataFreq = 1d / 50d; break; case 2: dataFreq = 1d / 20d; break; case 3: dataFreq = 1d / 10d; break; default: throw new ArgumentOutOfRangeException("DataRate = " + GetDataRate()); } var pts = new PointPairList(); var yPts = GetData(dataName); for (var i = 0; i < yPts.Count(); i++) { pts.Add(i * dataFreq, yPts[i]); } var title = GetDataName(dataName); var clr = GetDataColour(dataName); var symbol = GetDataSymbol(dataName); var curve = pane.AddCurve(title, pts, clr, symbol); // Fill the symbols with white curve.Symbol.Fill = new Fill(Color.White); var yaxis = new YAxis(title); yaxis.Scale.IsUseTenPower = false; yaxis.Scale.MagAuto = false; yaxis.Color = clr; yaxis.MajorGrid.IsZeroLine = false; yaxis.MajorTic.IsOpposite = yaxis.MinorTic.IsOpposite = false; yaxis.Scale.FontSpec.FontColor = yaxis.Title.FontSpec.FontColor = clr; yaxis.Scale.FontSpec.Size = yaxis.Title.FontSpec.Size = 8f; pane.YAxisList.Add(yaxis); AssignYAxes(pane); }
private SymbolType GetDataSymbol(PlottableDataEnum dataName) { switch (dataName) { case PlottableDataEnum.RPM: return(SymbolType.Circle); case PlottableDataEnum.EngineTemperature: return(SymbolType.Diamond); case PlottableDataEnum.WaterTemperature: return(SymbolType.HDash); case PlottableDataEnum.Gear: return(SymbolType.Plus); case PlottableDataEnum.Fuel: return(SymbolType.Square); case PlottableDataEnum.Speedometer: return(SymbolType.Star); case PlottableDataEnum.Yaw: return(SymbolType.Triangle); case PlottableDataEnum.Pitch: return(SymbolType.TriangleDown); case PlottableDataEnum.Roll: return(SymbolType.VDash); case PlottableDataEnum.YawVelocity: return(SymbolType.XCross); case PlottableDataEnum.PitchVelocity: return(SymbolType.Circle); case PlottableDataEnum.SuspNormLengthFront: return(SymbolType.Diamond); case PlottableDataEnum.SuspNormLengthRear: return(SymbolType.HDash); case PlottableDataEnum.Steer: return(SymbolType.Plus); case PlottableDataEnum.Throttle: return(SymbolType.Square); case PlottableDataEnum.FrontBrake: return(SymbolType.Star); case PlottableDataEnum.RearBrake: return(SymbolType.Triangle); case PlottableDataEnum.Clutch: return(SymbolType.TriangleDown); case PlottableDataEnum.WheelSpeedFront: return(SymbolType.VDash); case PlottableDataEnum.WheelSpeedRear: return(SymbolType.XCross); } throw new ArgumentOutOfRangeException("Unknown data: " + dataName); }
private string GetDataName(PlottableDataEnum dataName) { switch (dataName) { case PlottableDataEnum.RPM: return("RPM"); case PlottableDataEnum.EngineTemperature: return("Engine Temp"); case PlottableDataEnum.WaterTemperature: return("Water Temp"); case PlottableDataEnum.Gear: return("Gear"); case PlottableDataEnum.Fuel: return("Fuel"); case PlottableDataEnum.Speedometer: return("Speed"); case PlottableDataEnum.Yaw: return("Yaw"); case PlottableDataEnum.Pitch: return("Pitch"); case PlottableDataEnum.Roll: return("Roll"); case PlottableDataEnum.YawVelocity: return("Yaw Vel"); case PlottableDataEnum.PitchVelocity: return("Pitch Vel"); case PlottableDataEnum.SuspNormLengthFront: return("Susp Length (F)"); case PlottableDataEnum.SuspNormLengthRear: return("Susp Length (R)"); case PlottableDataEnum.Steer: return("Steer"); case PlottableDataEnum.Throttle: return("Throttle"); case PlottableDataEnum.FrontBrake: return("Brake (F)"); case PlottableDataEnum.RearBrake: return("Brake (R)"); case PlottableDataEnum.Clutch: return("Clutch"); case PlottableDataEnum.WheelSpeedFront: return("Wheel Speed (F)"); case PlottableDataEnum.WheelSpeedRear: return("Wheel Speed (R)"); } throw new ArgumentOutOfRangeException("Unknown data: " + dataName); }
private Color GetDataColour(PlottableDataEnum dataName) { switch (dataName) { case PlottableDataEnum.RPM: return(Color.Indigo); case PlottableDataEnum.EngineTemperature: return(Color.Green); case PlottableDataEnum.WaterTemperature: return(Color.Blue); case PlottableDataEnum.Gear: return(Color.LawnGreen); case PlottableDataEnum.Fuel: return(Color.Magenta); case PlottableDataEnum.Speedometer: return(Color.MediumPurple); case PlottableDataEnum.Yaw: return(Color.MediumSeaGreen); case PlottableDataEnum.Pitch: return(Color.MediumSpringGreen); case PlottableDataEnum.Roll: return(Color.MediumTurquoise); case PlottableDataEnum.YawVelocity: return(Color.Orange); case PlottableDataEnum.PitchVelocity: return(Color.Orchid); case PlottableDataEnum.SuspNormLengthFront: return(Color.SaddleBrown); case PlottableDataEnum.SuspNormLengthRear: return(Color.SandyBrown); case PlottableDataEnum.Steer: return(Color.SkyBlue); case PlottableDataEnum.Throttle: return(Color.Red); case PlottableDataEnum.FrontBrake: return(Color.Lime); case PlottableDataEnum.RearBrake: return(Color.DarkTurquoise); case PlottableDataEnum.Clutch: return(Color.DarkSeaGreen); case PlottableDataEnum.WheelSpeedFront: return(Color.BurlyWood); case PlottableDataEnum.WheelSpeedRear: return(Color.DeepSkyBlue); } throw new ArgumentOutOfRangeException("Unknown data: " + dataName); }
private List <double> GetData(PlottableDataEnum dataName) { switch (dataName) { case PlottableDataEnum.RPM: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.RPM).ToList()); case PlottableDataEnum.EngineTemperature: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.EngineTemperature).ToList()); case PlottableDataEnum.WaterTemperature: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.WaterTemperature).ToList()); case PlottableDataEnum.Gear: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select(double) bd.Gear).ToList()); case PlottableDataEnum.Fuel: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.Fuel).ToList()); case PlottableDataEnum.Speedometer: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.Speedometer * 3.6).ToList()); case PlottableDataEnum.Yaw: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.Yaw).ToList()); case PlottableDataEnum.Pitch: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.Pitch).ToList()); case PlottableDataEnum.Roll: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.Roll).ToList()); case PlottableDataEnum.YawVelocity: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.YawVelocity).ToList()); case PlottableDataEnum.PitchVelocity: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.PitchVelocity).ToList()); case PlottableDataEnum.SuspNormLengthFront: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.SuspNormLengthFront).ToList()); case PlottableDataEnum.SuspNormLengthRear: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.SuspNormLengthRear).ToList()); case PlottableDataEnum.Steer: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.Steer).ToList()); case PlottableDataEnum.Throttle: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.Throttle).ToList()); case PlottableDataEnum.FrontBrake: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.FrontBrake).ToList()); case PlottableDataEnum.RearBrake: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.RearBrake).ToList()); case PlottableDataEnum.Clutch: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.Clutch).ToList()); case PlottableDataEnum.WheelSpeedFront: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.WheelSpeedFront).ToList()); case PlottableDataEnum.WheelSpeedRear: return((from bd in Logger.BikeDatas.OrderBy(bd => bd.ID) select bd.WheelSpeedRear).ToList()); } throw new ArgumentOutOfRangeException("Unknown data: " + dataName); }