time format for botom axis
time format for botom axis
Hello, i'm making a real time chart, and i want to make botom axis in special time format, but it must be not like standart DateTime type, it must ne like "HH:MM:SS" where amount of hours may be more than 24( so the ticks are like time range passed from begining of charting ) is there any way how to implement it?
Re: time format for botom axis
And one more question. i'm in the previous situation, and now i use ovveride add method to add values to the line.
where pair is similar c++ Pair<>. Here Add gets DateTime as X-value and double as Y. There is some conversion from datetime to double, i want know about. I want to scroll bottom axis for some defined value by code dependency on condition( as you can see now ScroolAxis function, that is commented now), but for this i need to know how converting DateTime to double is going on( in TeeChart )? later i will need the reverse conversion( from double to DateTime), but it's not so hard to find it, if you know direct one.
Code: Select all
public void AddRange(List<Pair<double, double>> addingRange)
{
for (int i = 0; i < addingRange.Count; ++i)
{
DateTime tick = new DateTime(1, 1, 1, (int)addingRange[i].First / 3600, ((int)addingRange[i].First % 3600) / 60, (int)addingRange[i].First % 60);
m_plot.Add(tick, addingRange[i].Second);
}
//ScrollAxis();
}
Re: time format for botom axis
Hello Petr,
I hope will helps.
Thanks,
You can change the DateTimeFormat of Axes as do in next line of code:Hello, i'm making a real time chart, and i want to make botom axis in special time format, but it must be not like standart DateTime type, it must ne like "HH:MM:SS" where amount of hours may be more than 24( so the ticks are like time range passed from begining of charting ) is there any way how to implement it?
Code: Select all
tChart1.Axes.Bottom.Labels.DateTimeFormat = "HH:MM:SS";
I am not sure, but should be similar functions as C# DateTime.FromOADate to Convert Double to DateTime and ToOADate Converts a DateTime To Double, in C++....where pair is similar c++ Pair<>. Here Add gets DateTime as X-value and double as Y. There is some conversion from datetime to double, i want know about. I want to scroll bottom axis for some defined value by code dependency on condition( as you can see now ScroolAxis function, that is commented now), but for this i need to know how converting DateTime to double is going on( in TeeChart )? later i will need the reverse conversion( from double to DateTime), but it's not so hard to find it, if you know direct one.
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / 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: time format for botom axis
Hi Sandra, Thanks for your response! I've made a small investigation and found that 1 second is equal to 0.00001157407 double value in TeeChart Implementation, so, after that it was not so hard convert DateTime to double and back. Now i wonder how can i change value format of labels ( it seems to me that i need to change culture). As you can in the codew below i'm filling it with the values starts from 1 january 1 a.d., and hors minutes ans seconds starts from 0h 0m 0s
[code
for (int i = 0; i < newPlot.Count; ++i)
{
DateTime tick = new DateTime(1, 1, 1, (int)newPlot.First / 3600, ((int)newPlot.First % 3600) / 60 , (int)newPlot.First % 60);
m_plot.Add(tick, newPlot.Second);
}
][/code]
I use Label format "hh:mm:ss", as you recomended me. But it's shown on the plot as for example 12:11:37. I need it ti be shiwn as 00:11:37, how can i switch format(culture) to the value i need?
[code
for (int i = 0; i < newPlot.Count; ++i)
{
DateTime tick = new DateTime(1, 1, 1, (int)newPlot.First / 3600, ((int)newPlot.First % 3600) / 60 , (int)newPlot.First % 60);
m_plot.Add(tick, newPlot.Second);
}
][/code]
I use Label format "hh:mm:ss", as you recomended me. But it's shown on the plot as for example 12:11:37. I need it ti be shiwn as 00:11:37, how can i switch format(culture) to the value i need?
Re: time format for botom axis
Hello Petr,
If you want DateTime format appears in 24 hours format, you must define the hours, minutes and seconds in upper case letters as I do in next line:
Thanks,
If you want DateTime format appears in 24 hours format, you must define the hours, minutes and seconds in upper case letters as I do in next line:
Code: Select all
HH:MM:SS
Best Regards,
Sandra Pazos / 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: time format for botom axis
Thanks, but that didn't work properly, the value were shown as "00:12:SS". It turned to be that proper format is "HH:mm:ss".
Re: time format for botom axis
Hello Petr,
I have made a mistake, you are right, sorry I forgot that when you work with time format, you must use lower case letters for minutes and seconds. I recommend you taking a look in this link where you find the all DateTime formats you can use.
Thanks,
I have made a mistake, you are right, sorry I forgot that when you work with time format, you must use lower case letters for minutes and seconds. I recommend you taking a look in this link where you find the all DateTime formats you can use.
Thanks,
Best Regards,
Sandra Pazos / 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 |