Reputation: 965
I know - Delphi 7 is prehistoric and tChart is not the best. But I must use them, so...
I can change the type of the series at run-time with
var cs: tChartSeries;
begin
cs := chart.Series[0];
ChangeSeriesType(cs, TBarSeries);
end;
And I discovered most of them: tLineSeries, tBarSeries, tAreaSeries, tPointSeries,...
Unfortunately, I cannot find how to set it to Bar/Pyramids and Bar/Cylinders. If I try to create them at run-time, I see that the wizard calls them "Style", but if I try
chart.series[0].Style := …
that property (of type tChartSeriesStyles) refers to different things. Just for future references and because it was hard to find:
TChartSeriesStyle = set of ( tssIsTemplate,
tssDenyChangeType,
tssDenyDelete,
tssDenyClone,
tssIsPersistent,
tssHideDataSource );
So, the question is: how can I change, at run-time, a Delphi 7 tChart serie to "pyramid" and "cylinder"?
Thank you
Upvotes: 1
Views: 743
Reputation: 965
You need to "cast" that serie to a tBarSeries and THEN you can change the value. Example:
(c.series[0] as tBarSeries).BarStyle := bsPyramid;
(c.series[1] as tBarSeries).BarStyle := bsCilinder;
Since it looks like it's not documented anywhere, simply type "bs" and press CTRL-SPACE to see all the possible values.
Upvotes: 0
Reputation: 7289
In Delphi 10.3 setting up a pyramid styled bar chart manually in the IDE and viewing the DFM as text gets a section like:
object Chart1: TChart
Left = 224
Top = 136
Width = 400
Height = 250
Title.Text.Strings = (
'TChart')
TabOrder = 0
DefaultCanvas = 'TGDIPlusCanvas'
ColorPaletteIndex = 13
object Series2: TBarSeries
BarStyle = bsPyramid
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Bar'
YValues.Order = loNone
end
end
Can try doing the same in Delphi 7 and see what properties get set to what values.
In Delphi 10.3 in code it ends up like (assuming Series2 is a TBarSeries):
Series2.BarStyle := bsPyramid;
Upvotes: 1