how to change am-pm to 24 hr

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
aonzuza
Newbie
Newbie
Posts: 11
Joined: Mon Jul 12, 2010 12:00 am

how to change am-pm to 24 hr

Post by aonzuza » Wed Feb 09, 2011 4:37 am

hi
i want to display Axes.Bottom from am-pm to 24 hrs. when i was zooming . How do I ?


Image

aonzuza
Newbie
Newbie
Posts: 11
Joined: Mon Jul 12, 2010 12:00 am

Re: how to change am-pm to 24 hr

Post by aonzuza » Wed Feb 09, 2011 4:53 am

i mean in normal state show only date and when zoom in one day show only time in 24 hour not am/pm...

aonzuza
Newbie
Newbie
Posts: 11
Joined: Mon Jul 12, 2010 12:00 am

Re: how to change am-pm to 24 hr

Post by aonzuza » Wed Feb 09, 2011 4:56 am

and show full date and time when mouse is over chart

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: how to change am-pm to 24 hr

Post by Sandra » Wed Feb 09, 2011 12:58 pm

Hello aonzuza,

I have made a simple code using Events Zoomed and UndoneZoom and I think you can do something similar as next:

Code: Select all

        private void InitializeChart()
        {  //var
            Random rnd = new Random();
            DateTime today = DateTime.Today;
            TimeSpan oneDay = TimeSpan.FromDays(1);
            //Initialize
            tChart1.Aspect.View3D = false;
            tChart1.Dock = DockStyle.Fill;
            Steema.TeeChart.Styles.FastLine series1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            Steema.TeeChart.Styles.FastLine series2 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            //Series Data
            series1.XValues.DateTime = true;
            series2.XValues.DateTime = true;
            for (int i = 1; i <= 5; ++i)
            {
                series1.Add(today, rnd.Next(100), Color.Red);
                series2.Add(today, rnd.Next(100), Color.Blue);
                today += oneDay;
            }
            //Axes
            tChart1.Zoomed += new EventHandler(tChart1_Zoomed);
            tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);
        }

        void tChart1_UndoneZoom(object sender, EventArgs e)
        {
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yyyy";
            tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneDay);
        }
       void tChart1_Zoomed(object sender, EventArgs e)
        {
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "HH:mm";
            tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.SixHours);
        }
Could you tell us if previous code works as you want?

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply