Page 1 of 1
TDBChart Save design and load back?
Posted: Mon Jan 18, 2021 4:13 am
by 16587864
Working on a user configurable "dashboard" system. Idea is to allow them to design their query, run it, then design a TDBChart
to hook into that and design their chart. Also I have it so they can design a grid view design and some other stuff for this "dashboard" system.
I have VCLTee.TeeEditPro, VCLTee.Teestore in the uses.
Delphi 10.3.2 with TeeChart v2020.31.201112 PRO edition
I tried to save to XML first. Which was nice as pretty easy to read with vcltee.TeeStore.SaveChartToFile
but there is no version of this to LOAD from xml.
vcltee.Teestore.LoadChartFromFile only exists, and this does only .TEE files.
So.. I switched to trying to load the .TEE file.
So in this case after it is saved I clear or close program.
I open it back up and run my query.
Then I load my saved off .TEE file. Which generates no error.
But I have nothing in my TChart. The series is there, but the Data side of things did not apply.
I have to bring up the TChart editor and I see my series is back but when I goto the data tab nothing is applied back.
I don't want to save the data. I just want to save the whole design of the TDBChart after a user configures it up against a query they run.
Then bring it backup later from a saved file.
Any ideas?
Re: TDBChart Save design and load back?
Posted: Mon Jan 18, 2021 5:13 am
by 16587864
I kinda got this to work via something like this
Code: Select all
procedure TForm8.Button3Click(Sender: TObject);
begin
VclTee.Teestore.LoadChartFromFile(DBChart1, 'gadget1.tee');
if DBChart1.SeriesCount = 1 then
DBChart1.Series[0].DataSource := q_Gadget; /// <--- TADOQuery object, once assigned, boom it works.
end;
Once I assign the series datasource manually after loading the .TEE file, then it works.
Looking at the .TEE file created, the datasource there does exist, with q_Gadget as its value to point to.
Bug or am I missing something?
Code: Select all
object TDBChart
Left = 1
Top = 1
Width = 478
Height = 287
BackWall.Brush.Gradient.Direction = gdBottomTop
BackWall.Brush.Gradient.EndColor = clWhite
BackWall.Brush.Gradient.StartColor = 15395562
BackWall.Brush.Gradient.Visible = True
BackWall.Transparent = False
Foot.Font.Color = clBlue
Foot.Font.Name = 'Verdana'
Gradient.Direction = gdBottomTop
Gradient.EndColor = clWhite
Gradient.MidColor = 15395562
Gradient.StartColor = 15395562
Gradient.Visible = True
LeftWall.Color = 14745599
RightWall.Color = 14745599
Title.Font.Name = 'Verdana'
Title.Text.Strings = (
'TDBChart')
BottomAxis.Axis.Color = 4210752
BottomAxis.Grid.Color = 11119017
BottomAxis.LabelsFormat.Font.Name = 'Verdana'
BottomAxis.TicksInner.Color = 11119017
BottomAxis.Title.Font.Name = 'Verdana'
DepthAxis.Axis.Color = 4210752
DepthAxis.Grid.Color = 11119017
DepthAxis.LabelsFormat.Font.Name = 'Verdana'
DepthAxis.TicksInner.Color = 11119017
DepthAxis.Title.Font.Name = 'Verdana'
DepthTopAxis.Axis.Color = 4210752
DepthTopAxis.Grid.Color = 11119017
DepthTopAxis.LabelsFormat.Font.Name = 'Verdana'
DepthTopAxis.TicksInner.Color = 11119017
DepthTopAxis.Title.Font.Name = 'Verdana'
LeftAxis.Axis.Color = 4210752
LeftAxis.Grid.Color = 11119017
LeftAxis.LabelsFormat.Font.Name = 'Verdana'
LeftAxis.TicksInner.Color = 11119017
LeftAxis.Title.Font.Name = 'Verdana'
Legend.Font.Name = 'Verdana'
Legend.Shadow.Transparency = 0
RightAxis.Axis.Color = 4210752
RightAxis.Grid.Color = 11119017
RightAxis.LabelsFormat.Font.Name = 'Verdana'
RightAxis.TicksInner.Color = 11119017
RightAxis.Title.Font.Name = 'Verdana'
TopAxis.Axis.Color = 4210752
TopAxis.Grid.Color = 11119017
TopAxis.LabelsFormat.Font.Name = 'Verdana'
TopAxis.TicksInner.Color = 11119017
TopAxis.Title.Font.Name = 'Verdana'
Align = alClient
TabOrder = 0
OnDblClick = DBChart1DblClick
DefaultCanvas = 'TGDIPlusCanvas'
ColorPaletteIndex = 13
object Series1: TBarSeries
HoverElement = []
ColorEachPoint = True
DataSource = q_Gadget
XLabelsSource = 'SalesPerson'
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Bar'
YValues.Order = loNone
YValues.ValueSource = 'TotalSold'
end
end
Re: TDBChart Save design and load back?
Posted: Mon Jan 18, 2021 10:48 am
by yeray
Hello,
C-P wrote: ↑Mon Jan 18, 2021 4:13 am
there is no version of this to LOAD from xml.
Indeed, that's already in the public tracker
#2390.
C-P wrote: ↑Mon Jan 18, 2021 5:13 am
Once I assign the series datasource manually after loading the .TEE file, then it works.
That was also identified time ago here
#185.
Re: TDBChart Save design and load back?
Posted: Mon Jan 18, 2021 1:58 pm
by 16587864
Yeray wrote: ↑Mon Jan 18, 2021 10:48 am
Hello,
C-P wrote: ↑Mon Jan 18, 2021 4:13 am
there is no version of this to LOAD from xml.
Indeed, that's already in the public tracker
#2390.
C-P wrote: ↑Mon Jan 18, 2021 5:13 am
Once I assign the series datasource manually after loading the .TEE file, then it works.
That was also identified time ago here
#185.
Oof ok... So the XML report is pretty new. 2020-12-04.
The other one for the dataset issue was reported in 2010-03-19.
Well hopefully my work around for this for now will get me by.