Page 1 of 1
Space between bar groups
Posted: Mon Jan 19, 2015 4:36 pm
by 16569782
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
Re: Space between bar groups
Posted: Tue Jan 20, 2015 8:24 am
by yeray
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;
Re: Space between bar groups
Posted: Tue Jan 20, 2015 2:28 pm
by 16569782
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
Re: Space between bar groups
Posted: Wed Jan 21, 2015 9:58 am
by narcis
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?
Re: Space between bar groups
Posted: Wed Jan 21, 2015 7:32 pm
by 16569782
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
Re: Space between bar groups
Posted: Thu Jan 22, 2015 8:13 am
by narcis
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?