Display date time in browser locale timezone

Sep 3, 2013 at 2:10 PM
Hello,

I have a problem with a displaying data in chart. I have data from UTC+1, I debuging my code and data is good, but graf display data in UTC+0. I have a typical data format {DateTime, Value}.
And other functions play.
Do you have some tips?
.SetOptions(new GlobalOptions { Global = new Global { UseUTC = false } })
Coordinator
Oct 24, 2013 at 2:26 PM
Hi,

Here is one example which works with and without UTC:
DateTime now = DateTime.Now;
            List<object> points = new List<object>();
            Random rand = new Random();
            for (int i = -100; i <= 0; i++)
                points.Add(new { X = now.AddMinutes(i), Y = rand.NextDouble() });

            Highcharts chart = new Highcharts("chart")
                .SetOptions(new GlobalOptions { Global = new Global { UseUTC = false } })
                .SetXAxis(new XAxis { Type = AxisTypes.Datetime })
                .SetSeries(new Series { Data = new Data(points.ToArray()) });
            return View(chart);
Can you tell me is this works for you and is this helps you?

Regards,
Vangel
Nov 4, 2013 at 9:42 AM
Hi,

thanks for your reply and sorry for my late reply. I will in this week your solution.

My schoolmate help me to find solution.
            object[,] OutputData = new object[datas.Count(), 2];
            int i = 0;
            foreach (var data in datas)
            {
                OutputData[i, 0] =data.Time.ToLocalTime();
                OutputData[i, 1] =data.Value;
                i++;
            }
Marked as answer by Pmilan on 11/15/2013 at 7:16 AM
Nov 8, 2013 at 10:55 AM
Vangi wrote:
Hi,

Here is one example which works with and without UTC:
DateTime now = DateTime.Now;
            List<object> points = new List<object>();
            Random rand = new Random();
            for (int i = -100; i <= 0; i++)
                points.Add(new { X = now.AddMinutes(i), Y = rand.NextDouble() });

            Highcharts chart = new Highcharts("chart")
                .SetOptions(new GlobalOptions { Global = new Global { UseUTC = false } })
                .SetXAxis(new XAxis { Type = AxisTypes.Datetime })
                .SetSeries(new Series { Data = new Data(points.ToArray()) });
            return View(chart);
Can you tell me is this works for you and is this helps you?

Regards,
Vangel
Hello,

I tried your code. Graph draw data with UTC 0, but I in UTC +1.

Regards,
Milan
Nov 15, 2013 at 3:16 PM
Hello,

by my ask on (original) forum It is not better solution.
Marked as answer by Pmilan on 11/15/2013 at 7:16 AM
Jan 10, 2014 at 3:18 PM
Can you please provide an example of how to do this in VB?
Jan 10, 2014 at 7:41 PM
Edited Jan 10, 2014 at 7:43 PM
brad87 wrote:
Can you please provide an example of how to do this in VB?
What? Are you a coder? This solution is easy to convert to other language! There are not, too much difference between C# and VB.

Foreach and arrays is in VB, too.

If you still have problem, you should repeat work with VB. Or If you have problem with DotNet.Highcharts, you should moretimes look through sample.
Jan 13, 2014 at 3:31 PM
I would like to know how to form this line in VB, I am getting syntax errors and null pointer exceptions.
.SetOptions(new GlobalOptions { Global = new Global { UseUTC = false } })
Jan 13, 2014 at 3:46 PM
this also gives me a null reference exception, I would just like to know how to set utc to false

   Dim baselineChart As Highcharts = New Highcharts("BaselineChart")
        Dim goptions As New Helpers.GlobalOptions
        goptions.Global.UseUTC = False
        baselineChart.SetOptions(goptions)
Jan 14, 2014 at 8:59 PM
Please create a new thread for your issue. This one is about a different problem, and it is closed anyway.