sort by grouped month
sort by grouped month
I have a series grouped by month.
I want it to sorted correctly.
How?
I want it to sorted correctly.
How?
- Attachments
-
- ChartSort.zip
- (112.02 KiB) Downloaded 666 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: sort by grouped month
Hi jls,
If you go to the Series -> General tab how are series sorted? You should try sorting them by text. If the problem persists could you please attach a simple example project we can run "as-is" to reproduce the problem here?
Thanks in advance.
If you go to the Series -> General tab how are series sorted? You should try sorting them by text. If the problem persists could you please attach a simple example project we can run "as-is" to reproduce the problem here?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: sort by grouped month
here is a sample
- Attachments
-
- Project2.zip
- (102.45 KiB) Downloaded 673 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: sort by grouped month
Hi jls,
To achieve what you request you can change your datasource to use a dataset like this:
Which produces this chart:
Is that what you were looking for?
Thanks in advance.
To achieve what you request you can change your datasource to use a dataset like this:
Which produces this chart:
Is that what you were looking for?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: sort by grouped month
No
It should be grouped my month and sorted by month (dec2010,jan2011,feb2011....)
It can be more than one row in each month
Jørgen
It should be grouped my month and sorted by month (dec2010,jan2011,feb2011....)
It can be more than one row in each month
Jørgen
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: sort by grouped month
Hi Jørgen,
Ok, I see. We have done some modifications to DBChart.pas here that would let you achieve what you request. Since you are a source code customer you could try doing the modifications below to your code. If that's what you are looking for we will investigate further if those modifications can make into a production release.
Go to TCustomDBChart.RefreshDataSet method, at AddToSeries a nested method of another nested method(ProcessRecord), change this:
for this:
Also, in the same nested method (ProcessRecord) in TCustomDBChart.RefreshDataSet method, change:
to this:
Please let us know if that's what you are looking for.
Thanks in advance.
Ok, I see. We have done some modifications to DBChart.pas here that would let you achieve what you request. Since you are a source code customer you could try doing the modifications below to your code. If that's what you are looking for we will investigate further if those modifications can make into a production release.
Go to TCustomDBChart.RefreshDataSet method, at AddToSeries a nested method of another nested method(ProcessRecord), change this:
Code: Select all
ASeries.Add(tmpMand,tmpXLabel,tmpColor);
Code: Select all
if (GroupPrefix=dgNone) then
ASeries.Add(tmpMand,tmpXLabel,tmpColor)
else
ASeries.AddXY(tmpNotMand,tmpMand,tmpXLabel,tmpColor);
Code: Select all
if Assigned(tmpData) then
tmpNotMand:=TField(tmpData).AsFloat
// ADataSet.GetFieldData(TField(tmpData), @tmpNotMand) // v7 speed opt.
else
tmpNotMand:=0;
Code: Select all
if Assigned(tmpData) then
tmpNotMand:=TField(tmpData).AsFloat;
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: sort by grouped month
Better, but the x location of the bars is not correct.
It should not care about the date, just the month.
Jørgen
It should not care about the date, just the month.
Jørgen
- Attachments
-
- Untitled.png (53.11 KiB) Viewed 16501 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: sort by grouped month
Hi Jørgen,
With the code as it stands the bars are set at the location of the date of the last value in that month. We assume that you would prefer the bars to centre on that month. Is that correct?
Thanks in advance.
With the code as it stands the bars are set at the location of the date of the last value in that month. We assume that you would prefer the bars to centre on that month. Is that correct?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: sort by grouped month
Think it is tha same for me if it is first, midle or last day in the month, the problem is that it doesn't work like this for me. It uses the actual date. Take a look at the second image.
Jørgen
Jørgen
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: sort by grouped month
Hi Jørgen,
Yes, we have a new solution proposal. Besides the changes I posted here last week you should also make a change at TCustomDBChart.RefreshDataSet in DBChart.pas at its nested CalcXPos function. You'll need to do the following:
1. Add a Word variable called WeekNum.
2. Replace this code:
for this:
3. Finally add DateUtils at class' uses section.
Which produces this chart:
Is that what you expected? Notice there are some more DateTime grouping options now.
Yes, we have a new solution proposal. Besides the changes I posted here last week you should also make a change at TCustomDBChart.RefreshDataSet in DBChart.pas at its nested CalcXPos function. You'll need to do the following:
1. Add a Word variable called WeekNum.
2. Replace this code:
Code: Select all
dgWeek: result:=TeeStr(DateToWeek(tmpNotMand,Year))+'/'+TeeStr(Year);
dgWeekDay: result:={$IFDEF D15}FormatSettings.{$ENDIF}ShortDayNames[DayOfWeek(tmpNotMand)];
dgMonth: result:=FormatDateTime('MMM/yy',EncodeDate(Year,Month,1));
dgQuarter: result:=TeeStr(1+((Month-1) div 3))+'/'+TeeStr(Year); // 5.02
dgYear: result:=FormatDateTime('yyyy',EncodeDate(Year,1,1));
Code: Select all
dgWeek: begin
WeekNum := DateToWeek(tmpNotMand,Year);
result:=TeeStr(WeekNum)+'/'+TeeStr(Year);
tmpNotMand := EncodeDateWeek(Year,WeekNum,4);
end;
dgWeekDay: begin
result:={$IFDEF D15}FormatSettings.{$ENDIF}ShortDayNames[DayOfWeek(tmpNotMand)];
DecodeDateWeek(tmpNotMand,Year,WeekNum,Day);
tmpNotMand := Day;
end;
dgMonth: begin
result:=FormatDateTime('MM/yy',EncodeDate(Year,Month,1));
tmpNotMand := EncodeDate(Year,Month,15);
end;
dgQuarter: begin
result:=TeeStr(1+((Month-1) div 3))+'/'+TeeStr(Year); //5.02
tmpNotMand := EncodeDate(Year,((1+((Month-1) div 3)-1)*3)+2,1);
end;
dgYear: begin
result:=FormatDateTime('yyyy',EncodeDate(Year,1,1));
tmpNotMand := EncodeDate(Year,6,30);
end;
Which produces this chart:
Is that what you expected? Notice there are some more DateTime grouping options now.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: sort by grouped month
This is exactly what I want,
Thanks
Thanks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: sort by grouped month
Hi Jørgen,
Thanks for your feedback. We will include this in the next maintenance release then.
Thanks for your feedback. We will include this in the next maintenance release then.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |