Dynamic chart on every page
I have a report that traverses a list similar to this:
Cost Center1 - Account1 - Budget Amt - Expense Amt
Cost Center1 - Account2 - Budget Amt - Expense Amt
Cost Center1 - Account3 - Budget Amt - Expense Amt
Cost Center2 - Account1 - Budget Amt - Expense Amt
Cost Center2 - Account2 - Budget Amt - Expense Amt
Cost Center3 - Account1 - Budget Amt - Expense Amt
Cost Center4 - Account2 - Budget Amt - Expense Amt
So I want to print each cost center in its own page, with its own chart.
Doing this with a ppDPChart is fairly simple, *BUT* the problem is that I
must annotate the chart values based on certain conditions. So for example,
I must change the color a bar if the expense amount is greater than some
value, or change the Mark for the point if the value meets another
condition.
I tried to create a ppTeeChart (no data-aware) and tried to create each
group's chart before it is printed. But I get a single chart with lots of
values that belong to all the cost centers.
I'm doing something like this:
procedure TForm1.ppGroupHeaderBand1BeforePrint(Sender: TObject);
begin
ppTeeChart1.Chart.SeriesList.Clear;
ppTeeChart2.Chart.SeriesList.Clear;
Top10(qryTop10, ppTeeChart1.Chart); // This procedure just creates a
series in the chart and adds all the points
xBarChart(qryBars, ppTeeChart2.Chart); // This procedure just creates a
series in the chart and adds all the points
end;
Any help is greatly appreciated.
Cost Center1 - Account1 - Budget Amt - Expense Amt
Cost Center1 - Account2 - Budget Amt - Expense Amt
Cost Center1 - Account3 - Budget Amt - Expense Amt
Cost Center2 - Account1 - Budget Amt - Expense Amt
Cost Center2 - Account2 - Budget Amt - Expense Amt
Cost Center3 - Account1 - Budget Amt - Expense Amt
Cost Center4 - Account2 - Budget Amt - Expense Amt
So I want to print each cost center in its own page, with its own chart.
Doing this with a ppDPChart is fairly simple, *BUT* the problem is that I
must annotate the chart values based on certain conditions. So for example,
I must change the color a bar if the expense amount is greater than some
value, or change the Mark for the point if the value meets another
condition.
I tried to create a ppTeeChart (no data-aware) and tried to create each
group's chart before it is printed. But I get a single chart with lots of
values that belong to all the cost centers.
I'm doing something like this:
procedure TForm1.ppGroupHeaderBand1BeforePrint(Sender: TObject);
begin
ppTeeChart1.Chart.SeriesList.Clear;
ppTeeChart2.Chart.SeriesList.Clear;
Top10(qryTop10, ppTeeChart1.Chart); // This procedure just creates a
series in the chart and adds all the points
xBarChart(qryBars, ppTeeChart2.Chart); // This procedure just creates a
series in the chart and adds all the points
end;
Any help is greatly appreciated.
This discussion has been closed.
Comments
I've used a TppImage and use its OnPrint evnet for this. Then I create the
chart via code. This has worked very well for me. (If the OnGetImage event
of a TppCustomDataPipeline decendent had the image, or just the TRect of the
image, you could use this, but the size is not available).
Ed Dressel
Team DM