I have multiple Memtables fetched from Database. Each of which contains records for one year.
I have added series to the DBChart with those memtables as Datasource (Summary grouped by Quarter).
Now i have the problem that the values for the different years are grouped by year. I would like to have for each quarter of all years next to each other. So that for example a comparison of Quarter 1 of 2020 and 2021 is possible. (Those to Quarters next to each other in a Bar Series)
Is there a way to do this?
Thanks in advance for the help
Max
Compare Quarters of year in Summary
Re: Compare Quarters of year in Summary
Hello,
If I understand your situation, you probably have something like this:
In that case, you should be able to create auxiliar memTables for each year and show them instead of the original tables.
If I understand your situation, you probably have something like this:
Code: Select all
uses DBChart, Series, DateUtils;
var Chart1: TDBChart;
memTables: array of TFDMemTable;
procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
val: Integer;
date: TDateTime;
begin
Chart1:=TDBChart.Create(Self);
Chart1.Parent:=Self;
Chart1.Align:=alClient;
Chart1.View3D:=False;
Chart1.Gradient.Visible:=False;
Chart1.Color:=clWhite;
Chart1.Walls.Back.Gradient.Visible:=False;
Chart1.Walls.Back.Color:=clWhite;
SetLength(memTables, 2);
for i:=0 to Length(memTables)-1 do
begin
memTables[i]:=TFDMemTable.Create(Self);
memTables[i].FieldDefs.Add('Date', ftDateTime);
memTables[i].FieldDefs.Add('Price', ftInteger);
memTables[i].CreateDataSet;
memTables[i].Open;
val:=2000+Random(500);
date:=StrToDateTime('01/01/2018');
for j:=0 to (365*4)-1 do
begin
memTables[i].AppendRecord([date, val]);
date:=IncDay(date);
val:=val+Round(Random(10)-4.5);
end;
with Chart1.AddSeries(TBarSeries) do
begin
Marks.Hide;
DataSource:=memTables[i];
YValues.ValueSource:='#AVG#Price';
XLabelsSource:='#QUARTER#Date';
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |