Space between bar groups

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Dave Cox
Newbie
Newbie
Posts: 5
Joined: Tue Jul 15, 2014 12:00 am

Space between bar groups

Post by Dave Cox » Mon Jan 19, 2015 4:36 pm

Hello,

How do I change the space between the groups of bars on each day (or whatever time period)? The example shows the space between each bar group (red circle) that I want to make smaller.

Thanks!

Dave
Attachments
BarSpacing.png
BarSpacing.png (30.47 KiB) Viewed 7592 times

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Space between bar groups

Post by Yeray » Tue Jan 20, 2015 8:24 am

Hi Dave,

You could try setting a bigger BarWidthPercent for the TBarSeries in your chart.
Here it is a simple example using a TrackBar to modify this property:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 3 do
    Chart1.AddSeries(TBarSeries).FillSampleValues();

  TrackBar1.Max:=100;
  TrackBar1.Min:=0;
  TrackBar1.Position:=(Chart1[0] as TBarSeries).BarWidthPercent;
  TrackBar1.Frequency:=10;
end;

procedure TForm1.TrackBar1Change(Sender: TObject);
var i: Integer;
begin
  for i:=0 to chart1.SeriesCount-1 do
    (Chart1[i] as TBarSeries).BarWidthPercent:=TrackBar1.Position;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dave Cox
Newbie
Newbie
Posts: 5
Joined: Tue Jul 15, 2014 12:00 am

Re: Space between bar groups

Post by Dave Cox » Tue Jan 20, 2015 2:28 pm

Hello Yeray,

Thanks for the reply.

I must be missing something as changing the BarWidthPercent does not have any effect on the bar chart. Is there a setting I need to change to enable BarWidthPercent?

Dave

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Space between bar groups

Post by Narcís » Wed Jan 21, 2015 9:58 am

Hello Dave,

This works fine for me here with the attached project from the code Yeray posted. I'm using our latest TeeChart sources, which will be out on a new release very soon, which TeeChart version are you using? Does the project work fine for you?
Attachments
BarWidthPercentTrackBar.zip
(2.5 KiB) Downloaded 481 times
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Dave Cox
Newbie
Newbie
Posts: 5
Joined: Tue Jul 15, 2014 12:00 am

Re: Space between bar groups

Post by Dave Cox » Wed Jan 21, 2015 7:32 pm

Hi Narcis,

Yes, the project example you gave me works, but the same code does not work in my application. What I am wondering is if there is a setting that needs to be changed to allow the scaling of the BarWidthPercent. For example, an automatic scale that needs to be set to true or false?

Thanks,

Dave

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Space between bar groups

Post by Narcís » Thu Jan 22, 2015 8:13 am

Hi Dave,
Dave Cox wrote: Yes, the project example you gave me works, but the same code does not work in my application.
In that case look at the .dfm in my project as text to see if there's any property that makes a difference.
Dave Cox wrote:What I am wondering is if there is a setting that needs to be changed to allow the scaling of the BarWidthPercent. For example, an automatic scale that needs to be set to true or false?
Not that I can think of. Are you setting axes scales manually?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply