Cant' set the zoom to the chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Cant' set the zoom to the chart

Post by Raavi » Mon Feb 15, 2016 1:40 pm

var m_Chart = new TChart();

m_Chart.Aspect.View3D = false;
m_Chart.Legend.Visible = false;

m_Chart.Chart.Name = "TestChart";
m_Chart.Chart.Dock = DockStyle.Fill;
m_Chart.Chart.Header.Text = "";
m_Chart.Chart.Aspect.SmoothingMode = SmoothingMode.AntiAlias;

m_Chart.Chart.Series.Clear();
m_Chart.Chart.Tools.Clear();

m_Chart.Chart.Series.Add(line); // some line series with IsoHorizAxes = true;

m_Chart.Chart.Axes.Bottom.Automatic = true;
m_Chart.Chart.Axes.Bottom.Visible = false;

m_Chart.Chart.Axes.Left.Automatic = true;
m_Chart.Chart.Axes.Left.Visible = false;

Chart.Zoom.ZoomPercent(90.0); // This is not working rather shows empty chart. But if I unzoom using mouse chart appears again.

Why ZoomPercent(double value) is not working?

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

Re: Cant' set the zoom to the chart

Post by Christopher » Mon Feb 22, 2016 3:42 pm

Hello,

Firstly, apologies for the lateness in this reply.

I think your issue can be resolved by calling the TChart.Draw method, as in the example below:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      tChart1.Legend.Visible = false;

      tChart1.Name = "TestChart";
      tChart1.Dock = DockStyle.Fill;
      tChart1.Header.Text = "";
      tChart1.Aspect.SmoothingMode = SmoothingMode.AntiAlias;

      tChart1.Series.Clear();
      tChart1.Tools.Clear();

      Line line = new Line(tChart1.Chart);

      line.FillSampleValues();
      line.IsoHorizAxes = true;

      tChart1.Series.Add(line); // some line series with IsoHorizAxes = true;

      tChart1.Axes.Bottom.Automatic = true;
      tChart1.Axes.Bottom.Visible = false;

      tChart1.Axes.Left.Automatic = true;
      tChart1.Axes.Left.Visible = false;

      tChart1.Draw(); //<- this new line

      tChart1.Zoom.ZoomPercent(90.0); // This is not working rather shows empty chart. But if I unzoom using mouse chart appears again.
    }
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

Post Reply