简体   繁体   English

Nevron表面图表数据源

[英]Nevron surface chart data source

I have been looking at the above metioned chart and I am trying to figure out how their "FillData" method on the snippet below works. 我一直在看上面提到的图表,并试图找出下面代码段中的“ FillData”方法是如何工作的。

private void FillData(NGridSurfaceSeries surface)
        {
            double y, x, z;
            int nCountX = surface.Data.GridSizeX;
            int nCountZ = surface.Data.GridSizeZ;

            const double dIntervalX = 30.0;
            const double dIntervalZ = 30.0;
            double dIncrementX = (dIntervalX / nCountX);
            double dIncrementZ = (dIntervalZ / nCountZ);

            z = -(dIntervalZ / 2);

            for(int j = 0; j < nCountZ; j++, z += dIncrementZ)
            {
                x = -(dIntervalX / 2);

                for(int i = 0; i < nCountX; i++, x += dIncrementX)
                {
                    y = (x * z / 64.0) - Math.Sin(z / 2.4) * Math.Cos(x / 2.4);
                    y = 10 * Math.Sqrt( Math.Abs(y) );

                    if(y <= 0)
                    {
                        y = 1 + Math.Cos(x / 2.4);
                    }

                    surface.Data.SetValue(i, j, y);
                }
            }
        }

The documentaion is extremely sparse, and I would like to pass list of value in place of "Y", but I do not know what the rest of the code is doing, if anybody here has worked with this please shoot. 该文档非常稀疏,我想传递值列表代替“ Y”,但是我不知道其余代码在做什么,如果有人在使用此代码,请射击。

Actually you need only the surface.Data.SetValue method, the rest of the code just generates some data. 实际上,您仅需要surface.Data.SetValue方法,其余代码仅生成一些数据。 The Grid Surface data storage is like a 2 dimensional table – i and j are indices that specify a data point and y is the value of the data point. 网格表面数据存储就像一个二维表– i和j是指定数据点的索引,而y是数据点的值。 For example the following code fills some data in a 3x2 grid surface: 例如,以下代码在3x2的网格表面填充了一些数据:

// first row
surface.Data.SetValue(0, 0, 7.53);
surface.Data.SetValue(1, 0, 6.19);
surface.Data.SetValue(2, 0, 9.78);

// second row
surface.Data.SetValue(0, 1, 5.35);
surface.Data.SetValue(1, 1, 4.71);
surface.Data.SetValue(2, 1, 8.85);

I hope this helps. 我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM