ppDPTeeChart on ppReport ... how to control the colour of the bars in a bar series side stacked depe
Hi,
Using RB 12.04 build 77 RadStudio2010.
I have a ppDPTeeChart on a ppReport.
I have one BarSeries, side stacked 100% bar width. (This creates a stepped
area graph effect).
The X Axis values represent a date range.
The Y Axis an integer value.
I want to change the colour of the bars in the chart depending on the date
range.
ie:
Sept-Oct - Gradient Brown to Green from left to Right
Nov-March - Green
April-May - Gradient from Left to right Green to Brown
June-August - Brown
Where do I set this?
The only Events I can see exposed in the object inspector are:
OnDrawCommandClick
OnDrawCommandCreate
OnPrint
How would I get to the Series1AfterAdd event for instance, as I cannot see
how to expose it at design time to add code for the event, for the DBChart
on the ppReport.
I just cannot find the way to do it .. I will appreciate any help
Regards
Adrian
Using RB 12.04 build 77 RadStudio2010.
I have a ppDPTeeChart on a ppReport.
I have one BarSeries, side stacked 100% bar width. (This creates a stepped
area graph effect).
The X Axis values represent a date range.
The Y Axis an integer value.
I want to change the colour of the bars in the chart depending on the date
range.
ie:
Sept-Oct - Gradient Brown to Green from left to Right
Nov-March - Green
April-May - Gradient from Left to right Green to Brown
June-August - Brown
Where do I set this?
The only Events I can see exposed in the object inspector are:
OnDrawCommandClick
OnDrawCommandCreate
OnPrint
How would I get to the Series1AfterAdd event for instance, as I cannot see
how to expose it at design time to add code for the event, for the DBChart
on the ppReport.
I just cannot find the way to do it .. I will appreciate any help
Regards
Adrian
This discussion has been closed.
Comments
colour chosen.
procedure TFormPastureUtilise.ppDPTeeChart1Print(Sender: TObject);
var
i: Integer;
Year,Day,Month,DOW:Word;
begin
for i := 0 to ppDPTeeChart1.Chart.Series[0].XValues.Count - 1 do
begin
DecodeDate(ppDPTeeChart1.Chart.Series[0].XValue[i],Year,Month,Day);
Case Month of
9 .. 10: begin
ppDPTeeChart1.Chart.Series[0].Color := clLime;
end;
11 .. 12: begin
ppDPTeeChart1.Chart.Series[0].Color := clGreen;
end;
1 ..3: begin
ppDPTeeChart1.Chart.Series[0].Color := clGreen;
end;
4 .. 5: begin
ppDPTeeChart1.Chart.Series[0].Color := clWebWheat;
end;
6 .. 8: begin
ppDPTeeChart1.Chart.Series[0].Color := clWebBrown;
end;
End;
end;
end;
Is there a way to define a Colour for each X value, and not for the entire
series?
Regards
Adrian
The TppDBChart component in ReportBuilder is a simple wrapper around the
actual DBChart in Delphi (created by Steema). You can manually access
the underlying chart object using the TppDBChart.Chart property (as you
do below). From there you should have the ability to do anything you
can do in Delphi with the normal TeeChart components.
I am not entirely sure how to manually assign each bar color of a chart
however I would guess that you need to typecast the Chart.Series
property as a TBarSeries to gain access to the bar colors. I suggest
looking at the TeeChart help and/or contacting their support for more
information on their product.
On a side note, many of our customers first create their more advanced
charts in Delphi then export them as an image to ReportBuilder. This
removes the need of using the wrapper created by RB. Take a look at the
following article if you would like to do this.
http://www.digital-metaphors.com/rbWiki/RCL/Chart/How_To...Chart_As_Image
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com