DB Chart

BJLBJL Brussels, Belgium
edited 1:25PM in FastReport 3.0
Working with FR 3.14 and BCB6
In a bar chart having a DateTime X axis, the source being a Datetime field of a Query DataSet, I want to show the dates in the format ???yyyy??? (only years).
Setting BottomAxis.DateTimeFormat to yyyy is recognized by the designer. The query being not active, 0 is shown as 1899 which is the year of the date 0.
However, the chart displayed after preparation does not take the parameter into account and shows the dates according to the ShortDateFormat of the system.
I have tried to change the ShortDateFormat to ???yyyy??? before calling PrepareReport, but this does not solve the problem.
Even using OnBeforePrint does not work.
procedure Chart1OnBeforePrint(Sender: TfrxComponent);
begin
  Chart1.Chart.BottomAxis.DateTimeFormat := 'yyyy';
end;
This code does not solve the problem.
Any idea?
Thanks for helping.
BJL

Comments

  • edited 1:25PM
    Try to set your X value to
    FormatDateTime('yyyy', <db."fld">)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.