private void GenerateData(NHeatMapSeries heatMap)
        {
            NHeatMapData data = heatMap.Data;

            int GridStepX = 300;
            int GridStepY = 300;

            data.SetGridSize(GridStepX, GridStepY);

            const double dIntervalX  = 10.0;
            const double dIntervalZ  = 10.0;
            double       dIncrementX = (dIntervalX / GridStepX);
            double       dIncrementZ = (dIntervalZ / GridStepY);

            double y, x, z;

            z = -(dIntervalZ / 2);

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

                for (int row = 0; row < GridStepY; row++, x += dIncrementX)
                {
                    y  = 10 - Math.Sqrt((x * x) + (z * z) + 2);
                    y += 3.0 * Math.Sin(x) * Math.Cos(z);

                    double value = y;

                    data.SetValue(row, col, value);
                }
            }
        }
        private void GenerateData()
        {
            NHeatMapData data = m_HeatMap.Data;

            data.SetGridSize(m_GridSizeX, m_GridSizeY);

            const double dIntervalX  = 10.0;
            const double dIntervalZ  = 10.0;
            double       dIncrementX = (dIntervalX / m_GridSizeX);
            double       dIncrementZ = (dIntervalZ / m_GridSizeY);

            double y, x, z;

            z = -(dIntervalZ / 2);

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

                for (int row = 0; row < m_GridSizeY; row++, x += dIncrementX)
                {
                    y  = 10 - Math.Sqrt((x * x) + (z * z) + 2);
                    y += 3.0 * Math.Sin(x) * Math.Cos(z);

                    double value = y;

                    data.SetValue(row, col, value);
                }
            }
        }
示例#3
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("Wafer Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

            // configure chart
            NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

            m_HeatMap = new NHeatMapSeries();
            chart.Series.Add(m_HeatMap);

            NHeatMapData data = m_HeatMap.Data;

            m_HeatMap.Palette.Mode = PaletteMode.AutoFixedEntryCount;
            m_HeatMap.Palette.AutoPaletteColors = new NArgbColorValue[] { new NArgbColorValue(Color.Green), new NArgbColorValue(Color.Red) };
            m_HeatMap.Palette.SmoothPalette     = true;

            int gridSizeX = 100;
            int gridSizeY = 100;

            data.SetGridSize(gridSizeX, gridSizeY);

            int centerX = gridSizeX / 2;
            int centerY = gridSizeY / 2;

            int    radius = gridSizeX / 2;
            Random rand   = new Random();

            for (int y = 0; y < gridSizeY; y++)
            {
                for (int x = 0; x < gridSizeX; x++)
                {
                    int dx = x - centerX;
                    int dy = y - centerY;

                    double pointDistance = Math.Sqrt(dx * dx + dy * dy);

                    if (pointDistance < radius)
                    {
                        // assign value
                        data.SetValue(x, y, pointDistance + rand.Next(20));
                    }
                    else
                    {
                        data.SetValue(x, y, double.NaN);
                    }
                }
            }
        }