When several Horizontal Bar series are shown as MultiBar:= mbNone, their bars do not appear at their Y values location unless the two series start at the same Y axis value and have the same Y axis increment.
In the following code, with offset > 0 and multiplier := 1, the minimum bar (red) is too wide and the others appear at the wrong Y axis location .
If offset=0 and multiplier > 1, then series2 values seem to appear at their correct Y axis location but series1 does not.
offset := 0;
multiplier := 1;
with series1 do
begin
Clear;
ColorEachPoint := true;
BarWidthPercent := 100;
UseYOrigin := true;
MultiBar:= mbNone;
YOrigin := 1;
for i := 1 to 4 do
begin
AddXY(YOrigin + 1, i);
end;
end;
with series2 do
begin
Clear;
ColorEachPoint := true;
BarWidthPercent := 100;
UseYOrigin := true;
MultiBar:= mbNone;
YOrigin := 2;
for i := 1 to 6 do
begin
AddXY(YOrigin + 1, ( i * multiplier ) + offset);
end;
end;
multiple Horizontal Bar series problem
Althougth multiple Horizontal Bar series shown as MultiBar:= mbNone appear at their Y values location when the series start at the same Y axis value and have the same Y axis increment, I observe that if the vertical axis maximum is greater than the maximum value of any of the Horizontal Bar seies, then those bar series values again do not appear at their correct location. For instance, adding another point series which has Y-values greater than the bar series.
This seems due to errors in the calculation of the barwidthpercent. Using a small value for barwidthpercent makes the bar values appear at the correct vertical axis location. As the barwidthpercent is increased, eventually the bar width of the maximum value in the bar series becomes larger than the other bar values and "pushes" the other bars down. Perhaps the bar pixel width is being calculated based on the vertical axis range rather than on only the data range of the values in each bar series ?
Setting the AutoBarSize property true or false changes the bar position but they still do not all align with their vertical axis values.
I wish to have all bars joined, so have set BarWidthPercent := 100. Since there seems to be an issue with calculation of the bar height, I'm setting
series1.CustomBarHeight := series1.CalcYPos(0) - series1.CalcYPos(1);
This joins bars when all data values have the same increment.
This seems due to errors in the calculation of the barwidthpercent. Using a small value for barwidthpercent makes the bar values appear at the correct vertical axis location. As the barwidthpercent is increased, eventually the bar width of the maximum value in the bar series becomes larger than the other bar values and "pushes" the other bars down. Perhaps the bar pixel width is being calculated based on the vertical axis range rather than on only the data range of the values in each bar series ?
Setting the AutoBarSize property true or false changes the bar position but they still do not all align with their vertical axis values.
I wish to have all bars joined, so have set BarWidthPercent := 100. Since there seems to be an issue with calculation of the bar height, I'm setting
series1.CustomBarHeight := series1.CalcYPos(0) - series1.CalcYPos(1);
This joins bars when all data values have the same increment.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Steve,
Thanks for the report. We have been able to reproduce this and have added the bug to our defect list to be fixed for future releases. The only solution I can thing of for now is using MultiBar:=mbNone as in the snippet below which works fine.
Thanks for the report. We have been able to reproduce this and have added the bug to our defect list to be fixed for future releases. The only solution I can thing of for now is using MultiBar:=mbNone as in the snippet below which works fine.
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
i, SeriesIndex, offset: Integer;
begin
offset := 0;
for SeriesIndex:=0 to Chart1.SeriesCount-1 do
With (Chart1[SeriesIndex] as THorizBarSeries) do
begin
Clear;
BarWidthPercent := 100;
UseYOrigin := true;
//MultiBar:= mbSide;
MultiBar:=mbNone;
YOrigin := SeriesIndex + 1;
for i := 1 to 4 do AddXY(YOrigin + 1, i + (offset * SeriesIndex));
end;
end;
Best Regards,
Narcís Calvet / 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 |