Page 1 of 1

X-Axis Time zone issue

Posted: Thu Apr 28, 2016 9:00 am
by 15677821
Hello,

We are facing problem with the x-axis date time increment value. When the x axes increment time value is less than or equal to 1 hour the time value same for all the time zones.

Below is the example code for the increment value(<=1 hour),

Code: Select all

var Chart1;
function draw() {
    Chart1 = new Tee.Chart("canvas");
    var series1, series2, series3;
    series1 = Chart1.addSeries(new Tee.Line());
    series2 = Chart1.addSeries(new Tee.Line());
    series3 = Chart1.addSeries(new Tee.Line());
    series1.title = "Descricao do teste 1";
    series2.title = "Descricao do teste 2";
    series3.title = "Descricao do teste 3";
    var startDate, tmp, values1, values2, values3;
    //startDate = new Date(2014,12,4,14,30,53);
    startDate = new Date(2000, 1, 1, 0, 0, 0);
    values1 = [0.54881, 0.42365, 0.96366, 0.56804, 0.02022, 0.97862, 0.11827, 0.52185, 0.45615];
    values2 = [0.59284, 0.62356, 0.27266, 0.39278, 0.36824, 0.47361, 0.72063, 0.10591, 0.21655];
    values3 = [0.71519, 0.64589, 0.38344, 0.92560, 0.83262, 0.79916, 0.63992, 0.41466, 0.56843];
    series1.data.values.length = values1.length;
    series2.data.values.length = values2.length;
    series3.data.values.length = values3.length;
    series1.data.values = values1;
    series2.data.values = values2;
    series3.data.values = values3;
    series1.data.x = new Array(values1.length);
    series2.data.x = new Array(values2.length);
    series3.data.x = new Array(values3.length);
    for (i = 0; i < values1.length; i++) {
        tmp = new Date(startDate.getTime() + i * 1800000);
        series1.data.x[i] = tmp;
        series2.data.x[i] = tmp;
        series3.data.x[i] = tmp;
    }
    Chart1.axes.bottom.labels.dateFormat = "shortTime";
    [b]Chart1.axes.bottom.increment = series1.data.x[1] - series1.data.x[0];[/b]
    Chart1.draw();
}
Please refer the attachment for the <= 1 hour output.

But, if the x axes increment time value is greater than 1 hour the x axis value is dynamically changing based on the time zones.

To check the time zone issue please use the below code for the increment and change the time zone in your system.
Chart1.axes.bottom.increment = series1.data.x[2] - series1.data.x[0];

Please refer the attachment for the x-axis time zone error.

Re: X-Axis Time zone issue

Posted: Thu Apr 28, 2016 9:02 am
by 15677821
Please refer the attachment for the time zone issue.

Re: X-Axis Time zone issue

Posted: Fri Apr 29, 2016 3:35 pm
by yeray
Hello,

If I understand it correctly, the problem is that when you change the timezone for your system, this changes the timezone for your browser and then the Date you create, without specifying a timezone, is created for the current timezone. So 12PM is always 12PM because you set and get it using the same timezone.
Try setting the dates with UTC timezone:
http://stackoverflow.com/questions/2083 ... javascript