LegendScrollbar is broken in newer versions

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

LegendScrollbar is broken in newer versions

Post by AIS » Mon Apr 02, 2012 6:48 am

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!
Attachments
legendscrollbar issue.PNG
legendscrollbar issue.PNG (83.14 KiB) Viewed 8150 times

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

Re: LegendScrollbar is broken in newer versions

Post by Sandra » Tue Apr 03, 2012 8:25 am

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,
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

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Re: LegendScrollbar is broken in newer versions

Post by AIS » Tue Apr 17, 2012 5:54 am

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.
Attachments
initial.PNG
Initial after start
initial.PNG (36.98 KiB) Viewed 8150 times
afterresize.PNG
After resizing (made it smaller)
afterresize.PNG (31.69 KiB) Viewed 8140 times

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

Re: LegendScrollbar is broken in newer versions

Post by Sandra » Wed Apr 18, 2012 2:53 pm

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,
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