Recent

Author Topic: DB - TChart series - IBX - add data  (Read 512 times)

Nicole

  • Hero Member
  • *****
  • Posts: 970
DB - TChart series - IBX - add data
« on: August 27, 2022, 06:37:20 pm »
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

  • Hero Member
  • *****
  • Posts: 6162
Re: DB - TChart series - IBX - add data
« Reply #1 on: August 27, 2022, 06:55:58 pm »

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: DB - TChart series - IBX - add data
« Reply #2 on: August 27, 2022, 07:12:58 pm »
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

  • Hero Member
  • *****
  • Posts: 6162
Re: DB - TChart series - IBX - add data
« Reply #3 on: August 27, 2022, 07:36:56 pm »
With Steema (ok, it was expensive) I just clicked in the interface at design time something like:
myChart.series1:=myQuery;
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

Not, that I expect to get something open source and free, what is expensive in commercial use.
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

  • Hero Member
  • *****
  • Posts: 11910
Re: DB - TChart series - IBX - add data
« Reply #4 on: August 27, 2022, 07:39:05 pm »
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.

 

TinyPortal © 2005-2018