Feature request - New color palettes for 3d plots

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
hkoesa
Newbie
Newbie
Posts: 9
Joined: Mon Jan 17, 2022 12:00 am

Feature request - New color palettes for 3d plots

Post by hkoesa » Wed May 25, 2022 4:51 am

Hi Steema,

I've been using TeeChart for almost 20 years now.
Currently, I am using TeeChart Net for Winforms in Net Framework 4.8.

I would really appreciate if you could add a few more standard color PaletteStyles for the 3d plots than just the 5 ones.
http://steema.com/docs/teechart/net/lib ... Styles.htm

For example I would like to use an inverted Rainbow palette where red is for the largest value...
Also the maximum PaletteStep for the Rainbow palette is 25. Setting more steps just starts over with the lowest or highest color. The Palette should scale with steps like the others do.
The AddPalette function is similar to what I like to have but it does not automatically scale with Z values.

Also it would be great if the "UseColorRange" function would allow more than just 3 (start, mid and end) colors. Having an option for 4 ,5 or more colors in the range would add a lot of flexibility.

Additionally it would be great if the compute time for plotting large datasets could be improve.
I am regularly plotting 3d datasets of about 20,000 datapoints (150 X 150) and the chart update takes about 0.5-0.8sec which is really slow. On modern PCs with OpenGL rendering, that should be much faster.

Thanks
Holger

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Feature request - New color palettes for 3d plots

Post by Christopher » Wed May 25, 2022 7:55 am

Hi Holgar,

first of all, many thanks for your continuing use and support of Steema's TeeChart. It is a pleasure for us to work to continue such long-standing relationships.

I've added your post to our issue tracker with id=2530. Some of these requests are going to be easier and quicker to implement than others—I will recommend that the first one to look at will be a better implementation of the AddPalette function which, if implemented correctly with automatic Z value scaling, will enable you to define the custom palette of your choice.

The most difficult to implement, of course, is an OpenGL/Direct3D canvas. You may remember we had an OpenGL implementation a few years ago which we had to deprecate because of the necessary time investment to keep our code up to date with changes in the OpenGL library versus the lack of market interest in the product. We even produced a Direct2D canvas which disappointed in its performance basically because of the disconnect between the Win32 API .NET Framework Windows Forms are based on and the more modern WinRT GPU-enhanced graphics which are more promising. Microsoft now has its own Direct2D library called Win2D for use with the latest iterations of WinRT frameworks which we are presently attempting to implement in our forthcoming TeeChart.WinUI.dll.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Feature request - New color palettes for 3d plots

Post by Christopher » Fri Jul 01, 2022 11:34 am

Hello Holgar,

we're looking at this now, and we've got a quick question to ask you if that's okay with you. When you say that:
hkoesa wrote:
Wed May 25, 2022 4:51 am
The AddPalette function is similar to what I like to have but it does not automatically scale with Z values.
what code can we use to see what you mean? The following code generates a palette with 64 unique colours, but we can't see how the palette fails to scale with Z values. Please note that palette colours depend on Y values, not Z values, and each time we add a new colour to the palette we define the Y value up to which we want to paint in that colour:

Code: Select all

    public Form1()
    {
      InitializeComponent();

      double GetYValue(double x, double z, int iNumXValues, int iNumZValues)
      {
        return 0.5 * Math.Pow(Math.Cos(x / (iNumXValues * 0.2)), 2) +
          Math.Pow(Math.Cos(z / (iNumZValues * 0.2)), 2) -
          Math.Cos(z / (iNumZValues * 0.5));
      }

      tChart1.Aspect.View3D = true;
      tChart1.Aspect.Chart3DPercent = 80;
      tChart1.Aspect.Orthogonal = false;
      tChart1.Aspect.Zoom = 80;
      tChart1.Zoom.Direction = Steema.TeeChart.ZoomDirections.None; 

      tChart1.Tools.Add(typeof(Rotate));

      var surface = new Surface(tChart1.Chart);

      var numX = 50;
      var numZ = 100;

      for (int x = 0; x < numX; x++)
      {
        for (int z = 0; z < numZ; z++)
        {
          var y = GetYValue(x, z, numX, numZ);
          surface.Add(x, y, z);
        }
      }

      var rnd = new Random();
      var rangeY = surface.YValues.Range;
      var numSteps = 64;
      double value = surface.YValues.Minimum;

      surface.UseColorRange = false;
      surface.UsePalette = true;
      surface.ClearPalette();

      var colors = new List<Color>();

      while(colors.Count < numSteps)
      {
        var color = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255));

        if (!colors.Contains(color))
        {
          colors.Add(color);
        }
      }

      colors = colors.OrderBy(x => x.R).ToList();

      for (int i = 0; i < numSteps; i++)
      {
        var step = rangeY / numSteps;
        value += step;
        surface.AddPalette(value, colors[i]);
      }
    }
Screenshot from 2022-07-01 13-21-13.png
Screenshot from 2022-07-01 13-21-13.png (377.09 KiB) Viewed 5295 times
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply