Forum > Databases

DB - TChart series - IBX - add data

(1/1)

Nicole:
Is there a component in Lazarus, which allows to connect a chart series directly to an IBquery?
TChart Pro of Steema would be able to do it, but is not open source.

If it is not possible, it would not be too hard to write a query which adds its values to a series.
Nevertheless it may be a work of one or two hours (at least to me).

Is there anything prefab?

rvk:
Something like this?

https://wiki.freepascal.org/TAChart

Nicole:
Absolutely!
It is on my list and there is a link to the demo which is brought us by Lazaraus already.
Thank you for the tutorial-link, I did not find it up to now.

What I wonder:
How to connect it to a DB?
With Steema (ok, it was expensive) I just clicked in the interface at design time something like:
myChart.series1:=myQuery;
done.

Not, that I expect to get something open source and free, what is expensive in commercial use.
I just wanted to know, how to do it at all.

rvk:

--- Quote from: Nicole on August 27, 2022, 07:12:58 pm ---With Steema (ok, it was expensive) I just clicked in the interface at design time something like:
myChart.series1:=myQuery;
--- End quote ---
I don't work with TAChart but I can see there is a TDbChartSource to which you can connect a TDataSource.
I guess that's the 'opening' of the database connection to the other Chart components.

Maybe someone can point you to a tutorial especially for the data-awareness of tachart.

BTW there is a special sub-forum for TAChart:
https://forum.lazarus.freepascal.org/index.php/board,55.0.html


--- Quote from: Nicole on August 27, 2022, 07:12:58 pm ---Not, that I expect to get something open source and free, what is expensive in commercial use.

--- End quote ---
Well, you already seen Firebird (no cost), IBX (no cost) and TvPlanit (no cost) and the quality these have.
So are you really surprised if there was also a component for Chart at no cost?  :D

wp:
There is no tutorial for this specific task, but there are two demos in the TAChart folder of your Lazarus installation (components/tachart/demo/db and components/tachart/demo/db-pieseries). The basic idea is as follows:

- Drop a TChart on the form
- Add a series to the chart (Double-click on the chart to open series editor, click '+ Add' and select the series type).
- Drop a TDBChartSource on the form. Set its Datasource property to the Datasource to which your dataset is connected.
- In the FieldX property specify the field to be used for x, and in FieldY specify the field to be used for y.
- Set the date/time Options if the x or y fields contain date/time data, and specify the DateTimeFormat to be used.
- Link the DBChartSource to the Source property of the series.

However, getting the values from the database this way is very inefficient internally, and it is highly recommended to copy the DBChartSource to a ListChartSource and link this to the series for plotting rather than the DBChartSource.

Navigation

[0] Message Index

Go to full version