Page 1 of 1
Bar Width for Stacked Bars
Posted: Sun Apr 26, 2009 11:33 am
by 9347181
Hello,
I have a Stacked Bar Chart which displays values for 6 years into the future the problem that I have is when displaying the chart the last Bar is only half as wide as the other bars and I have the Series width set to 100% for all bars. When I add another year to the base data with zero values then the last bar width is ok, but then the bottom axis shows an addtional year with zero values which does not look very professional. Is there any way to force the last bar to be the same width as the other bars?
Thanks!
Posted: Mon Apr 27, 2009 8:36 am
by yeray
Hi CCRyder,
I'm not able to reproduce the problem here with the following code. Could you please modify it in order to reproduce it? Or could you send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page.
Code: Select all
uses series;
procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
begin
for i:=0 to 1 do
begin
Chart1.AddSeries(TBarSeries.Create(self));
for j:=0 to 5 do
Chart1[i].Add(random*500);
end;
(Chart1[0] as TBarSeries).MultiBar := mbStacked;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
begin
for i:=0 to Chart1.SeriesCount-1 do
Chart1[i].Add(random*500);
end;
Bar Width for Stacked Bars
Posted: Mon Apr 27, 2009 8:52 am
by 9347181
Hello Yeray,
I have uploaded a sample project for you to view. I was trying to correct the width by adding another empty datarow to the table and then adjusting the Bottom Axis offset but this confuses the user when entering data.
Thanks for your help!!
Best regards
Posted: Mon Apr 27, 2009 10:35 am
by yeray
Hi Ryder,
Yes, it seems that having for example two Bar Series, and one of them with BarWidthPercent = 100 and not the other, the last bar of the first series isn't draw as BarWidthPercent = 100. I've added it to the wish list to be fixed in future releases (TV52014110).
Easy to reproduce with this:
Code: Select all
uses series;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
for i:=0 to 1 do
begin
Chart1.AddSeries(TBarSeries.Create(self));
Chart1[i].FillSampleValues(5);
end;
(Chart1[0] as TBarSeries).BarWidthPercent := 100;
end;
Bar Width for Stacked Bars
Posted: Mon Apr 27, 2009 6:11 pm
by 9347181
Hello Yeray,
Any ideas for a workaround until the next update?
Regards,
Posted: Tue Apr 28, 2009 9:06 am
by yeray
Hi Ryder,
The only workaround I can think right now is to add another series with a null value and adjust the axis:
Code: Select all
uses series;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
for i:=0 to 1 do
begin
Chart1.AddSeries(TBarSeries.Create(self));
Chart1[i].FillSampleValues(5);
end;
(Chart1[0] as TBarSeries).BarWidthPercent := 100;
Chart1[0].AddNull();
Chart1.Axes.Bottom.AutomaticMaximum:=false;
Chart1.Axes.Bottom.Maximum:=Chart1[0].Count-1;
end;
Bar Width for Stacked Bars
Posted: Tue Apr 28, 2009 9:24 am
by 9347181
Hello Yeray,
Thanks for the info. It looks like this will do the trick until the change has been implemented.