Пример #1
0
        protected virtual void SetXArray(vtkDoubleArray array, VtkPlotPointsModel plot)
        {
            VtkChartXyModel model = this.Model as VtkChartXyModel;

            if (model == null)
            {
                return;
            }

            vtkTable table = plot.Table;

            if (table.GetNumberOfColumns() <= 1)
            {
                table.Initialize();
                table.AddColumn(array);
            }
            else
            {
                vtkDoubleArray arrY = table.GetColumn(1) as vtkDoubleArray;
                if (arrY == null)
                {
                    this.Log.Error("SetXArray(): Could not cast table data to vtkDoubleArray");
                    return;
                }

                table.Initialize();
                table.AddColumn(array);
                table.AddColumn(arrY);

                vtkPlotPoints vtkPlot = plot.PlotItem as vtkPlotPoints;
                if (vtkPlot == null)
                {
                    this.Log.Error("SetXArray(): Could not cast plot item to vtkPlotPoints");
                    return;
                }

                vtkPlot.SetInputData(table, 0, 1);
            }
        }
Пример #2
0
        protected virtual void SetYArray(vtkDoubleArray array, VtkPlotPointsModel plot)
        {
            VtkChartXyModel model = this.Model as VtkChartXyModel;

            if (model == null)
            {
                return;
            }

            vtkTable table = plot.Table;

            if (table.GetNumberOfColumns() == 0)
            {
                this.Log.Error("SetYArray(): No XArray data");
                return;
            }

            if (table.GetNumberOfColumns() == 1)
            {
                table.AddColumn(array);
            }
            else
            {
                table.RemoveColumn(1);
                table.AddColumn(array);
            }

            vtkPlotPoints vtkPlot = plot.PlotItem as vtkPlotPoints;

            if (vtkPlot == null)
            {
                this.Log.Error("SetYArray(): Could not cast plot item to vtkPlotPoints");
                return;
            }

            vtkPlot.SetInputData(table, 0, 1);
        }