声明OxyPlot图形对象的实例变量

时间:2013-12-06 16:47:45

标签: c# visual-studio oxyplot

我正在使用OxyPlot,一个用于C#的图形库。到目前为止让我困惑的是一些构造函数的type。代码段如下:

public static PlotModel Notinterpolatedvalues() {
            var plotModel1 = new PlotModel();
            plotModel1.Subtitle = "Input text here";

            var linearColorAxis1 = new LinearColorAxis();
            linearColorAxis1.HighColor = OxyColors.Gray;
            linearColorAxis1.LowColor = OxyColors.Black;
            linearColorAxis1.Position = AxisPosition.Right;
            plotModel1.Axes.Add(linearColorAxis1);

            var linearAxis1 = new LinearAxis();
            linearAxis1.Position = AxisPosition.Bottom;
            plotModel1.Axes.Add(linearAxis1);

            var linearAxis2 = new LinearAxis();
            plotModel1.Axes.Add(linearAxis2);

            var heatMapSeries1 = new HeatMapSeries();
            heatMapSeries1.X0 = 0.5;
            heatMapSeries1.X1 = 1.5;
            heatMapSeries1.Y0 = 0.5;
            heatMapSeries1.Y1 = 2.5;
            heatMapSeries1.Interpolate = false;

            heatMapSeries1.Data = new Double[2, 3];
            heatMapSeries1.Data[0, 0] = 0;
            heatMapSeries1.Data[0, 1] = 0.2;
            heatMapSeries1.Data[0, 2] = 0.4;
            heatMapSeries1.Data[1, 0] = 0.1;
            heatMapSeries1.Data[1, 1] = 0.3;
            heatMapSeries1.Data[1, 2] = 0.2;

            plotModel1.Series.Add(heatMapSeries1);
            return plotModel1;
        }

生成此图像:

enter image description here

(这是热图)

我的问题是 - var是什么?例如,在创建新的多维数组时,执行以下操作:

double[,] doubleArray = new double[columns, rows];

理解情况下,此typedouble[,]。为什么我需要知道这是因为我想将热图存储为实例变量,更具体地说,heatMapSeries1.Data作为多维数组。但是,在VS中,我无法将var声明为实例变量的类型。我得到的唯一选择是:

enter image description here

这里的任何OxyPlot专业人士都可以借给我一个帮助吗?谢谢。

0 个答案:

没有答案
相关问题