Gap between border and chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
PeterF
Newbie
Newbie
Posts: 6
Joined: Wed Sep 27, 2017 12:00 am
Location: Kosice, Slovakia

Gap between border and chart

Post by PeterF » Fri Nov 24, 2017 12:00 pm

Hello guys,

I have problem with area, that is creating between border and chart itself.
With one chart line it is okay, but with more custom axis in the chart, distance between border and chart itself increases.

Code: Select all

 Axis axis2 = new Axis(false, false, ch1);
 ch1.Axes.Custom.Add(axis2);
zmesP.CustomVertAxis = axis2;

Axis axis1 = new Axis(false, false, ch1);
ch1.Axes.Custom.Add(axis1);
zp.CustomVertAxis = axis1;

axis1.StartPosition = 0;
axis1.EndPosition = 22;
axis2.StartPosition = 25;
axis2.EndPosition = 47;
Thank you for your help.

Peter
Attachments
Capture.PNG
Capture.PNG (22.1 KiB) Viewed 6937 times

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

Re: Gap between border and chart

Post by Christopher » Mon Nov 27, 2017 9:39 am

Hello,

One way of controlling this space is by using the Panel class' Margin* properties, e.g.

Code: Select all

    private void InitializeChart()
    {
      for (int i = 0; i < 5; i++)
      {
        tChart1.Series.Add(typeof(Line)).FillSampleValues();
      }

      tChart1.Axes.Left.Visible = false;
      tChart1.Panel.MarginUnits = PanelMarginUnits.Percent;
      tChart1.Panel.MarginLeft = 15;
    }

    private void button2_Click(object sender, EventArgs e)
    {
      int count = tChart1.Axes.Custom.Count;

      if(count < tChart1.Series.Count)
      {
        Axis axis = new Axis(tChart1.Chart);
        tChart1.Axes.Custom.Add(axis);
        tChart1.Series[count].CustomVertAxis = axis;

        tChart1.Header.Text = "There are " + tChart1.Axes.Custom.Count + " custom axes";
      }
    }
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