isothermal plot - change colorpalette & center X and Y pos.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
kint
Newbie
Newbie
Posts: 5
Joined: Wed Jun 23, 2010 12:00 am

isothermal plot - change colorpalette & center X and Y pos.

Post by kint » Tue Aug 17, 2010 9:44 am

Hello steema team,

i'd like to realize a isothermal plot with your software.. therefor i read in a csv file with three columns (X position, Y position, and Z for the temperature) and save it into a list of arrays.
The X and Y position is the top left position of each cell. You can load it here: http://rapidshare.com/files/413439287/2dtemp.csv

Then i plot it with a grid.. Here the code:

Code: Select all

ColorGrid cGrid = new ColorGrid(tChart1.Chart);

      cGrid.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
      cGrid.CenteredPoints = true;
      cGrid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
      cGrid.ColorEach = false;
      cGrid.Marks.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.None;
      cGrid.Marks.Callout.ArrowHeadSize = 8;
      cGrid.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
      cGrid.Marks.Callout.Distance = 0;
      cGrid.Marks.Callout.Draw3D = false;
      cGrid.Marks.Callout.Length = 10;
      cGrid.Marks.Callout.Series = cGrid;
      cGrid.Marks.Callout.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
      cGrid.Marks.Callout.Visible = false;
      cGrid.Pen.Visible = false;
      cGrid.Marks.Series = cGrid;
      cGrid.PaletteMin = 0;
      cGrid.PaletteStep = 0;
      cGrid.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.GrayScale;
      cGrid.Title = "isotherm";
      cGrid.UseColorRange = false;
      cGrid.UsePalette = true;
      cGrid.XValues.DataMember = "X";
      cGrid.YValues.DataMember = "Y";
      cGrid.ZValues.DataMember = "Z";
  

      cGrid.IrregularGrid = true;

      for (int i = 0; i < values.ElementAt(0).Length; i++)
      {
        cGrid.Add(Convert.ToDouble(values.ElementAt(0).GetValue(i)) * 1000,
                    Convert.ToDouble(values.ElementAt(2).GetValue(i)),
                    Convert.ToDouble(values.ElementAt(1).GetValue(i)) * 1000); // Y ACHSE
      }

      //test...
      double tempVal = Convert.ToDouble(values.ElementAt(0).GetValue(values.ElementAt(0).Length - 1));
      double tempVal2 = 0;
      for (int i = values.ElementAt(0).Length-1; i >= 0; i--)
      {
        if (Convert.ToDouble(values.ElementAt(0).GetValue(i)) != tempVal)
        {
          tempVal2 = Convert.ToDouble(values.ElementAt(0).GetValue(i));
          break;
        }
         
      }

      tChart1.Axes.Left.AutomaticMaximum = false;
      tChart1.Axes.Bottom.AutomaticMaximum = false;
      tChart1.Axes.Left.Maximum = Convert.ToDouble(values.ElementAt(1).GetValue(values.ElementAt(0).Length - 1)) * 1000 + (Convert.ToDouble(values.ElementAt(1).GetValue(values.ElementAt(0).Length - 1)) * 1000-Convert.ToDouble(values.ElementAt(1).GetValue(values.ElementAt(0).Length - 2)) * 1000);
      tChart1.Axes.Bottom.Maximum = Convert.ToDouble(values.ElementAt(0).GetValue(values.ElementAt(0).Length - 1)) * 1000 + (Convert.ToDouble(values.ElementAt(0).GetValue(values.ElementAt(0).Length - 1)) * 1000 - tempVal2*1000 );

      
      //Legend Palette
      Steema.TeeChart.Tools.LegendPalette legendPalette1 = new Steema.TeeChart.Tools.LegendPalette(tChart1.Chart);
      legendPalette1.Series = cGrid;//surface;
      legendPalette1.Left = 625;
      legendPalette1.Top = 140;
      legendPalette1.Width = 80;
      legendPalette1.Vertical = true;
      legendPalette1.Border.Visible = false;
      legendPalette1.Axis = Steema.TeeChart.Tools.LegendPaletteAxis.laOther; 
