Profile Picture

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

Posted By Santosh Chauhan 13 Years Ago

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

Author
Message
Santosh Chauhan
Posted 13 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 13 Years Ago
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
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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





Similar Topics


Reading This Topic