Page 1 of 1

LegendScrollbar is broken in newer versions

Posted: Mon Apr 02, 2012 6:48 am
by 13049497
Hello,

till last week we used TeeChart 3.5 (3.5.3105.20151) for over 4 years now but finally we upgraded to version 4.1 (4.1.2011.6283). In one of my first tests i found an issue with the LegendScrollBar tool. The size of the legend does not fit anymore and i have not found a usefull way to fix the problem for my own. In the attachment you can find an illustration of what i mean.

I used the following code for each TeeChart version:

Code: Select all

readonly TChart chart;

public Form1()
{
    InitializeComponent();

    this.Width = 1024;
    this.Height = 368;

    chart = new TChart { Dock = DockStyle.Fill };
    chart.Aspect.View3D = false;
    chart.Header.Text += " " + typeof(TChart).Assembly.GetName().Version;

    this.Controls.Add(chart);
    InitializeChart();
}

private void InitializeChart()
{
    var legendScrollBar = new LegendScrollBar();
    chart.Tools.Add(legendScrollBar);

    for (int i = 0; i < 25; i++)
    {
        var series = new Bar(chart.Chart) { Marks = { Visible = false } };
        series.FillSampleValues(10);
    }
}
The issue occure if you resize the form. The initially size of the legend is correct but after resizing it is wrong.
Did you have a fix or a workaround for this behaviour?

Thanks!

Re: LegendScrollbar is broken in newer versions

Posted: Tue Apr 03, 2012 8:25 am
by 10050769
Hello Ais,

You need set true AutoSize property of Legend as do in next code:

Code: Select all

 public Form1()
        {
            InitializeComponent();

            this.Width = 1024;
            this.Height = 368;

            tChart1.Dock = DockStyle.Fill;
            tChart1.Aspect.View3D = false;
            tChart1.Header.Text += " " + typeof(TChart).Assembly.GetName().Version;
            InitializeChart();
        }
        private void InitializeChart()
        {
            var legendScrollBar = new LegendScrollBar();
            tChart1.Tools.Add(legendScrollBar);
            for (int i = 0; i < 25; i++)
            {
                var series = new Bar(tChart1.Chart) { Marks = { Visible = false } };
                series.FillSampleValues(10);
            }
            tChart1.Draw();
            tChart1.Legend.AutoSize = false;
            tChart1.Legend.Width = 100;
        }
Can you tell us if previous code works as you expect?

I hope will help.

Thanks,

Re: LegendScrollbar is broken in newer versions

Posted: Tue Apr 17, 2012 5:54 am
by 13049497
Hello Sandra,

sorry for my late delay, now i can give you an answer to your question.
No, your code does not work. Setting a fixed width but don't know how much space the labels realy require is not a good solution. In my real world progam i have 1 to 100 possible legend entries each with different text lenghts. I do not know how much space is required and is available (scrollbar). Why does the "AutoSize" does not work anymore? Before it satisfy all needs.
I attached the results of your code as screenshots.

Thanks for your help.

Re: LegendScrollbar is broken in newer versions

Posted: Wed Apr 18, 2012 2:53 pm
by 10050769
Hello AIS,

Thanks for your information. I have added your request in bug list report with number [TF02016157]. We will try to fix it for next maintenance releases of TeeChart.Net.


Thanks,