Page 1 of 1

legendpalette - automatic max/min

Posted: Wed Jun 08, 2011 7:31 am
by 15656456
hello steema team,

i am working with teechart for an colorgrid with a legendpalette for the color identification.

everytime i plot i am generating a new colorgrid and plot it. this works.

after the plot i am doing this:

Code: Select all

      legendPalette1.Series = cGrid;
      legendPalette1.Left = 465;
      legendPalette1.Top = 41;
      legendPalette1.Width = 80;
      legendPalette1.Height = 330;
      legendPalette1.Vertical = true;
      legendPalette1.Border.Visible = true;
      legendPalette1.Axis = Steema.TeeChart.Tools.LegendPaletteAxis.laOther;
      legendPalette1.Border.Chart.Axes.Right.Title.Text = "Temperature in °C";
      legendPalette1.Border.Chart.Axes.Right.Title.Visible = true;
      
the problem that the legendpalette have the old min/max borders from the old colorgrid.

how do i change the min/max borders of the legendpalette?

greetings!

Re: legendpalette - automatic max/min

Posted: Wed Jun 08, 2011 9:03 am
by 10050769
Hello kint,

I have made a simple code that works fine for us here:

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.ColorGrid cGrid;
        Steema.TeeChart.Tools.LegendPalette legendPalette1;

        private void InitializeChart()
        {
            cGrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
            cGrid.FillSampleValues();
            tChart1.Aspect.View3D = false;
            legendPalette1 = new Steema.TeeChart.Tools.LegendPalette(tChart1.Chart);
                
            legendPalette1.Series = cGrid;
            legendPalette1.Left = 365;
            legendPalette1.Top = 41;
            legendPalette1.Width = 80;
            legendPalette1.Height = 330;
            legendPalette1.Vertical = true;
            legendPalette1.Border.Visible = true;
            legendPalette1.Axis = Steema.TeeChart.Tools.LegendPaletteAxis.laOther;
            legendPalette1.Border.Chart.Axes.Right.Title.Text = "Temperature in °C";
            legendPalette1.Border.Chart.Axes.Right.Title.Visible = true;          

        }

        private void button1_Click(object sender, EventArgs e)
        {
            tChart1.Series.Clear();
            cGrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

            Random y = new Random();

            for (int x = 0; x < 10; x++)
            {
                for (int z = 0; z < 10; z++)
                {
                    cGrid.Add(x, y.Next(100), z);        
                }
            }

            legendPalette1.Series = cGrid;
        }
Could you confirm us if previous code works as you expected? If previous code works as you expected but not reproduce your problem please modify it or send us a simple project so we can reproduce exactly your problem here. On the other hand, you can tell us which version of TeeChart are you using now?

Thanks,

Re: legendpalette - automatic max/min

Posted: Wed Jun 08, 2011 9:16 am
by 15656456
Hello Sandra,

thanks for your reply.
I am using TeeChartNET2010VSNET2008_4.0.2011.02082 with VS2008 and C#.

Your code works fine. But if you want to redraw the colorgrid with other values after your code, the borders from the legendpalette don't change.

my code is working like this:

STEP 1: fill colorgrid1 -> draw colorgrid1 on chart1 -> legendPalette1.Series = colorgrid1-> WORKS!

STEP 2: clear colorgrid1 -> fill colorgrid1 (with higher values as colorgrid1 in step 1) -> draw colorgrid1 on chart1 -> legendPalette1.Series = colorgrid1-> WRONG BORDERS! (the borders don't change and they are the same as in step 1)

do you understand?

Re: legendpalette - automatic max/min

Posted: Wed Jun 08, 2011 10:49 am
by 10050769
Hello kint,

I can reproduce your problem and I have added it in wish-list with number [TF02015604] to be consider inclusion it in next versions of TeeChart .Net. On the other hand, for the moment you need assign series to the tool every time you create a new Colorgrid series in your case, as do in next code:

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.ColorGrid cGrid;
        Steema.TeeChart.Tools.LegendPalette legendPalette1;

        private void InitializeChart()
        {
            cGrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
            cGrid.FillSampleValues();
            tChart1.Aspect.View3D = false;
            legendPalette1 = new Steema.TeeChart.Tools.LegendPalette(tChart1.Chart);
                
            legendPalette1.Series = cGrid;
            legendPalette1.Left = 365;
            legendPalette1.Top = 41;
            legendPalette1.Width = 80;
            legendPalette1.Height = 330;
            legendPalette1.Vertical = true;
            legendPalette1.Border.Visible = true;
            legendPalette1.Axis = Steema.TeeChart.Tools.LegendPaletteAxis.laOther;
            legendPalette1.Border.Chart.Axes.Right.Title.Text = "Temperature in °C";
            legendPalette1.Border.Chart.Axes.Right.Title.Visible = true;          

        }

        private void button1_Click(object sender, EventArgs e)
        {
            tChart1.Series.Clear();
            cGrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

            Random y = new Random();

            for (int x = 0; x < 10; x++)
            {
                for (int z = 0; z < 10; z++)
                {
                    cGrid.Add(x, y.Next(100), z);        
                }
            }

            legendPalette1.Series = cGrid;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            tChart1.Series.Clear();
            cGrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

            Random y = new Random();

            for (int x = 0; x < 10; x++)
            {
                for (int z = 0; z < 10; z++)
                {
                    cGrid.Add(x, y.Next(1000), z);
                }
            }
            legendPalette1.Series = cGrid;
        }
Could you please, check if previous code solve your problem at the moment?

Thanks,

Re: legendpalette - automatic max/min

Posted: Wed Jun 08, 2011 11:52 am
by 15656456
Yes, the legendpalette problem is solved with this solution.

But now every button-click a new object colorgrid is created and the memory is growing at each click.
My grid has thousands of cells - after ten "refresh"-clicks the memory is over 250MB caused by teechart.

I just want to have one object "colorgrid" and refill it with new values. This works fine an the memory is not growing -> but there is the problem with the borders of the legendpalette.

do you have another work-around without cGrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart); ?

thanks for your fast replies!!

Re: legendpalette - automatic max/min

Posted: Thu Jun 09, 2011 2:42 pm
by 10050769
Hello kint,

I inform that your request is in bug list report with number [TF02015607] and it already is fixed for next maintenance release of TeeChart.Net. I recommend you to be aware at this forum, our RSS news feed, twitter and facebook accounts for new release announcements and what's implemented on them.

Thanks,