You've already forked lazarus-ccr
fpspreadsheet: Add basic infrastructure for chart support.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6742 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
65
components/fpspreadsheet/examples/chartdemo/chartdemo.lpi
Normal file
65
components/fpspreadsheet/examples/chartdemo/chartdemo.lpi
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="chartdemo"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0"/>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="laz_fpspreadsheet"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<Filename Value="chartdemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="chartdemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
44
components/fpspreadsheet/examples/chartdemo/chartdemo.lpr
Normal file
44
components/fpspreadsheet/examples/chartdemo/chartdemo.lpr
Normal file
@@ -0,0 +1,44 @@
|
||||
program chartdemo;
|
||||
|
||||
uses
|
||||
fpspreadsheet, fpsutils, fpstypes, fpschart;
|
||||
|
||||
var
|
||||
wb: TsWorkbook;
|
||||
sh: TsWorksheet;
|
||||
chart: TsChart;
|
||||
ser: TsChartSeries;
|
||||
idx: Integer;
|
||||
|
||||
begin
|
||||
wb := TsWorkbook.Create;
|
||||
try
|
||||
ws := wb.AddWorksheet('Test');
|
||||
// x values
|
||||
ws.WriteNumber(0, 0, 1.0);
|
||||
ws.WriteNumber(1, 0, 2.1);
|
||||
ws.WriteNumber(2, 0, 2.9);
|
||||
ws.WriteNumber(3, 0, 4.15);
|
||||
ws.WriteNumber(4, 0, 5.05);
|
||||
// y values
|
||||
ws.WriteNumber(0, 1, 10.0);
|
||||
ws.WriteNumber(1, 1, 12.0);
|
||||
ws.WriteNumber(2, 1, 9.0);
|
||||
ws.WriteNumber(3, 1, 7.5);
|
||||
ws.WriteNumber(4, 1, 11.2);
|
||||
|
||||
idx := ws.WriteChart(0, 0, 12, 9);
|
||||
chart := ws.GetChart(idx);
|
||||
ser := TsLineSeries.Create(chart);
|
||||
ser.XRange := Range(0, 0, 4, 0);
|
||||
ser.YRange := Range(0, 1, 4, 1);
|
||||
ser.Title := 'Scatter series';
|
||||
ser.ShowSymbols := true;
|
||||
ser.ShowLines := true;
|
||||
|
||||
chart.AddSeries(
|
||||
finally
|
||||
wb.Free;
|
||||
end;
|
||||
end.
|
||||
|
Reference in New Issue
Block a user