Page 1 of 1

TBarseries wrong barwidth on not automatic axis

Posted: Tue Nov 10, 2009 2:53 pm
by 9244864
Hello !

I use TChart 7.12 VCL. You can produce the error with the TChart-Editor:

Insert a TBarseries fill it with 3 samples. The x-Points are:
0. Bar -0.5 .. 0.5
1.Bar 0.5 .. 1.5
3. Bar 1.5 .. 2.5
Thats ok, but when you widen the x-Axis range maybe to -3 .. 10
the bar have different width and position.
I could not figure out whats the rule for this.
0. Bar -1.8 .. 0.8
1. Bar 0.8 .. 0.5
2. Bar 0.5 .. 3.8 !!!!!!!
So the last bar is always very large.

The %BarWith is 100.

For SideMargins off you get -2 to -1 to 0 to 4

I expected the bars should be centered at 0, 1, 2, 3 etc. with width 1.

Is this a bug or must I configure something ???

Bye
Andreas Weichert

Re: TBarseries wrong barwidth on not automatic axis

Posted: Wed Nov 11, 2009 4:56 pm
by yeray
Hi Andreas,

Several changes have been made to Bar series since v7.12 and this has been improved.
For example the following code gives the following result in v8.06:

Code: Select all

uses series;

procedure TForm1.FormCreate(Sender: TObject);
var bar1: TBarSeries;
begin
  Chart1.View3D:=false;
  bar1:=TBarSeries.Create(self);
  Chart1.AddSeries(bar1);
  bar1.FillSampleValues(3);
  bar1.BarWidthPercent:=100;
  bar1.SideMargins:=false;
  Chart1.Axes.Bottom.SetMinMax(-3,10);
end;
Image

The result is still not perfect but I think is better than in v7. If you want to test it further note that you can download the fully functional evaluation version for free.

Re: TBarseries wrong barwidth on not automatic axis

Posted: Thu Nov 12, 2009 9:11 am
by 9244864
Thank you for the answer.
The result looks perfect for me - that is what I expected.
Ok I will update.