Bar3D BarWidthPercent issue with multiple series and bars
Posted: Mon May 16, 2005 9:28 pm
I am attempting to have several Bar3D series (in 2D view) each with many bars. The X values with each series will all be the same integer value but be different (by a value of 1) from the other series. I would like the series to align next to each other without side margins. The behavior of BarWidthPercent varies depending on whether there is more than one bar per series. BarWidthPercent = 100 does not work correctly.
{ needed to clear series as sometimes points from design-time editor are kept }
series1.Clear;
series2.Clear;
series3.Clear;
series1.SideMargins := false;
series2.SideMargins := false;
series3.SideMargins := false;
series1.AddBar(1, 10, 12);
series2.AddBar(2, 11, 13);
series3.AddBar(3, 9, 15);
series1.BarWidthPercent := 33;
series2.BarWidthPercent := 33;
series3.BarWidthPercent := 33;
{ with only one bar per series,
BarWidthPercent of 100 does not show anything;
BarWidthPercent needs to be (100/number of series) ? }
exit;
series1.AddBar(1, 14, 17);
series1.AddBar(1, 21, 22);
series2.AddBar(2, 15, 21);
series2.AddBar(2, 23, 25);
series3.AddBar(3, 16, 19);
series3.AddBar(3, 22, 25);
{ with more than one bar per series,
if BarWidthPercent is 100 only the last bar
is correct, the others only show their left edge
BarWidthPercent of 99 shows all bars but with gap }
series1.BarWidthPercent := 100;
series2.BarWidthPercent := 100;
series3.BarWidthPercent := 100;
{ needed to clear series as sometimes points from design-time editor are kept }
series1.Clear;
series2.Clear;
series3.Clear;
series1.SideMargins := false;
series2.SideMargins := false;
series3.SideMargins := false;
series1.AddBar(1, 10, 12);
series2.AddBar(2, 11, 13);
series3.AddBar(3, 9, 15);
series1.BarWidthPercent := 33;
series2.BarWidthPercent := 33;
series3.BarWidthPercent := 33;
{ with only one bar per series,
BarWidthPercent of 100 does not show anything;
BarWidthPercent needs to be (100/number of series) ? }
exit;
series1.AddBar(1, 14, 17);
series1.AddBar(1, 21, 22);
series2.AddBar(2, 15, 21);
series2.AddBar(2, 23, 25);
series3.AddBar(3, 16, 19);
series3.AddBar(3, 22, 25);
{ with more than one bar per series,
if BarWidthPercent is 100 only the last bar
is correct, the others only show their left edge
BarWidthPercent of 99 shows all bars but with gap }
series1.BarWidthPercent := 100;
series2.BarWidthPercent := 100;
series3.BarWidthPercent := 100;