3D BarChart Problem after 3D PieChart Display
Posted: Wed Sep 29, 2004 3:22 pm
Delphi 7/ TeeChart Pro 7
I have one TChart component that is used for numerous charts that are
generated programmatically. One of these is a stacked 3D bar chart that
displays properly unless it follows the display of a 3D pie chart.
In that case, the chart displays as 2D and the left axis scale does not
does align with the grid on the chart. The scale on the right axis does
align with the grid on the chart but the "0" position of both does not
align with the baseline of the chart.
I assume the problem is related to some property being set in the pie
chart that is not proper for the bar chart, but can't seem to find what it
is. The properties in TChart are the defaults unless set
programmatically.
PIE Chart
// Chart parameters
with Chart do
begin
Title.Text.Clear;
Title.Text.Add('Total Hits By Site For ' + ProductChoice +
' (' +
CommaizeL(TotalQty) +') on ' +
FormatdateTime('mmmm d, yyyy',Now));
Title.Font.Size := 12;
Title.Font.Style := [fsBold];
Legend.Visible := false;
Color := clWhite;
SeriesList.Clear;
AddSeries(TPieSeries.Create(Application));
View3D := true;
Chart3DPercent := 40; // change thickness of pie
end;
// Series parameters
with (Chart.Series[0] as TPieSeries) do
begin
Marks.Style := smsLabelValue; // show name and value
Marks.Callout.Arrow.Color := clBlack; // black lines on callout
Marks.Font.Size := 11; // callout font size
Dark3D := true; // darker color on slice edge
end;
Segments are added with:
(Chart.Series[0] as TPieSeries).Add(Qty, Name, Color);
BAR CHART
// title
Chart.Title.Text.Clear;
Chart.Title.Text.Add('Hits By Period For ' + SelSiteName + ' @' +
FormatdateTime('mmmm d, yyyy',Now));
Chart.Title.Font.Size := 12;
Chart.Title.Font.Style := [fsBold];
Chart.Legend.Font.Size := 10;
Chart.MaxPointsPerPage := 13;
Chart.Color := clWhite;
Chart.Chart3DPercent := 15; //default
Chart.View3D := true;
x := 0;
Chart.SeriesList.Clear;
while x <= high(Stats) do // Stats is dynamic array
begin
Chart.AddSeries(TBarSeries.Create(Application) );
Chart.Series[x].Title := Stats[x].Prod;
with (Chart.Series[x] as TBarSeries) do
begin
Multibar := mbStacked;
Chart.Legend.Visible := true;
VertAxis := aBothVertAxis;
Marks.Visible := false;
// set bar colors
if x <= High(BarColors) then
SeriesColor := BarColors[x];
end; // with
inc(x);
end;
// set axis
Chart.LeftAxis.Minimum := 0;
Chart.RightAxis.Minimum := 0;
Chart.LeftAxis.AutomaticMaximum := false;
High_Inc := 0;
Chart.LeftAxis.Maximum := High_Inc;
Chart.RightAxis.AutomaticMaximum := false;
Chart.RightAxis.Maximum := High_Inc;
// axis maximums and increment are calculated before the chart is
displayed
bars are added with:
Chart.Series[x].Value, s);
Any suggestions would be appreciated.
Regards,
Tom
I have one TChart component that is used for numerous charts that are
generated programmatically. One of these is a stacked 3D bar chart that
displays properly unless it follows the display of a 3D pie chart.
In that case, the chart displays as 2D and the left axis scale does not
does align with the grid on the chart. The scale on the right axis does
align with the grid on the chart but the "0" position of both does not
align with the baseline of the chart.
I assume the problem is related to some property being set in the pie
chart that is not proper for the bar chart, but can't seem to find what it
is. The properties in TChart are the defaults unless set
programmatically.
PIE Chart
// Chart parameters
with Chart do
begin
Title.Text.Clear;
Title.Text.Add('Total Hits By Site For ' + ProductChoice +
' (' +
CommaizeL(TotalQty) +') on ' +
FormatdateTime('mmmm d, yyyy',Now));
Title.Font.Size := 12;
Title.Font.Style := [fsBold];
Legend.Visible := false;
Color := clWhite;
SeriesList.Clear;
AddSeries(TPieSeries.Create(Application));
View3D := true;
Chart3DPercent := 40; // change thickness of pie
end;
// Series parameters
with (Chart.Series[0] as TPieSeries) do
begin
Marks.Style := smsLabelValue; // show name and value
Marks.Callout.Arrow.Color := clBlack; // black lines on callout
Marks.Font.Size := 11; // callout font size
Dark3D := true; // darker color on slice edge
end;
Segments are added with:
(Chart.Series[0] as TPieSeries).Add(Qty, Name, Color);
BAR CHART
// title
Chart.Title.Text.Clear;
Chart.Title.Text.Add('Hits By Period For ' + SelSiteName + ' @' +
FormatdateTime('mmmm d, yyyy',Now));
Chart.Title.Font.Size := 12;
Chart.Title.Font.Style := [fsBold];
Chart.Legend.Font.Size := 10;
Chart.MaxPointsPerPage := 13;
Chart.Color := clWhite;
Chart.Chart3DPercent := 15; //default
Chart.View3D := true;
x := 0;
Chart.SeriesList.Clear;
while x <= high(Stats) do // Stats is dynamic array
begin
Chart.AddSeries(TBarSeries.Create(Application) );
Chart.Series[x].Title := Stats[x].Prod;
with (Chart.Series[x] as TBarSeries) do
begin
Multibar := mbStacked;
Chart.Legend.Visible := true;
VertAxis := aBothVertAxis;
Marks.Visible := false;
// set bar colors
if x <= High(BarColors) then
SeriesColor := BarColors[x];
end; // with
inc(x);
end;
// set axis
Chart.LeftAxis.Minimum := 0;
Chart.RightAxis.Minimum := 0;
Chart.LeftAxis.AutomaticMaximum := false;
High_Inc := 0;
Chart.LeftAxis.Maximum := High_Inc;
Chart.RightAxis.AutomaticMaximum := false;
Chart.RightAxis.Maximum := High_Inc;
// axis maximums and increment are calculated before the chart is
displayed
bars are added with:
Chart.Series[x].Value, s);
Any suggestions would be appreciated.
Regards,
Tom