Page 1 of 1

With ScrollPager tool chart no longer resizes.

Posted: Tue Feb 28, 2017 3:36 pm
by 15048900
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?

Re: With ScrollPager tool chart no longer resizes.

Posted: Wed Mar 01, 2017 11:12 am
by Christopher
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.

Re: With ScrollPager tool chart no longer resizes.

Posted: Wed Mar 01, 2017 12:12 pm
by Christopher
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].

Re: With ScrollPager tool chart no longer resizes.

Posted: Wed Mar 01, 2017 5:57 pm
by 15048900
The code:

Code: Select all

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