It produces this plot:
isothermal.gif
isothermal.gif (93.65 KiB) Viewed 3989 times

My Questions are:

1) I want to have a colorpallete from blue to red to yellow to white (like hot steel) - how can i do this?

2) I use CenteredPoints = true, but teechart is not plotting it in the center (see screenshot above). How can i do this?


Thanks a lot for your support!

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: isothermal plot - change colorpalette & center X and Y pos.

Post by Yeray » Tue Aug 17, 2010 1:38 pm

Hi kint,
kint wrote:1) I want to have a colorpallete from blue to red to yellow to white (like hot steel) - how can i do this?
You should set ColorGrid's custom palette as described here.
kint wrote:2) I use CenteredPoints = true, but teechart is not plotting it in the center (see screenshot above). How can i do this?
I'm afraid that CentredPoints has some problems with some data as discussed here. This is already in the defect list.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

kint
Newbie
Newbie
Posts: 5
Joined: Wed Jun 23, 2010 12:00 am

Re: isothermal plot - change colorpalette & center X and Y pos.

Post by kint » Wed Aug 18, 2010 5:35 am

Hi Yeray,

thanks a lot for you reply. I will test the costum colorpalette. I think this will help me!

The error with respect to the CenterPoints is really annoying. Actually, I've only bought a license of TeeChart for these isothermal plots!!
Is there a workaround?

Your support have added this issue TF02013011 on the 28 Apr 2008 at 07:41.
When the error will be fixed?

Thanks a lot.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: isothermal plot - change colorpalette & center X and Y pos.

Post by Sandra » Wed Aug 18, 2010 9:49 am

Hello Kint,

I think that you can use custom labels as does in next example that you can use as workaround:

Code: Select all

  private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            Steema.TeeChart.Styles.ColorGrid colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

            colorGrid1.IrregularGrid = true;
            tChart1.Legend.Visible = false;
            //colorGrid1.CenteredPoints = true;

            Random y = new Random();

            for (double x = 0; x < 2; x = x + 0.1)
            {
                for (double z = 0; z < 2; z = z + 0.1)
                {
                    colorGrid1.Add(x, y.Next(), z);
                }
            }

            tChart1.Panel.MarginBottom = 10;
            tChart1.Axes.Bottom.Labels.Items.Clear();

            int nCol = (int)Math.Sqrt(colorGrid1.Count);
            for (int i = 0; i < nCol - 1; i++)
            {
                double left = colorGrid1.XValues[i * nCol];
                double right = colorGrid1.XValues[(i + 1) * nCol];
                double mid = (left + right) / 2;

                int pos = tChart1.Axes.Bottom.CalcPosValue(mid);
                if ((pos >= tChart1.Axes.Bottom.IStartPos) && (pos <= tChart1.Axes.Bottom.IEndPos))
                    tChart1.Axes.Bottom.Labels.Items.Add(mid);
            }
            tChart1.Panel.MarginLeft = 10;
            tChart1.Axes.Left.Labels.Items.Clear();
            int nCol1 = (int)Math.Sqrt(colorGrid1.Count);
            for (int i = 0; i < nCol1 - 1; i++)
            {
                double left = colorGrid1.XValues[i * nCol1];
                double right = colorGrid1.XValues[(i + 1) * nCol1];
                double mid = (left + right) / 2;

                int pos = tChart1.Axes.Left.CalcPosValue(mid);
                if ((pos >= tChart1.Axes.Left.IStartPos) && (pos <= tChart1.Axes.Left.IEndPos))
                    tChart1.Axes.Left.Labels.Items.Add(mid);
            }
            tChart1.Axes.Bottom.Labels.Angle = 90;
        }
Could you tell us if previous code works as you want?


I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply