3D BarChart Problem after 3D PieChart Display

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
thahn
Newbie
Newbie
Posts: 9
Joined: Mon Aug 23, 2004 4:00 am
Location: Ambler, PA (USA)
Contact:

3D BarChart Problem after 3D PieChart Display

Post by thahn » 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

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Sep 30, 2004 7:39 am

Hi Tom,

yes, you must set the Orthogonal property to true before to draw the Bar Series :
Chart.Aspect.Orthogonal := true;

thahn
Newbie
Newbie
Posts: 9
Joined: Mon Aug 23, 2004 4:00 am
Location: Ambler, PA (USA)
Contact:

Post by thahn » Thu Sep 30, 2004 12:56 pm

The only proeprty that I can find with Orthogonal is:

Chart.View3DOptions.Orthogonal := true;

and that doesn't correct the problem. What am I missing?

Regards,
Tom

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Sep 30, 2004 3:33 pm

Hi Tom,
The only proeprty that I can find with Orthogonal is:

Chart.View3DOptions.Orthogonal := true;
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.
and that doesn't correct the problem. What am I missing?
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 ?

thahn
Newbie
Newbie
Posts: 9
Joined: Mon Aug 23, 2004 4:00 am
Location: Ambler, PA (USA)
Contact:

Post by thahn » Thu Sep 30, 2004 4:58 pm

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

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Oct 04, 2004 7:41 am

Hi Tom,
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?
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.

thahn
Newbie
Newbie
Posts: 9
Joined: Mon Aug 23, 2004 4:00 am
Location: Ambler, PA (USA)
Contact:

Post by thahn » Mon Oct 04, 2004 2:36 pm

It is not in 7.0 which I understood to be the production release. 7.01 is marked as beta. Is that incorrect?

Regards,
Tom

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Oct 04, 2004 3:20 pm

Hi.
Yes, you can find in the Help using "Aspect" in the Index, it's defined as a TView3DOptions ... is not in 7.0
True, 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
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).
Marjan Slatinek,
http://www.steema.com

Post Reply