Labels DateTimeFormat problem
Labels DateTimeFormat problem
Hi,
I have several series and the Axes.Bottom.Labels.DateTimeFormat is yyyy.MM.dd HH:mm:ss.
When I remove all series with Legend Checkboxes then the Bottom Axes Labels come to double.
I uploaded a sample application (WinformSample.zip).
Start the application and hide all series with clicking on the Checkboxes of the Legend.
Best regards,
Gabor Varga
P.S. This is a test application with several test functions.
I have several series and the Axes.Bottom.Labels.DateTimeFormat is yyyy.MM.dd HH:mm:ss.
When I remove all series with Legend Checkboxes then the Bottom Axes Labels come to double.
I uploaded a sample application (WinformSample.zip).
Start the application and hide all series with clicking on the Checkboxes of the Legend.
Best regards,
Gabor Varga
P.S. This is a test application with several test functions.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Gabor,
Thanks for the example.
The issue you reported happens when bottom axis label style is set to value:
I can think of 3 options to solve this:
1. Use ClickLegend event to check if there are visible series or not. If none of them are visible then make labels not visible:
2. Use ClickLegend event as in 1 but if no series is visible set label style to automatic:
3. Use GetAxisLabel or GetNextAxisLabel events to convert double labels to DateTime when no series is visible.
Thanks for the example.
The issue you reported happens when bottom axis label style is set to value:
Code: Select all
TChart1.Axes.Bottom.Labels.Style := Steema.TeeChart.AxisLabelStyle.Value;
1. Use ClickLegend event to check if there are visible series or not. If none of them are visible then make labels not visible:
Code: Select all
TChart1.Axes.Bottom.Labels.Visible := false;
Code: Select all
TChart1.Axes.Bottom.Labels.Style := Steema.TeeChart.AxisLabelStyle.Auto;
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 |
Hi,
Thanks for the quick reply.
If I would like to use GetNextAxisLabel event how can I change the text of the Label? I get the value (e.LabelValue) but I cannot change the text of the label.
When I write a GetAxisLabel event handler the GetNextAxisLabel event does not run.
I modified and uploaded the sample application. I inserted Debug.Write lines into the event handlers to show which event handler run.
Best regards,
Gabor Varga
Thanks for the quick reply.
If I would like to use GetNextAxisLabel event how can I change the text of the Label? I get the value (e.LabelValue) but I cannot change the text of the label.
When I write a GetAxisLabel event handler the GetNextAxisLabel event does not run.
I modified and uploaded the sample application. I inserted Debug.Write lines into the event handlers to show which event handler run.
Best regards,
Gabor Varga
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Gabor,
In that case you should GetAxisLabel event doing something like this:
If you wish to use GetNextAxisLabel event you should do something as shown here but DateTime values may only be displayed as you want when series are visible. Another option would be using custom labels and GetNextAxisLabel event.
In that case you should GetAxisLabel event doing something like this:
Code: Select all
procedure TWinForm.TChart1_GetAxisLabel(sender: System.Object; e: Steema.TeeChart.GetAxisLabelEventArgs);
var tmp: DateTime;
tmp2 : double;
begin
if ((sender = TChart1.Axes.Bottom) and (not TChart1[0].Active) and (not TChart1[1].Active)) then
begin
tmp2 := Convert.ToDouble(e.LabelText);
tmp := DateTime.FromOADate(tmp2);
e.LabelText := Convert.ToString(tmp);
end;
end;
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 |
Hi,
May I ask you to explain how can I do that?
I would like to show full date and time only at minimum and maximum. In the other case i want to show only the time.
How can I do that?
For example:
+<-----------------|--------------------|--------------------|------------------>+
2007.05.17___11:00________12:00________13:00____2007.05.17
10:00:00_______________________________________13:45:00
Best regards,
Gabor Varga
P.S. The underlines are just for keeping the distance between labels.
May I ask you to explain how can I do that?
I have another question regarding this topic:Another option would be using custom labels and GetNextAxisLabel event.
I would like to show full date and time only at minimum and maximum. In the other case i want to show only the time.
How can I do that?
For example:
+<-----------------|--------------------|--------------------|------------------>+
2007.05.17___11:00________12:00________13:00____2007.05.17
10:00:00_______________________________________13:45:00
Best regards,
Gabor Varga
P.S. The underlines are just for keeping the distance between labels.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Gabor,
Sorry, I meant that you could use custom labels as shown in the All Features\Welcome !\Axes\Labels\Custom labels example at the features demo. You'll find the features demo at TeeChart's program group. GetNextAxisLabel is more useful for doing some kind of processing with custom labels.May I ask you to explain how can I do that?
Quote:
Another option would be using custom labels and GetNextAxisLabel event.
You can achieve this in a very similar way to the example my colleague Christopher Ireland posted on this thread on 10th August 2006.I would like to show full date and time only at minimum and maximum. In the other case i want to show only the time.
How can I do that?
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 |
Hi,
I would like to have exactly the following: (same texts!)
+<-----------------|--------------------|--------------------|------------------>+
2007.05.17___11:00________12:00________13:00____2007.05.17
10:00:00_______________________________________13:45:00
Christopher sets once the DateTimeFormat:
That's why I think the axis labels will be the following:
2007.05.17 10:00:00
2007.05.17 11:00:00 etc.
I think this is not an acceptable method if you have time series data.
I think my original problem is a bug but it seems that you don't have the same opinion.
I think the one acceptable method is to be able to modify LabelText from GetNextAxisLabel event handler. In this case you are able to control _where_ to put Label and _what_ to show.
All other solutions (I think) are just workaround and patchwork.
Is any reason why is the LabelText unaccessible from GetNextAxisLabel event handler?
Best regards,
Gabor Varga
In this code I just see how to control where to put Label but it does not set the Label text.You can achieve this in a very similar way to the example my colleague Christopher Ireland posted on this thread on 10th August 2006.
I would like to have exactly the following: (same texts!)
+<-----------------|--------------------|--------------------|------------------>+
2007.05.17___11:00________12:00________13:00____2007.05.17
10:00:00_______________________________________13:45:00
Christopher sets once the DateTimeFormat:
Code: Select all
tChart1.Axes.Bottom.Labels.DateTimeFormat = "yyyy.MM.dd HH:mm:ss";
2007.05.17 10:00:00
2007.05.17 11:00:00 etc.
Sorry, I meant that you could use custom labels as shown in the All Features\Welcome !\Axes\Labels\Custom labels example at the features demo.
Code: Select all
(tChart1.Axes.Left.Labels.Items.Add(123,"Hello")).Font.Size=16;
I think my original problem is a bug but it seems that you don't have the same opinion.
I think the one acceptable method is to be able to modify LabelText from GetNextAxisLabel event handler. In this case you are able to control _where_ to put Label and _what_ to show.
All other solutions (I think) are just workaround and patchwork.
Is any reason why is the LabelText unaccessible from GetNextAxisLabel event handler?
Best regards,
Gabor Varga
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Gabor,
To achieve what you request I think the easiest way is using custom labels like this:
You may also be interested in checking GetNextAxisLabel and GetAxisLabel descriptions on TeeChart for .NET v2's help files.
Thanks in advance.
LabelText is created when newDate variable is created from parsing date variable.In this code I just see how to control where to put Label but it does not set the Label text.
To achieve what you request I think the easiest way is using custom labels like this:
Code: Select all
tChart1.Axes.Bottom.Labels.Items.Clear();
//Add first label
tChart1.Axes.Bottom.Labels.Items.Add(tChart1[0].MinXValue(), tChart1[0].Labels[0]);
//Add intermediate labels without time
for (int i = 1; i < tChart1[0].Count - 1; i++)
{
DateTime date = DateTime.FromOADate(tChart1[0].XValues[i]);
string dateLabel = date.Hour.ToString() + ":" + date.Minute.ToString();
tChart1.Axes.Bottom.Labels.Items.Add(tChart1[0].XValues[i], dateLabel);
}
//Add last label
tChart1.Axes.Bottom.Labels.Items.Add(tChart1[0].MaxXValue(), tChart1[0].Labels[tChart1[0].Count - 1]);
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 |
Hi,
Quote from TeeChart Programmers Guide / Steema.TeeChart.TChart.GetNextAxisLabel Event
Can you show me a method how can I do that?
Best regards,
Gabor Varga
P.S. I read the help but is not clear why is impossible to use GetNextAxisLabel and GetAxisLabel event at same time.
Quote from TeeChart Programmers Guide / Steema.TeeChart.TChart.GetNextAxisLabel Event
An GetNextAxisLabel event is used to define custom Axis Labels. Using this event you can customize Axis Labels positions and values.
So, I want to customize Axis Labels positions and values _and_ override the default Axis Labels text at the same time.You can use the TChart.GetAxisLabel event to override the default Axis Labels text with your preferred Axis Label string representation.
Can you show me a method how can I do that?
Best regards,
Gabor Varga
P.S. I read the help but is not clear why is impossible to use GetNextAxisLabel and GetAxisLabel event at same time.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Gabor,
In that case you may be interested in the suggestions made at this thread.
Please notice that it is a pretty long thread and several approaches are being discussed here so I'd suggest you to read the full thread.
Thanks in advance.
In that case you may be interested in the suggestions made at this thread.
Please notice that it is a pretty long thread and several approaches are being discussed here so I'd suggest you to read the full thread.
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 |