Bar series spacing

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
OMP
Newbie
Newbie
Posts: 5
Joined: Tue Jun 02, 2015 12:00 am

Bar series spacing

Post by OMP » Tue May 31, 2016 1:39 pm

Hello,

I have a question about bar series. I have the following code:

Code: Select all

Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar.FillSampleValues(10);
bar.Marks.Visible = false;
bar.MultiBar = Steema.TeeChart.Styles.MultiBars.None;
bar.BarWidthPercent = 65;
bar.Color = Color.FromArgb(100, 49, 130, 189);

Steema.TeeChart.Styles.Bar bar2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar2.FillSampleValues(10);
bar2.Marks.Visible = false;
bar2.BarWidthPercent = 30;
This results in the following chart:
TeeChart1.jpg
TeeChart1.jpg (30.3 KiB) Viewed 7376 times
For “bar1” the first and last bar are not shown completely.
If I change the order of the series it looks ok:
TeeChart2.jpg
TeeChart2.jpg (36.97 KiB) Viewed 7375 times
Is there a way to also show the first chart with the extra space next to the first and the last bar without having to change the offset or min/max values manually?

Thanks in advance!

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

Re: Bar series spacing

Post by Christopher » Wed Jun 01, 2016 10:45 am

Hello,
OMP wrote: Is there a way to also show the first chart with the extra space next to the first and the last bar without having to change the offset or min/max values manually?
Yes, you should be able to use Axis offsets, e.g.

Code: Select all

    private void InitializeChart()
    {
      Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
      bar.FillSampleValues(10);
      bar.Marks.Visible = false;
      bar.MultiBar = Steema.TeeChart.Styles.MultiBars.None;
      bar.BarWidthPercent = 65;
      bar.Color = Color.FromArgb(100, 49, 130, 189);

      Steema.TeeChart.Styles.Bar bar2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
      bar2.FillSampleValues(10);
      bar2.Marks.Visible = false;
      bar2.BarWidthPercent = 30;
      

      tChart1.Axes.Bottom.MinimumOffset = 50;
      tChart1.Axes.Bottom.MaximumOffset = 50;
    }
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

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

Re: Bar series spacing

Post by Christopher » Thu Jun 02, 2016 8:08 am

Christopher wrote:
OMP wrote: Is there a way to also show the first chart with the extra space next to the first and the last bar without having to change the offset or min/max values manually?
Yes, you should be able to use Axis offsets, e.g.
Ah, sorry, I now see that maybe you didn't want to use Axis offsets, my apologies. To answer your question then - no, there is nothing automatic that can be set manually to resolve this issue, so to speak.
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