Difference between revisions of "TsWorksheetChartSource"

From Lazarus wiki
Jump to navigationJump to search
(New page: TsWorksheetChartSource is a charting component which is available in the source code of the FPSpreadsheet library. It is a chart data source component designed to work with the TChart ...)
 
Line 1: Line 1:
 
TsWorksheetChartSource is a charting component which is available in the source code of the [[FPSpreadsheet]] library. It is a chart data source component designed to work with the TChart component from the TAChartLazarusPkg package, which usually comes pre-installed with Lazarus.
 
TsWorksheetChartSource is a charting component which is available in the source code of the [[FPSpreadsheet]] library. It is a chart data source component designed to work with the TChart component from the TAChartLazarusPkg package, which usually comes pre-installed with Lazarus.
 +
 +
==Example==
 +
 +
A simple example is present in the fpspreadsheet svn, located at fpspreadsheet/examples/fpchart/fpchart.lpi
 +
 +
Please see the image bellow to see how the components are connected at design time. The TChart component can be edited by double-clicking. Then use the menus of the editor to add a new line serie and connect this line serie to our WorksheetChartSource by setting it's Source property.
 +
 +
[[Image:Fpschart_design.png]]
 +
 +
To load the data from the grid and into the chart a button was created with the following code:
 +
 +
<delphi>
 +
procedure TFPSChartForm.btnCreateGraphicClick(Sender: TObject);
 +
begin
 +
  FPSChartSource.LoadFromWorksheetGrid(WorksheetGrid);
 +
end;
 +
</delphi>
 +
 +
And finally we can see how this works nicely in a running application in the picture bellow:
 +
 +
[[Image:Fpschart_run.png]]

Revision as of 19:35, 1 May 2010

TsWorksheetChartSource is a charting component which is available in the source code of the FPSpreadsheet library. It is a chart data source component designed to work with the TChart component from the TAChartLazarusPkg package, which usually comes pre-installed with Lazarus.

Example

A simple example is present in the fpspreadsheet svn, located at fpspreadsheet/examples/fpchart/fpchart.lpi

Please see the image bellow to see how the components are connected at design time. The TChart component can be edited by double-clicking. Then use the menus of the editor to add a new line serie and connect this line serie to our WorksheetChartSource by setting it's Source property.

Fpschart design.png

To load the data from the grid and into the chart a button was created with the following code:

<delphi> procedure TFPSChartForm.btnCreateGraphicClick(Sender: TObject); begin

 FPSChartSource.LoadFromWorksheetGrid(WorksheetGrid);

end; </delphi>

And finally we can see how this works nicely in a running application in the picture bellow:

Fpschart run.png