Page 1 of 1
Chart series color
Posted: Tue Oct 02, 2018 8:45 am
by Noemie23
Dear All,
Is is possible to manage the color of each bar of a Excel Bart Chart created with "MakeBarChart"?
Thank you for your answer
NoƩmie
Re: Chart series color
Posted: Wed Oct 03, 2018 8:55 am
by larsa
Hello
Here is a sample. You can add this to the end of MakeChart in the CreateChartsSample sample.
Code: Select all
var
Props : TXLSDrwShapeProperies;
DTp : TCT_DPt;
begin
ChartSpace.Chart.PlotArea.BarChart.Shared.Series[0].Create_DPtXpgList;
for i := 0 to sgData.RowCount - 1 do begin
Props := TXLSDrwShapeProperies.Create(DTp.Create_SpPr);
try
DTp := ChartSpace.Chart.PlotArea.BarChart.Shared.Series[0].DPtXpgList.Add;
DTp.Create_Idx;
DTp.Idx.Val := i;
Props.Fill.FillType := xdftSolid;
Props.Fill.AsSolid.Color.AsRGB := RGB(Random(256),Random(256),Random(256));;
finally
Props.Free;
end;
end;
end;