Home Forums WinForms controls Xceed Chart for WinForms Interpolation and Grid Size bug?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19147 |

    Hi,

     

    I have noticed an issue with the Grid Surface chart and they way grid size affects interpolation.  I am plotting a chart of 61x 101 data points but only have 11 x 9 actual points.  The rest of the data points I am setting to DBNull.Value. 

     When setting my grid size to 61×101, plotting my data points, and setting the EmptyDataPoints.ValueMode to EmptyDataPointsValueMode.Average, I get a blank graph.  However, if I increase my grid size to 62 x 102, I get a nice pretty interpolated graph with some extra data points at the edges:

    surface grid 62x102 with extra data points 

     

    What am I doing wrong in my graph?  I would think that the correct grid size is 61×101, but why doesn’t the interpolation return anything with this setting?  If the graph does indeed need to be 62×102, then why do I see the extra data points at the edges of my graph that go to zero?

     

    To reproduce my issue, you can modify the GridSurfaceUC.cs example code:

    1.  modify grid size to 62×102:

          m_Surface.Data.SetGridSize(62, 102);

    2.  then modify FillData:

         private void FillData()
        {       
            IList<int> xRange = new List<int>() { 0, 10, 20, 25, 28, 30, 32, 35, 40, 50, 60 };
            IList<int> yRange = new List<int>() { 0, 25, 40, 45, 50, 55, 60, 75, 100 };
            IList<double> data = new List<double>() { 0, 1.56437856, 3.18771968, 4.02032784, 4.52450104, 4.86076372, 5.198223785, 5.70820432, 6.57598216, 8.37657152, 10.23206816, 0.2053536, 1.7505152, 3.36096224, 4.18808816, 4.68892944, 5.02345564, 5.35925357, 5.8669678, 6.73122768, 8.5186864, 10.36069312, 0.35857984, 1.89976928, 3.50707888, 4.33259264, 4.83257772, 5.16679102, 5.5023152, 6.00952808, 6.87213984, 8.6522784, 10.48496832, 0.41302048, 1.9542368, 3.56149408, 4.38683776, 4.88681388, 5.22106726, 5.55668464, 6.06380616, 6.92620032, 8.70438016, 10.53430336, 0.46889888, 2.01068672, 3.61830256, 4.44370872, 4.94382528, 5.27813984, 5.61383236, 6.12111712, 6.9833208, 8.7598192, 10.58720832, 0.5259792, 2.06884864, 3.67728528, 4.50306744, 5.00323304, 5.337816505, 5.67370256, 6.18112896, 7.04325792, 8.818568, 10.64356864, 0.58413216, 2.12864448, 3.7383208, 4.56444136, 5.06503104, 5.3997984, 5.7359212, 6.24355448, 7.10593904, 8.88013952, 10.70293792, 0.76383968, 2.31557728, 3.9310704, 4.75953332, 5.261615078, 5.59746352, 5.93458204, 6.44340152, 7.30688256, 9.07972256, 10.8978864, 1.07463328, 2.64429088, 4.27481408, 5.1098816, 5.61575324, 5.9541364, 6.29372112, 6.80605216, 7.67378624, 9.4495264, 11.26546144 };
           

            for (int j = 0;j <= yRange[yRange.Count-1]; j++)
            {
                for (int i = 0; i<= xRange[xRange.Count-1]; i++)            
                {
                    if (yRange.Contains(j) && xRange.Contains(i))
                    {
                        //int index = i+yRange.IndexOf(j)*yRange.Count;
                        int index = xRange.IndexOf(i) + yRange.IndexOf(j) * xRange.Count;
                        double lastValue = data[index]-5;
                        Debug.WriteLine(String.Format(“{0},{1}:{2}”, i, j, lastValue));
                        m_Surface.Data.SetValue(i, j, lastValue);
                    }
                    else
                    {
                        Debug.WriteLine(String.Format(“{0},{1}:null”, i, j));
                        m_Surface.Data.SetValue(i, j, DBNull.Value);
                    }
                }
            }

            DataSeriesCollection coll = m_Surface.GetDataSeries(DataSeriesMask.Values, DataSeriesMask.None, true);

            foreach (DataSeries ds in coll)
            {
                ds.EmptyDataPoints.ValueMode = EmptyDataPointsValueMode.Average;
            }

            Core.GridSurfaceSeries series = (Core.GridSurfaceSeries)m_Chart.Series[0];
            series.EmptyDataPointsAppearance.Mode = EmptyDataPointsAppearanceMode.Normal;

        }

    Imported from legacy forums. Posted by Kileen (had 1934 views)

    User (Old forums)
    Member
    Post count: 23064

    Important note: This user had a Vanguard subscription so he sent a request at priority@xceed.com for support…  When you have a Vanguard subscription and you post a question on a forum, IT IS IMPORTANT THAT YOU ALSO SEND US A NOTIFICATION AT PRIORITY@XCEED.COM with a reference to the thread you have created since your Vanguard subscription status is only visible when you write at priority@xceed.com

    Here is a copy of the answer we sent him, two weeks ago:

    Replace:
          for (int j = 0; j <= yRange[yRange.Count – 1]; j++)
          {
            for (int i = 0; i <= xRange[xRange.Count – 1]; i++)
            {
              if (yRange.Contains(j) && xRange.Contains(i))
              {
                //int index = i+yRange.IndexOf(j)*yRange.Count;
                int index = xRange.IndexOf(i) + yRange.IndexOf(j) * xRange.Count;
                double lastValue = data[index] – 5;
                Debug.WriteLine(String.Format(“{0},{1}:{2}”, i, j, lastValue));
                m_Surface.Data.SetValue(i, j, lastValue);
              }
              else
              {
                // Debug.WriteLine(String.Format(“{0},{1}:null”, i,j));
                m_Surface.Data.SetValue(i, j, DBNull.Value);
              }
            }
          }

    by:
          for (int z = 0; z < m_Surface.Data.GridSizeZ; z++)
            for (int x = 0; x < m_Surface.Data.GridSizeX-1; x++)
              m_Surface.Data.SetValue(x, z, DBNull.Value);

          for (int j = 0; j < yRange.Count  ; j++)
          {
            for (int i = 0; i < xRange.Count;  i++)
            {
                int index = i + j * xRange.Count;
                double lastValue = data[index] – 5;
                Debug.WriteLine(String.Format(“{0},{1}:{2}”, xRange[i], yRange[j], lastValue));
                m_Surface.Data.SetValue(xRange[i], yRange[j], lastValue);
            }
          }

    For some unknown reasons, writing DBNull.Value in the last x value will make all points invisible for a given value of z.  There will be a followup on this and you will be informed as soon as the issue has been fixed.

    Imported from legacy forums. Posted by Ghislain (had 2513 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.