tchart and dbchartsource lazarus / 55-TAChart ---------------------------------------------------------------------- maryg · 2016-07-01 02:54 im developing a student performance program. the performance should appear on a bar chart. so im trying to connect the chart to the dbchart source but nothing appears on the chart when i compile it. i had a look at the db demo but i still dont see what im missing. any ideas please. ---------------------------------------------------------------------- fpcoder · 2016-07-01 06:33 My guess would be that the series has Active = False: Rightclick your chart -> choose Edit Series -> Click the BarSeries -> in Object Inspector, toggle Active to True. ---------------------------------------------------------------------- wp · 2016-07-01 07:44 Since there are too many possibilities of what may go wrong I'd ask you to upload a little demo which shows the issue (pas, lfm, lpi and lpr files only, no exe, no ppu please, all packed into a single zip). ---------------------------------------------------------------------- maryg · 2016-07-20 03:41 now when i click on the post button....     procedure Tfrmschool.btnpostClick(Sender: TObject);     begin     Chart1BarSeries1.ListSource.CopyFrom(DbChartSource1);     end; i get an 'editable chart source required error' ---------------------------------------------------------------------- wp · 2016-07-20 07:30 You must decide which datasource you use for the series, the DBChartSource or the built-in ListSource. The DBChartSource gets its data directly from the DB. Link it directly to the Source property of the series, but don't use the code you posted (ChartSeries.ListSource.CopyFrom(DBChartSource). This method makes sure that the series is always in sync with the DB and has the least memory consumption. But, if other visual controls (such as a DBGrid) are linked to the same dataset used by the DBChartSource then you may experience annoying effects because when the series iterates through the data points it moves the dataset pointerr, i.e. changes the content in the visual controls. To avoid this you can copy the data from the DBChartSource into the internal ListChartSource by using this CopyFrom code. This duplicates the data in the series, and you have to keep track of changes in the dataset in order to update the series. But now the series is decoupled from the dataset: if the series iterates through all data points the dataset is not affected. BUT: You must not assign the DBChartSource to the series' Source property. Please see the attached demo: If the radio button "Use DBChartSource" is selected the chart automatically updates after adding new data (Button "Add point"). But if you click "Find max" (where the series iterates through all its point to find the highest y value) you'll see a flicker of the scrollbar in the DBGrid because the grid scrolls along the the series. And if you select the topmost record in the grid before clicking "Find max" you find the last record highlighted afterwards. If the radio button "Use internal ListSource" is selected you must click "Update" to show new data added by the "Add point" button. But the "Find max" now leaves the DBGrid alone ---------------------------------------------------------------------- maryg · 2016-07-21 04:01 thanks