Adding chart with XLSReadWrite4

Questions and answers on how to use XLSReadWriteII 3/4/5.

Adding chart with XLSReadWrite4

Postby egold2005 » Sun Nov 05, 2017 9:38 am


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';
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"';

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"';

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;

vChartLabel := Labels.Add(cltTitle);
with vChartLabel do begin
Text := 'My title';


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.
Posts: 4
Joined: Fri Nov 04, 2016 6:22 am

Re: Adding chart with XLSReadWrite4

Postby larsa » Tue Nov 07, 2017 11:38 am


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
Site Admin
Posts: 615
Joined: Mon Jun 27, 2005 9:30 pm

Return to XLSReadWriteII 3/4/5

Who is online

Users browsing this forum: No registered users and 1 guest