예제 #1
0
        /// <summary>
        /// Sets plot corner.
        /// The bottom left corner, 0, uses the left and bottom axes.
        /// The bottom right corner, 1, uses the right and bottom axes.
        /// The top right corner, 2, uses the right and top axes.
        /// The top left corner, 3, uses the left and top axes.
        /// </summary>
        /// <param name="plotModel"> The plot model. </param>
        /// <param name="corner"> The corner, accepts 0 through 3. </param>
        public virtual void SetPlotCorner(VtkPlotPointsModel plotModel, int corner)
        {
            vtkPlotPoints plot  = plotModel.PlotItem as vtkPlotPoints;
            vtkChartXY    chart = this._chartItem as vtkChartXY;

            if (plot == null || chart == null)
            {
                return;
            }

            chart.SetPlotCorner(plot, corner);

            this.Render();
        }
예제 #2
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);
            }
        }
예제 #3
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);
        }
예제 #4
0
 protected virtual void Create()
 {
     _plotItem = new vtkPlotPoints();
 }