Code: Select all
sheet.Charts.Add(sheet.Index);
If tried to set the label frequency with:
Code: Select all
chart.PlotArea.SerieAxis.CatSerAxisScaling.LabelsFrequency := 1;
how can I set the labelfrequency and orientation of the chart?
Code: Select all
sheet.Charts.Add(sheet.Index);
Code: Select all
chart.PlotArea.SerieAxis.CatSerAxisScaling.LabelsFrequency := 1;
Code: Select all
procedure CreateSample;
var
xls: TXLSReadWriteII4;
I: Integer;
chart : TDrwChart;
begin
xls := TXLSReadWriteII4.Create(nil);
try
xls.FileName := 'test.xls';
xls.Sheets.Add().Name := 'data';
for I := 0 to 99 do begin
xls.sheet[1].AsString[0,I] := 'Value' + IntToStr(I);
xls.Sheet[1].AsInteger[1,I] := Random(100);
end;
xls.sheet[0].Charts.Clear;
chart := xls.sheet[0].Charts.Add(0);
chart.Row1 := 6;
chart.Row2 := 30;
chart.Col1 := 0;
chart.Col2 := 12;
chart.series.Items[0].Values := '''data''!B1:B100';
chart.PlotArea.ValueAxis.ValueAxisScaling.MinValue := 0;
chart.PlotArea.ValueAxis.ValueAxisScaling.MaxValue := 100;
chart.PlotArea.ValueAxis.ValueAxisScaling.MajorInc := 10;
chart.series.Items[0].Category := '''data''!A1:A100';
chart.PlotArea.ValueAxis.Tick.MajorTick := ttOutside;
chart.PlotArea.ValueAxis.Tick.MinorTick := ttInvisible;
chart.PlotArea.HasLegend := false;
chart.PlotArea.CategoryAxis.CatSerAxisScaling.LabelsFrequency := 1;
xls.Write;
finally
xls.Free;
end;
end;