Page 1 of 1

Change ColorBandTool Location of ScrollPager on mouse click.

Posted: Tue Sep 15, 2015 4:50 am
by 9526439
Hi steema,

We have some query regarding Location of ColorBandTool Location of ScrollPager on mouse click.

1. We want to Change the ColorBandTool Location of ScrollPager where mouse is clicked on Subchart of Scrollpager.
Location.png
Image 1
Location.png (37.06 KiB) Viewed 5112 times

Re: Change ColorBandTool Location of ScrollPager on mouse click.

Posted: Tue Sep 15, 2015 4:12 pm
by Christopher
amol wrote:1. We want to Change the ColorBandTool Location of ScrollPager where mouse is clicked on Subchart of Scrollpager.
You can try something similar to this:

Code: Select all

    Line series;
    ScrollPager tool;
    private void InitializeChart()
    {
      series = new Line(tChart1.Chart);
      tool = new ScrollPager(tChart1.Chart);

      series.FillSampleValues(100);
      tool.Series = series;

      tool.SubChartTChart.MouseDown += SubChartTChart_MouseDown;
    }

    private void SubChartTChart_MouseDown(object sender, MouseEventArgs e)
    {
      double start = tool.ColorBandTool.Start;
      double end = tool.ColorBandTool.End;
      double range = (end - start);


      double xval = tool.SubChartTChart[0].XScreenToValue(e.X);
      tChart1.Header.Text = xval.ToString();

      tool.EndValue = (range / 2) + xval;
      tool.StartValue = tool.EndValue - range;
    }