Page 1 of 1

3d point cloud, how to make the legend show 'better'?

Posted: Wed Mar 29, 2017 7:53 pm
by greggorob64
Hi, I'm doing some data visualization (image shown below), I have a point cloud, with some color coding based on an intensity value

If you see in the legend, the legend color code is all dotted. How can I make it a pretty, colorful legend? Thanks! I dumped the code below too, there's not too much of it.

Image

Code: Select all

this.chart = new Arction.WinForms.Charting.LightningChartUltimate(LightningChartUltimate);

         chart.BeginUpdate();
         try
         {
            this.chart.Name = "chart";
            chart.Dock = DockStyle.Fill;
            this.chart.Options.ShowDebugData = false;
            this.chart.ColorTheme = ColorTheme.SkyBlue;
            this.Controls.Add(this.chart);

            chart.Name = "Point cloud chart";

            series = new SurfaceMeshSeries3D(chart.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary);
            chart.View3D.SurfaceMeshSeries3D.Add(series);

            chart.ActiveView = ActiveView.View3D;
            series.ColorSaturation = 100;
            series.WireframeType = SurfaceWireframeType3D.DotsPalettedByValue;
            series.ContourLineType = ContourLineType3D.None;
            series.Fill = SurfaceFillStyle.None;
            series.ContourLineType = ContourLineType3D.None;
            series.ContourPalette = CreatePalette(series);
            this.series.Clear();
         }
         finally
         {
            chart.EndUpdate();
         }

Code: Select all

      /// <summary>
      /// Create palette.
      /// </summary>
      /// <param name="ownerSeries">palette owner</param>
      /// <returns>ValueRangePalette</returns>
      private ValueRangePalette CreatePalette(SeriesBase3D ownerSeries)
      {
         ValueRangePalette palette = new ValueRangePalette(ownerSeries);

         Color[] colors = new Color[] { Color.Blue, Color.Teal, Color.Green, Color.Yellow, Color.Red };

         var palletList = new List<PaletteStep>();

         colors.Select((c, i) => new PaletteStep() { Color = colors[i], MaxValue = 255.0 / (float)colors.Length * (i + 1) });

         series.ContourPalette.Steps = palletList;
         series.ContourPalette.Type = PaletteType.Gradient;
         series.ContourPalette.MinValue = 0;
         return palette;
      }

Re: 3d point cloud, how to make the legend show 'better'?

Posted: Thu Mar 30, 2017 1:50 pm
by ArctionKestutis
Hi Greg,

The simplest approach is to create another, Dummy Series. Set same palette, and desired Fill option. Finally, just disable Series.ShowInLegendBox for the first mesh.

All the best.

Re: 3d point cloud, how to make the legend show 'better'?

Posted: Fri Mar 31, 2017 7:31 pm
by greggorob64
Thanks for the help, solution works great! Thank you.

Code: Select all

              legendSeries = new SurfaceMeshSeries3D(chart.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary);
               legendSeries.ColorSaturation = 100;
               legendSeries.WireframeType = SurfaceWireframeType3D.DotsPalettedByValue;
               legendSeries.ContourLineType = ContourLineType3D.None;
               legendSeries.Fill = SurfaceFillStyle.PalettedByY;
               legendSeries.Title.Text = "Intensity";
               legendSeries.ShowInLegendBox = true;

               legendSeries.ContourPalette = new ValueRangePalette(legendSeries)
               {
                  ShowMinValueLegendLabel = false,
                  Steps = CreatePaletteSteps(),
                  Type = PaletteType.Gradient,
                  MinValue = 0
               };
               chart.View3D.SurfaceMeshSeries3D.Add(legendSeries);
            }