resetting the position of legend scroll bar

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Amol
Advanced
Posts: 176
Joined: Mon May 29, 2006 12:00 am

resetting the position of legend scroll bar

Post by Amol » Tue Jun 23, 2015 6:27 am

Hi,

We are currently working on TChart .Net 2012. We are using legend scroll bar in one of our projects. We just wanted to confirm that if legend scroll bar is scrolled to the bottom then is there any way that we can pro grammatically reset its scroll position to 0 ?

Regards,
Amol

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: resetting the position of legend scroll bar

Post by Narcís » Tue Jun 23, 2015 8:32 am

Hi Amol,

It's possible but not with a far from ideal solution, see the code snippet below for an example. Given this is not a very good solution, as it relies on an arbitrarily set constant, I have added a new feature request at our bug list (bug #1244) to help with that in the future.

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

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

      Steema.TeeChart.Styles.Histogram bar1 = new Steema.TeeChart.Styles.Histogram(tChart1.Chart);
      bar1.FillSampleValues(100);

      Steema.TeeChart.Tools.LegendScrollBar scrollBar1 = new Steema.TeeChart.Tools.LegendScrollBar(tChart1.Chart);

      scrollBar1.Scrolled += scrollBar1_Scrolled;
    }

    const int maxPos = 76;

    void scrollBar1_Scrolled(object sender, EventArgs e)
    {
      var scrollBar = (Steema.TeeChart.Tools.LegendScrollBar)sender;

      if (scrollBar.Position == maxPos)  
        scrollBar.Position = 0;
    }
Best Regards,
Narcís Calvet / 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