D 2009 Professional
How do I or where do I set the date format for the X Axis to be 'dd-mmm'
All else works great, thanks, Sean
Series1.XLabelsSource := 'Date';
dbChart1.Axes.Bottom.DateTimeFormat:='dd-mmm';
Series1.YValues.ValueSource := CBParameter1.Text;
Series2.YValues.ValueSource := CBParameter2.Text;
X Axis/Bottom Axis date format not what I want
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: X Axis/Bottom Axis date format not what I want
Hi Iceman,
Yes, DateTimeFormat is what you should use. You may be missing XValues.DateTime:=True, for example:
Yes, DateTimeFormat is what you should use. You may be missing XValues.DateTime:=True, for example:
Code: Select all
Series1.XValues.DateTime:=True;
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: X Axis/Bottom Axis date format not what I want
Hi, thanks for the advice but no change. It appears to use the system time despite setting the label format in code as you suggested. Any other ideas? Thanks, Sean
-----------------------------
TRY
Series1.ParentChart:=DBChart1;
Series1.DataSource:=qryDateSelectData;
Series2.ParentChart:=DBChart1;
Series2.DataSource:=qryDateSelectData;
dbChart1.Axes.Bottom.Items.Clear;
dbChart1.BottomAxis.Title.Caption := 'Date';
Series1.VertAxis := aLeftAxis;
//Series2.VertAxis := aLeftAxis;
Series2.VertAxis := aRightAxis;
dbChart1.Axes.Bottom.DateTimeFormat:='mmm-dd';
Series1.XLabelsSource := 'Date';
Series2.XLabelsSource := 'Date';
Series1.XValues.DateTime:=True;
Series2.XValues.DateTime:=True;
Series1.YValues.ValueSource := CBParameter1.Text;
Series2.YValues.ValueSource := CBParameter2.Text;
// scaling
dbChart1.LeftAxis.AutomaticMaximum := True;
dbChart1.LeftAxis.AutomaticMinimum := True;
dbChart1.RightAxis.AutomaticMaximum := True;
dbChart1.RightAxis.AutomaticMinimum := True;
//dbChart1.LeftAxis.Minimum := 0;
// prepare graph labeling
Series1.Title := CBParameter1.Text;
Series2.Title := CBParameter2.Text;;
dbChart1.LeftAxis.Title.Caption := CBParameter1.Text;;
dbChart1.RightAxis.Title.Caption := CBParameter2.Text;;
dbChart1.Legend.Visible := True;
dbChart1.Legend.Symbol.Visible := True;
Series1.Active := True;
Series2.Active := True;
dbChart1.SubTitle.Text.Clear;
dbChart1.Title.Text.Clear;
dbChart1.Title.Visible := True;
dbChart1.Title.Text.Add(CBParameter1.Text + ' vs. ' + CBParameter2.Text);
EXCEPT
-----------------------------
TRY
Series1.ParentChart:=DBChart1;
Series1.DataSource:=qryDateSelectData;
Series2.ParentChart:=DBChart1;
Series2.DataSource:=qryDateSelectData;
dbChart1.Axes.Bottom.Items.Clear;
dbChart1.BottomAxis.Title.Caption := 'Date';
Series1.VertAxis := aLeftAxis;
//Series2.VertAxis := aLeftAxis;
Series2.VertAxis := aRightAxis;
dbChart1.Axes.Bottom.DateTimeFormat:='mmm-dd';
Series1.XLabelsSource := 'Date';
Series2.XLabelsSource := 'Date';
Series1.XValues.DateTime:=True;
Series2.XValues.DateTime:=True;
Series1.YValues.ValueSource := CBParameter1.Text;
Series2.YValues.ValueSource := CBParameter2.Text;
// scaling
dbChart1.LeftAxis.AutomaticMaximum := True;
dbChart1.LeftAxis.AutomaticMinimum := True;
dbChart1.RightAxis.AutomaticMaximum := True;
dbChart1.RightAxis.AutomaticMinimum := True;
//dbChart1.LeftAxis.Minimum := 0;
// prepare graph labeling
Series1.Title := CBParameter1.Text;
Series2.Title := CBParameter2.Text;;
dbChart1.LeftAxis.Title.Caption := CBParameter1.Text;;
dbChart1.RightAxis.Title.Caption := CBParameter2.Text;;
dbChart1.Legend.Visible := True;
dbChart1.Legend.Symbol.Visible := True;
Series1.Active := True;
Series2.Active := True;
dbChart1.SubTitle.Text.Clear;
dbChart1.Title.Text.Clear;
dbChart1.Title.Visible := True;
dbChart1.Title.Text.Add(CBParameter1.Text + ' vs. ' + CBParameter2.Text);
EXCEPT
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: X Axis/Bottom Axis date format not what I want
Hi Iceman,
Calling dbChart1.Axes.Bottom.Items.Clear you remove all bottom axis labels. This should only be used if you are going to add custom labels manually after so I'd remove that line. Also, I see that you are assigning X labels from you datasource. Most likely those are text labels which are displayed by default in the bottom axis. To display X values instead of text labels you should do this:
Hope this helps!
Calling dbChart1.Axes.Bottom.Items.Clear you remove all bottom axis labels. This should only be used if you are going to add custom labels manually after so I'd remove that line. Also, I see that you are assigning X labels from you datasource. Most likely those are text labels which are displayed by default in the bottom axis. To display X values instead of text labels you should do this:
Code: Select all
DBChart1.Axes.Bottom.LabelStyle:=talValue;
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: X Axis/Bottom Axis date format not what I want
That worked perfectly, thanks for your time and great support, Sean