Hello,
I am adding a chart to the sheet with the following code and i have some questions.
with FSheet.AddChart do begin
Col1 := 5;
Row1 := FDataStartRow;
Col2 := FMaxCol-1;
Row2 := FRow;
//Chart has one default series
vSeries := Series[0];
with vSeries do begin
//Values := '111';
//Sheet1!$D$7:$D$18
Values := Format('''%s''!%s:%s',[GetSheetName, ColRowToRefStr(1,FDataStartRow,TRUE,TRUE), ColRowToRefStr(1,FRow-1,TRUE,TRUE)]);
Category := Format('''%s''!%s:%s',[GetSheetName, ColRowToRefStr(0,FDataStartRow,TRUE,TRUE), ColRowToRefStr(0,FRow-1,TRUE,TRUE)]);
SerieName := '"Data1"';
end;
vSeries := Series.Add;
with vSeries do begin
Values := Format('''%s''!%s:%s',['Summary', ColRowToRefStr(2,FDataStartRow,TRUE,TRUE), ColRowToRefStr(2,FRow-1,TRUE,TRUE)]);
SerieName := '"Data2"';
end;
with PlotArea do begin
ChartType := xctColumn;
TChartStyleBarColumn(ChartStyle).IsBar := FALSE;
ChartStyle.Legend.LegendType := cltTop;
ChartStyle.Legend.HasFrame := TRUE;
ChartStyle.Legend.Frame.LineFormat.Automatic := FALSE;
ChartStyle.Legend.Frame.LineFormat.LineStyle := clsNone;
Is3D := FALSE;
Frame.AreaFormat.Automatic := FALSE;
Frame.LineFormat.LineStyle := clsNone;
Frame.HasFillEffects := TRUE;
Frame.FillEffects.FillEffectGradient(xcWhite, xcWhite, gfsFromCorner);
with ValueAxis.ValueAxisScaling do begin
Options := Options + [vasoAutoMin, vasoAutoMax];
//MinValue := 0;
//MaxValue := FMaxCount;
end;
end;
vChartLabel := Labels.Add(cltTitle);
with vChartLabel do begin
Text := 'My title';
end;
end;
1. How do i set the font of the Title label and legend?
2. My legend is positioned on top of the chart, but seems like it is not aligned horizontally to center. How do i fix it?
3. How to set the colors of columns in data series?
4. How to change the font properties of x axies labels?
Thank you.
Adding chart with XLSReadWrite4
Re: Adding chart with XLSReadWrite4
Hello
The chart support in version 4 is very poor. What you are trying to do will just not work. Please take a look at the latest version (6) instead. It has much improved chart support.
The chart support in version 4 is very poor. What you are trying to do will just not work. Please take a look at the latest version (6) instead. It has much improved chart support.
Lars Arvidsson, Axolot Data