Changing Legend entry text for TriangulatedSurfaceSeries


https://www.nevron.com/Forum/Topic8915.aspx
Print Topic | Close Window

By joern kunze - 9 Years Ago
Hi Experts,
I have a TriangulatedSurface Chart with a legend with custom colouring and I just want to change the text of the first legend entry ("-1000,00 - 0,00") of the chart below to "NaN":
 https://www.nevron.com/forum/uploads/images/bc289a7c-316f-4cfe-94a5-c2eb.bmp
The Chart legend has been setup with the following:

      NLegendItemCellData legendItemCellData = null;
       NLegend oLegend = _oLegend;
       oLegend.Data.Items.Clear();

       oLegend.Mode = LegendMode.Automatic;   //Manual Mode doesnt quite work 

       nSeries.AutomaticPalette = false;
       nSeries.Palette.Clear();

       //first Palette entry is NaN
       nSeries.Palette.Add(-1000, Color.White);
       legendItemCellData = new NLegendItemCellData();
       legendItemCellData.Text = "NaN";
       legendItemCellData.MarkFillStyle = new NColorFillStyle(Color.White);
       legendItemCellData.MarkShape = LegendMarkShape.Rectangle;
       legendItemCellData.MarkLineStyle = new NStrokeStyle(Color.White);
       oLegend.Data.Items.Add(legendItemCellData);

       foreach (double f in _PlotData.ColorPalette.Keys) {
        Color oColor = _PlotData.ColorPalette[f];
        nSeries.Palette.Add(f, oColor);

        legendItemCellData = new NLegendItemCellData();
        //legendItemCellData.
        legendItemCellData.Text = "> " + f.ToString("G4");  //in Automatic Mode Ignored
        legendItemCellData.MarkFillStyle = new NColorFillStyle(oColor);
        legendItemCellData.MarkShape = LegendMarkShape.Rectangle;
        legendItemCellData.MarkLineStyle = new NStrokeStyle(Color.White);
        oLegend.Data.Items.Add(legendItemCellData);

       }

The only way I have found is to set the legend to Manual mode ( oLegend.Mode = LegendMode.Manual) - but this is somehow awkward since I cant get the ManualMode running in the way I want - besides I have togenerate the text for the ranges then manual as well - but I am quite satisfied with the automatic text for the label.

So is there a way to change just the first text entry of the legend after the legend has been created in Automatic-Mode?

Thanks for your help,
Joern
By Nevron Support - 9 Years Ago
Hi Joern,

There is no way to change the output of the automatic legend - the only way to work around this is to use Manual mode and create the legend items from code...