/// <summary> /// 初始化曲线属性 /// </summary> //void InitWaveProperty() //{ // DateTime time = DateTime.Now; // colorsWave = new OxyColor[9] { OxyColors.Yellow, OxyColors.Green, OxyColors.Red, OxyColors.Black, // OxyColors.Yellow, OxyColors.Green, OxyColors.Red, OxyColors.Black,OxyColors.Red}; // InitSingleCurve(ref plotIAModel, plotIA, "A相电流", "kA", colorsWave[0]); // InitSingleCurve(ref plotIBModel, plotIB, "B相电流", "kA", colorsWave[1]); // InitSingleCurve(ref plotICModel, plotIC, "C相电流", "kA", colorsWave[2]); // InitSingleCurve(ref plotICModel, plotZC, "零序电流", "A", colorsWave[3]); // InitSingleCurve(ref plotUAModel, plotUA, "A相电压", "kV", colorsWave[4]); // InitSingleCurve(ref plotUBModel, plotUB, "B相电压", "kV", colorsWave[5]); // InitSingleCurve(ref plotUCModel, plotUC, "C相电压", "kV", colorsWave[6]); // InitSingleCurve(ref plotICModel, plotZV, "零序电压", "A", colorsWave[7]); // InitSingleCurve(ref plotSPModel, plotSP, "开关状态", "1/0", colorsWave[8]); // plotCollect[0] = plotIAModel; // plotCollect[1] = plotIBModel; // plotCollect[2] = plotICModel; // plotCollect[3] = plotZCModel; // plotCollect[4] = plotUAModel; // plotCollect[5] = plotUBModel; // plotCollect[6] = plotUCModel; // plotCollect[7] = plotZVModel; // plotCollect[8] = plotSPModel; // simuLationData(); //} /// <summary> /// 初始化单曲线显示 /// </summary> /// <param name="plot">显示模型</param> /// <param name="pv">显示视图</param> /// <param name="title">标题</param> /// <param name="strLabel">图例</param> /// <param name="colors">颜色</param> private void InitSingleCurve(ref PlotCurve plot, OxyPlot.Wpf.PlotView pv, string title, string strLabel, OxyColor colors) { try { plot = new PlotCurve(strLabel, colors, title); pv.Model = plot.GetModel(); } catch (Exception ex) { MessageBox.Show(ex.Message, "初始化显示plot" + title); } }
/// <summary> /// 初始化显示曲线 /// </summary> private void initWaveProperty() { for (int i = 0; i < configFile.RowChannelNumType.AnalogChannelCount; i++) { //plotView var plotView = new PlotView(); plotView.MinHeight = 300; plotView.Name = "Analog" + configFile.RowAnalogChannel[i].ChannelIndex; plotViewCollect.Add(plotView); //plotModel string strLabel = configFile.RowAnalogChannel[i].ChannelUnit; string title = configFile.RowAnalogChannel[i].ChannelID; var plot = new PlotCurve(strLabel, colorsWave[i], title); plotView.Model = plot.GetModel(); plotCollect.Add(plot); } for (int i = 0; i < configFile.RowChannelNumType.DigitalChannelCount; i++) { //plotView var plotView = new PlotView(); plotView.MinHeight = 300; plotView.Name = "Digital" + configFile.RowDigitalChannel[i].ChannelIndex; plotViewCollect.Add(plotView); //plotModel string strLabel = "1/0"; string title = configFile.RowDigitalChannel[i].ChannelID; var plot = new PlotCurve(strLabel, colorsWave[i], title); plotView.Model = plot.GetModel(); plotCollect.Add(plot); } }