With ScrollPager tool chart no longer resizes.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
biqpaulson
Newbie
Newbie
Posts: 93
Joined: Thu Apr 17, 2008 12:00 am

With ScrollPager tool chart no longer resizes.

Post by biqpaulson » Tue Feb 28, 2017 3:36 pm

We would like to allow the user to resize the form after adding the ScrollPager tool but for some reason the TChart ignores resize events and stays the same size even if docked.

Code: Select all

//#define ADD_SCROLL_PAGER
using Steema.TeeChart;
using Steema.TeeChart.Styles;
using Steema.TeeChart.Tools;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ScrollPagerTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

#if (ADD_SCROLL_PAGER)
        ScrollPager tool;
#endif
        Steema.TeeChart.Styles.Line series;

        private void InitializeChart()
        {
            tChart1.Dock = DockStyle.Fill;
            tChart1.Header.Text = "Scroll Pager Tool";
            tChart1.Series.Add(series = new Steema.TeeChart.Styles.Line());
            series.FillSampleValues(1000);
            series.Legend.Visible = false;

#if (ADD_SCROLL_PAGER)
            tChart1.Tools.Add(tool = new ScrollPager());
            tool.Series = series;

            tool.SubChartTChart.Panel.Pen.Visible = false;
            tool.SubChartTChart.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None;
            tool.SubChartTChart.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
#endif
        }
    }
}
With the Steema TeeChart for .NET 2016 4.1.2016.10260/.Net 4.0 version of the library if you drop a TChart onto a form and run the program resize events cause the chart to resize (since the code docs the tChart1 control).

Then uncomment the:

Code: Select all

#define ADD_SCROLL_PAGER
line and run the program again and resize the form.

With the ScrollPager tool added to the chart the chart no longer seems to be docked and the form is not able to be resized effectively.

I attached a SizeChanged event to the chart and the chart is getting events but the ScrollPager does not seem to be getting anything.

I tried docking the chartSettings.ScrollPagerTool.SubChartTChart but that does not seem to do anything either.

Any idea how to allow for resizing when a ScrollPagerTool is added to the chart?

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: With ScrollPager tool chart no longer resizes.

Post by Christopher » Wed Mar 01, 2017 11:12 am

Hello,

In previous versions a Chart with a ScrollPager in it had to be resized using the technique described here - however, in the latest version the following code has to be used:

Code: Select all

#if (ADD_SCROLL_PAGER)
            ScrollPager tool;
#endif
    Steema.TeeChart.Styles.Line series;

    private void InitializeChart()
    {
      tChart1.Header.Text = "Scroll Pager Tool";
      tChart1.Series.Add(series = new Steema.TeeChart.Styles.Line());
      series.FillSampleValues(1000);
      series.Legend.Visible = false;

#if (ADD_SCROLL_PAGER)
      InitTool();
      tChart1.Resize += TChart1_Resize;
#endif
    }

    private void InitTool()
    {
      tChart1.Tools.Clear();
      tChart1.Tools.Add(tool = new ScrollPager());
      tool.Series = series;
      tool.SubChartTChart.Panel.Pen.Visible = false;
      tool.SubChartTChart.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None;
      tool.SubChartTChart.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
    }


    private void TChart1_Resize(object sender, EventArgs e)
    {
      InitTool();
    }
We will look into making the first technique compatible with the next maintenance release of TChart.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: With ScrollPager tool chart no longer resizes.

Post by Christopher » Wed Mar 01, 2017 12:12 pm

Christopher wrote: We will look into making the first technique compatible with the next maintenance release of TChart.
Just to let you know that this issue has now been resolved [id=72].
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

biqpaulson
Newbie
Newbie
Posts: 93
Joined: Thu Apr 17, 2008 12:00 am

Re: With ScrollPager tool chart no longer resizes.

Post by biqpaulson » Wed Mar 01, 2017 5:57 pm

The code:

Code: Select all

void tChart1_Resize(object sender, EventArgs e)
    {
      tool.Series = num;
    }
Worked great. Thanks!

Post Reply