Page 1 of 1

resetting the position of legend scroll bar

Posted: Tue Jun 23, 2015 6:27 am
by 9641422
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

Re: resetting the position of legend scroll bar

Posted: Tue Jun 23, 2015 8:32 am
by narcis
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;
    }