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
3D BarChart Problem after 3D PieChart Display
Hi Tom,
yes, you must set the Orthogonal property to true before to draw the Bar Series :
Chart.Aspect.Orthogonal := true;
yes, you must set the Orthogonal property to true before to draw the Bar Series :
Chart.Aspect.Orthogonal := true;
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi Tom,
Yes, it does the same thing. This property has been changed in v7. You can still using the same (view3d.orthogonal) but using the v7 and above we suggest to use the new one.The only proeprty that I can find with Orthogonal is:
Chart.View3DOptions.Orthogonal := true;
In that case, could you please post an example into the steema.public.attachments newsgroup (news://www.berneda.com) with which I can reproduce "as is" the problem here ?and that doesn't correct the problem. What am I missing?
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi Josep,
It does solve the problem! I was setting the property too late; setting it before adding a series got it to work properly. Thanks for your help!
BTW, if I understand your comment, the codce yopu suggest should work in v7. It is not in the Help file nor does it compile as you have shown. What am I missing?
Regards,
Tom
It does solve the problem! I was setting the property too late; setting it before adding a series got it to work properly. Thanks for your help!
BTW, if I understand your comment, the codce yopu suggest should work in v7. It is not in the Help file nor does it compile as you have shown. What am I missing?
Regards,
Tom
Hi Tom,
Yes, you can find in the Help using "Aspect" in the Index, it's defined as a TView3DOptions. I've just test it here using the latest TeeChart Pro v7.01 with your code and works fine.BTW, if I understand your comment, the codce yopu suggest should work in v7. It is not in the Help file nor does it compile as you have shown. What am I missing?
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi.
The "beta" mark on 7.01 installer is primarily becuase of some untested "features" in the installer. The actual Teechart units included with this build are marked as 7.01 release candidate and can be safely used in your application(s).Yes, you can find in the Help using "Aspect" in the Index, it's defined as a TView3DOptions ... is not in 7.0True, but the Aspect is only an alias for old property/class so if you're using 7.00, then View3DOptions.Orthogonal should do the same thing.
7.01 is marked as beta
Marjan Slatinek,
http://www.steema.com
http://www.steema.com