TsWorkbookChartSource info lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- fmolina · 2018-07-22 01:57 Hi all, Is there any place were to find info/tutorial/wiki/etc about use of TsWorkbookChartSource component? I can only find the announcement in the fp spreadsheet  1.6 version, recommending it, but nothing more. I am looking specially for how to add data series to plot. Thank you ---------------------------------------------------------------------- wp · 2018-07-23 08:35 There is no explicitly written documentation about this component. But if you know how to work with the visual FPSpreadsheet components (http ://wiki.lazarus.freepascal.org/FPSpreadsheet_tutorial:_Writing_a_mini_ spreadsheet_application) and with TAChart (http://wiki.lazarus.freepascal.org/TAChart_documentation, http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Getting_started plus more) you should be able to find your way with it. You can find a demo in the folder "examples/visual/fpschart/workbookchartsource" (note that this folder has been mis-named as "workbookchartsource-deprecated" which has been corrected now). How to add a series to a chart is more a question related to TAChart than to fpspreadsheet. Double-click on the chart, click on "+ Add" and select the new series type from the menu. Then add another TsWorkbookChartSource component and link it to the "Source" property of the new series. Link the "WorkbookSource" of the TsWorkbookChartSource component to the TsWorkbookComponent which gives access to the spreadsheet file loaded. In the WorkbookChartSource, enter the cell range addesses for the x and y data in Excel format (e.g. Sheet1!A1:A10) There were a couple of changes made recently. Therefore I recommend to use the svn trunk version of fprspreadsheet for this issue. The new version is able to display the chart at designtime once the spreadsheet file has been loaded by the WorkbookSource. ---------------------------------------------------------------------- fmolina · 2018-07-27 02:28 Hi, Thank you for the answer. Just to confirm (I mean here dynamically, not at design time): - A new series needs a corresponding new TsWorkbookChartSource, right? - The only way to specify the cell range is through an Excel like string? Not CellStartX, etc.? Thanks ---------------------------------------------------------------------- wp · 2018-07-27 08:00 Quote from: fmolina on July 27, 2018, 04:28:55 am- A new series needs a corresponding new TsWorkbookChartSource, right? Yes. Quote from: fmolina on July 27, 2018, 04:28:55 am- The only way to specify the cell range is through an Excel like string? Yes. Something like "A1:A10" or "Sheet2!A1:A10" - the latter version is preferred because is clearly shows from which sheet the data will be taken; the first version can be recommended only for single-sheet files. See the attached demo which assumes a designtime-created TChart and TsWorkbookSource, reads an xlsx file and creates a series for each of the worksheet y columns at runtime.