How to get Mesh chart working with String values on the X & Z axis?


How to get Mesh chart working with String values on the X & Z axis?
Author
Message
Santosh Chauhan
Santosh Chauhan
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)
Group: Forum Members
Posts: 4, Visits: 1

We are trying to use Nevron Mesh Chart in our Application to display graphs between three quantities. The chart works perfectly fine when all the three quantities are numeric. The sample code snippet is:

 

            Nevron.Chart.NChart surfaceChart = nChartControl1.Charts[0];

            surfaceChart.Enable3D = true;

            surfaceChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);

            surfaceChart.Series.Clear();

            Nevron.Chart.NMeshSurfaceSeries surfaceSeries = (NMeshSurfaceSeries)surfaceChart.Series.Add(SeriesType.MeshSurface);

 

            surfaceSeries.Data.SetGridSize(4, 4);

            surfaceSeries.Data.SetValue(0, 0, 0.8, 0.0, 1.3);

            surfaceSeries.Data.SetValue(1, 0, 0.5, 12.7, 1.2);

            surfaceSeries.Data.SetValue(2, 0, 0.2, 15.0, 1.1);

            surfaceSeries.Data.SetValue(3, 0, 0.0, 17.0, 1.0);

 

            surfaceSeries.Data.SetValue(0, 1, 1.9, 5.0, 12.0);

            surfaceSeries.Data.SetValue(1, 1, 1.7, 10.0, 11.0);

            surfaceSeries.Data.SetValue(2, 1, 1.3, 18.0, 10.0);

            surfaceSeries.Data.SetValue(3, 1, 1.1, 28.0, 9.0);

 

            surfaceSeries.Data.SetValue(0, 2, 2.8, 2.1, 22.0);

            surfaceSeries.Data.SetValue(1, 2, 2.5, 11.0, 21.0);

            surfaceSeries.Data.SetValue(2, 2, 2.1, 20.0, 20.0);

            surfaceSeries.Data.SetValue(3, 2, 1.9, 22.0, 23.0);

 

            surfaceSeries.Data.SetValue(0, 3, 3.8, 2.1, 22.0);

            surfaceSeries.Data.SetValue(1, 3, 3.5, 11.0, 21.0);

            surfaceSeries.Data.SetValue(2, 3, 3.1, 20.0, 20.0);

            surfaceSeries.Data.SetValue(3, 3, 3.9, 22.0, 23.0);

 

 

The problem that we are facing is – if one or more graph axis are calibrated by string values, the mesh graph is *not displayed*. In other words, we want to render a Mesh graph between numeric value on Y axis and string values on X & Z axis. We tried doing that by the following code snippet, but the Mesh chart didn’t get displayed on executing the code.

 

            Nevron.Chart.NMeshSurfaceSeries surfaceSeries = (NMeshSurfaceSeries)surfaceChart.Series.Add(SeriesType.MeshSurface);

            surfaceSeries.Data.SetGridSize(3, 3);

            surfaceSeries.Data.SetValue(0, 0, (object)1.2, (object)"b", (object)"c");

            surfaceSeries.Data.SetValue(1, 0, (object)1.5, (object)"e", (object)"f");

            surfaceSeries.Data.SetValue(2, 0, (object)1.9, (object)"h", (object)"i");

 

            surfaceSeries.Data.SetValue(0, 1, (object)2.3, (object)"k", (object)"l");

            surfaceSeries.Data.SetValue(1, 1, (object)2.7, (object)"n", (object)"o");

            surfaceSeries.Data.SetValue(2, 1, (object)2.9, (object)"q", (object)"r");

 

            surfaceSeries.Data.SetValue(0, 2, (object)3.4, (object)"t", (object)"u");

            surfaceSeries.Data.SetValue(1, 2, (object)3.1, (object)"w", (object)"x");

            surfaceSeries.Data.SetValue(2, 2, (object)3.9, (object)"z", (object)"zz");

 

It seems like Object version of overloaded NMeshSurfaceData::setValue is not working for some reason. Could you please help us to figure out what’s wrong with the above code snippet?


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hello Santosh,

The chart does not provide built-in support for named categories. The solution is to use string-to-double maps (one for the X axis and the other for the Z axis). You have to assign a value for each category, for example:

"b" -> 1.0
"e" -> 2.0
"h" -> 5.0

When you fill the surface data these maps will give you the values that correspond to the category strings.



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search