private void FigureConfigMatrixScalar(int xc, int xr, string xName, string yName) { FigureProtocol.FigureConfig figureConfig = new FigureProtocol.FigureConfig() { FigureId = publisher.Id, Title = varName, RowsCount = xc, ColumnsCount = xr }; publisher.Send(FigureProtocol.FigureConfigLabel, figureConfig); for (int i = 0; i < xr; i++) { for (int j = 0; j < xc; j++) { string observationName = $"{xName}({i}-{j})"; FigureProtocol.PlotConfig plotConfig = new FigureProtocol.PlotConfig() { FigureId = publisher.Id, RowNO = i, ColumnNO = j, XLabel = observationName, YLabel = yName }; publisher.Send(FigureProtocol.PlotConfigLabel, plotConfig); FigureProtocol.Curve curve = new FigureProtocol.Curve() { FigureId = publisher.Id, CurveHandle = i * xc + j, RowNO = i, ColumnNO = j }; publisher.Send(FigureProtocol.CurveLabel, curve); } } }
private void FigureConfigDoubleScalar(string xName, string yName) { FigureProtocol.FigureConfig figureConfig = new FigureProtocol.FigureConfig() { FigureId = publisher.Id, Title = varName, RowsCount = 1, ColumnsCount = 1 }; publisher.Send(FigureProtocol.FigureConfigLabel, figureConfig); FigureProtocol.PlotConfig plotConfig = new FigureProtocol.PlotConfig() { FigureId = publisher.Id, RowNO = 0, ColumnNO = 0, XLabel = xName, YLabel = yName }; publisher.Send(FigureProtocol.PlotConfigLabel, plotConfig); FigureProtocol.Curve curve = new FigureProtocol.Curve() { FigureId = publisher.Id, CurveHandle = 0, RowNO = 0, ColumnNO = 0 }; publisher.Send(FigureProtocol.CurveLabel, curve); }
private void FigureConfigVVectorHVector(int xr, int yc, string xName, string yName) { FigureProtocol.FigureConfig figureConfig = new FigureProtocol.FigureConfig() { FigureId = publisher.Id, Title = varName, RowsCount = yc, ColumnsCount = xr }; publisher.Send(FigureProtocol.FigureConfigLabel, figureConfig); for (int i = 0; i < yc; i++) { string observationName = $"{yName}({i})"; } for (int i = 0; i < xr; i++) { string observationName = $"{xName}({i})"; for (int j = 0; j < yc; j++) { FigureProtocol.PlotConfig plotConfig = new FigureProtocol.PlotConfig() { FigureId = publisher.Id, RowNO = i, ColumnNO = j, XLabel = observationName, YLabel = yHandle.space[j].Name }; publisher.Send(FigureProtocol.PlotConfigLabel, plotConfig); FigureProtocol.Curve curve = new FigureProtocol.Curve() { FigureId = publisher.Id, CurveHandle = i * yc + j, RowNO = i, ColumnNO = j }; publisher.Send(FigureProtocol.CurveLabel, curve); } } }
protected override bool Receive(FigureProtocol.PlotConfig plotConfig) { if (Figures.ContainsKey(plotConfig.FigureId)) { switch (Figures[plotConfig.FigureId].AxesShape) { case AxesShapeType.Scalar: Execute($@" ax{plotConfig.FigureId}.set_xlabel('{plotConfig.XLabel}') ax{plotConfig.FigureId}.set_ylabel('{plotConfig.YLabel}') ax{plotConfig.FigureId}.grid() "); break; case AxesShapeType.Vector: int index = plotConfig.RowNO > plotConfig.ColumnNO ? plotConfig.RowNO : plotConfig.ColumnNO; Execute($@" ax = ax{plotConfig.FigureId}[{index}] ax.set_xlabel('{plotConfig.XLabel}') ax.set_ylabel('{plotConfig.YLabel}') ax.grid() "); break; case AxesShapeType.Matrix: Execute($@" ax = ax{plotConfig.FigureId}[{plotConfig.RowNO}, {plotConfig.ColumnNO}] ax.set_xlabel('{plotConfig.XLabel}') ax.set_ylabel('{plotConfig.YLabel}') ax.grid() "); break; } } return(true); }
protected virtual bool Receive(FigureProtocol.PlotConfig plotConfig) { return(false); }
public override void Check() { int rowNo = InPortList[0].RowNo; int colNo = InPortList[0].ColNo; FigureProtocol.FigureConfig figureConfig = new FigureProtocol.FigureConfig() { FigureId = publisher.Id, Title = varName, RowsCount = rowNo == 0 ? 1 : rowNo, ColumnsCount = colNo == 0 ? 1 : colNo }; publisher.Send(FigureProtocol.FigureConfigLabel, figureConfig); handle = Observation.CreateObservation(varName, rowNo, colNo); if (rowNo > 0 && colNo > 0) { for (int i = 0; i < rowNo; i++) { for (int j = 0; j < colNo; j++) { string observationName = $"{varName}({i}-{j})"; FigureProtocol.PlotConfig plotConfig = new FigureProtocol.PlotConfig() { FigureId = publisher.Id, RowNO = i, ColumnNO = j, XLabel = "time/s", YLabel = observationName }; publisher.Send(FigureProtocol.PlotConfigLabel, plotConfig); FigureProtocol.Curve curve = new FigureProtocol.Curve() { FigureId = publisher.Id, CurveHandle = i * colNo + j, RowNO = i, ColumnNO = j }; publisher.Send(FigureProtocol.CurveLabel, curve); } } } else { FigureProtocol.PlotConfig plotConfig = new FigureProtocol.PlotConfig() { FigureId = publisher.Id, RowNO = 0, ColumnNO = 0, XLabel = "time/s", YLabel = varName }; publisher.Send(FigureProtocol.PlotConfigLabel, plotConfig); FigureProtocol.Curve curve = new FigureProtocol.Curve() { FigureId = publisher.Id, CurveHandle = 0, RowNO = 0, ColumnNO = 0 }; publisher.Send(FigureProtocol.CurveLabel, curve); } FigureProtocol.ShowCommand showCommand = new FigureProtocol.ShowCommand() { FigureId = publisher.Id }; publisher.Send(FigureProtocol.ShowCommandLabel, showCommand); }