Page 1 of 1

Cant' set the zoom to the chart

Posted: Mon Feb 15, 2016 1:40 pm
by 15668832
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?

Re: Cant' set the zoom to the chart

Posted: Mon Feb 22, 2016 3:42 pm
by Christopher
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.
    }