I have been trying to put up the ScrollPager tool, get the user input, close the ScrollPager, add again the ScrollPager but have it set to what it was set to previously.
I cannot find the values to set in order to position the ColorBandTool in the previous location.
Here is the small piece of code that I have been using in order to try this out.
In the designer add one chart and one button:
Code: Select all
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;
using System.Diagnostics;
namespace ScrollPagerTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitializeChart();
}
ScrollPager tool;
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;
}
private void AddPagerTool()
{
if (tool != null)
{
Debug.Print("StartValue before destruction = " + tool.StartValue);
Debug.Print("EndValue before destruction = " + tool.EndValue);
}
Debug.Print("MinimumValue before adding PagerTool = " + tChart1.Axes.Bottom.Minimum);
Debug.Print("MaximumValue before adding PagerTool = " + tChart1.Axes.Bottom.Maximum);
tChart1.Tools.Clear();
double StartValue = tChart1.Axes.Bottom.Minimum;
double EndValue = tChart1.Axes.Bottom.Maximum;
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;
Debug.Print("StartValue after creation = " + tool.StartValue);
Debug.Print("EndValue after creation = " + tool.EndValue);
tool.StartValue = StartValue;
tool.EndValue = EndValue;
#if false
tool.ColorBandTool.Start = StartValue;
tool.ColorBandTool.End = EndValue;
tool.GetHorizAxis.Minimum = StartValue;
tool.GetHorizAxis.Maximum = EndValue;
#endif
Debug.Print("StartValue after setting from value originally in chart = " + tool.StartValue);
Debug.Print("EndValue after setting from value originally in chart = " + tool.EndValue);
}
private void button1_Click(object sender, EventArgs e)
{
AddPagerTool();
}
}
}