[visualization-api] Why date values are repeated on horizontal axis in Webkit browsers?

2014-10-03 Thread Василий Топоров
Hello.

I've got a problem with Line Chart.

On this page http://www.metrtv.ru/price_dynamics we have charts of changing 
price on real estate (hAxis - date, vAxis - price). This values are taken 
by jquery ajax from pre-generated json files (one file for one chart).

On windows machines in webkit-based browsers (Chrome, Yandex browser) I see 
2013 two times (see the screenshot). In Firefox and Explorer they looks 
well as well as Chrome on Linux. How could I fix this issue?

https://lh5.googleusercontent.com/-jdipwuI4n8w/VC6kcPMidCI/ALI/GNdiLIcuQYM/s1600/dyn.jpg



Js-code for charts:

google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(function(){

$charts = $('.b-charts__item__chart');
if ($charts.size()) {

$charts.each(function(){
var $el = this;
$.ajax({
url: $($el).attr('rel') + '?' + (Math.floor(Math.random() * 
( - 1000 + 1)) + 1000),
data: '',
success: function(jsonData){
var $chartData = [];
$.each(jsonData, function(i, row){
$chartData.push([new Date(row[0]), row[1]]);
});
var data = new google.visualization.DataTable();
data.addColumn('date', 'Дата'); // Date
data.addColumn('number', 'Средняя цена'); // Average price
data.addRows($chartData);
var options = {
'height':240,
'chartArea':{left:70,top:20,width:80%,height:200},
'legend':'none'
};
var chart = new google.visualization.LineChart($el);
chart.draw(data, options);
},
dataType: 'json'
});

});
}

});

Thanks for your attention.

-- 
You received this message because you are subscribed to the Google Groups 
Google Visualization API group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.


Re: [visualization-api] Why date values are repeated on horizontal axis in Webkit browsers?

2014-10-03 Thread 'Sergey Grabkovsky' via Google Visualization API
Hi Vasiliy,

This appears to be due to an issue with time zones and certain operating
systems. I was able to reproduce your issue on Windows 8.1, but not Windows
7. Could you please elaborate on which version of windows you're running?

On Fri Oct 03 2014 at 9:30:44 AM Василий Топоров toporo...@gmail.com
wrote:

 Hello.

 I've got a problem with Line Chart.

 On this page http://www.metrtv.ru/price_dynamics we have charts of
 changing price on real estate (hAxis - date, vAxis - price). This values
 are taken by jquery ajax from pre-generated json files (one file for one
 chart).

 On windows machines in webkit-based browsers (Chrome, Yandex browser) I
 see 2013 two times (see the screenshot). In Firefox and Explorer they looks
 well as well as Chrome on Linux. How could I fix this issue?


 https://lh5.googleusercontent.com/-jdipwuI4n8w/VC6kcPMidCI/ALI/GNdiLIcuQYM/s1600/dyn.jpg



 Js-code for charts:

 google.load('visualization', '1.0', {'packages':['corechart']});
 google.setOnLoadCallback(function(){

 $charts = $('.b-charts__item__chart');
 if ($charts.size()) {

 $charts.each(function(){
 var $el = this;
 $.ajax({
 url: $($el).attr('rel') + '?' + (Math.floor(Math.random() *
 ( - 1000 + 1)) + 1000),
 data: '',
 success: function(jsonData){
 var $chartData = [];
 $.each(jsonData, function(i, row){
 $chartData.push([new Date(row[0]), row[1]]);
 });
 var data = new google.visualization.DataTable();
 data.addColumn('date', 'Дата'); // Date
 data.addColumn('number', 'Средняя цена'); // Average price
 data.addRows($chartData);
 var options = {
 'height':240,
 'chartArea':{left:70,top:20,width:80%,height:200},
 'legend':'none'
 };
 var chart = new google.visualization.LineChart($el);
 chart.draw(data, options);
 },
 dataType: 'json'
 });

 });
 }

 });

 Thanks for your attention.

 --
 You received this message because you are subscribed to the Google Groups
 Google Visualization API group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-visualization-api+unsubscr...@googlegroups.com.
 To post to this group, send email to
 google-visualization-api@googlegroups.com.
 Visit this group at
 http://groups.google.com/group/google-visualization-api.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
Google Visualization API group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.


Re: [visualization-api] Why date values are repeated on horizontal axis in Webkit browsers?

2014-10-03 Thread 'Sergey Grabkovsky' via Google Visualization API
Hi again,

I looked into this, and as I thought, it's because of Daylight Savings
Time. Apparently, until the end of 2013, Russia was using permanent
Daylight Savings Time (reference
http://en.wikipedia.org/wiki/Daylight_saving_time_by_country). In 2014,
they returned to Standard Time. As a consequence of this, on Jan 1 2014
12:00am, they subtracted an hour.

WebKit-based browsers attempt to model this appropriately, and as such, in
Russian time zones, when you try to create a new Date(2014, 0, 1, 0, 0, 0,
0), it actually gives you 23:00:00 Dec 31 2013.

I think we have a reasonable plan to fix this now, and the fix should be
available in the next release.

On Fri Oct 03 2014 at 10:13:19 AM Sergey Grabkovsky gra...@google.com
wrote:

 Hi Vasiliy,

 This appears to be due to an issue with time zones and certain operating
 systems. I was able to reproduce your issue on Windows 8.1, but not Windows
 7. Could you please elaborate on which version of windows you're running?

 On Fri Oct 03 2014 at 9:30:44 AM Василий Топоров toporo...@gmail.com
 wrote:

 Hello.

 I've got a problem with Line Chart.

 On this page http://www.metrtv.ru/price_dynamics we have charts of
 changing price on real estate (hAxis - date, vAxis - price). This values
 are taken by jquery ajax from pre-generated json files (one file for one
 chart).

 On windows machines in webkit-based browsers (Chrome, Yandex browser) I
 see 2013 two times (see the screenshot). In Firefox and Explorer they looks
 well as well as Chrome on Linux. How could I fix this issue?


 https://lh5.googleusercontent.com/-jdipwuI4n8w/VC6kcPMidCI/ALI/GNdiLIcuQYM/s1600/dyn.jpg



 Js-code for charts:

 google.load('visualization', '1.0', {'packages':['corechart']});
 google.setOnLoadCallback(function(){

 $charts = $('.b-charts__item__chart');
 if ($charts.size()) {

 $charts.each(function(){
 var $el = this;
 $.ajax({
 url: $($el).attr('rel') + '?' + (Math.floor(Math.random() *
 ( - 1000 + 1)) + 1000),
 data: '',
 success: function(jsonData){
 var $chartData = [];
 $.each(jsonData, function(i, row){
 $chartData.push([new Date(row[0]), row[1]]);
 });
 var data = new google.visualization.DataTable();
 data.addColumn('date', 'Дата'); // Date
 data.addColumn('number', 'Средняя цена'); // Average price
 data.addRows($chartData);
 var options = {
 'height':240,
 'chartArea':{left:70,top:20,wi
 dth:80%,height:200},
 'legend':'none'
 };
 var chart = new google.visualization.LineChart($el);
 chart.draw(data, options);
 },
 dataType: 'json'
 });

 });
 }

 });

 Thanks for your attention.

 --
 You received this message because you are subscribed to the Google Groups
 Google Visualization API group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-visualization-api+unsubscr...@googlegroups.com.
 To post to this group, send email to google-visualization-api@googl
 egroups.com.
 Visit this group at http://groups.google.com/group
 /google-visualization-api.
 For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
Google Visualization API group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.


Re: [visualization-api] Why date values are repeated on horizontal axis in Webkit browsers?

2014-10-03 Thread 'Daniel LaLiberte' via Google Visualization API
I wonder about the UTCYear solution, though.  What will it show when UTC
has crossed the year boundary but the local date has not?

I think the whole thing about showing local dates and times is wrong.  The
data should specify the location where a date applies, and we shouldn't
assume the local date makes sense.  The only benefit of showing local date
is when it doesn't matter, and the local date seems like it factors out the
location of where the date really applies, which is where it was created.

So UTC dates are the only location-independent dates, except they really
are arbitrarily at one location.  But the benefit for us is that UTC is
independent of DST, so we should be safe to do our date calculations
relative to UTC.

But if we calculate and display in UTC date form, the time will be off for
everyone except those at the UTC location during non-DST parts of the
year.  I guess what we should do is calculate in UTC form, but display in
local time.  Will this still result in the shifted years problem?
 Displaying in local time is what happens currently when we get the full
year in local time rather than UTC.  So I guess if we are not displaying in
UTC, then we have to do the half-unit trick when getting any unit.

And then we should have an option to display in any particular time zone
independent of the user's location.


On Fri, Oct 3, 2014 at 4:29 PM, 'Sergey Grabkovsky' via Google
Visualization API google-visualization-api@googlegroups.com wrote:

 Hi again,

 I looked into this, and as I thought, it's because of Daylight Savings
 Time. Apparently, until the end of 2013, Russia was using permanent
 Daylight Savings Time (reference
 http://en.wikipedia.org/wiki/Daylight_saving_time_by_country). In 2014,
 they returned to Standard Time. As a consequence of this, on Jan 1 2014
 12:00am, they subtracted an hour.

 WebKit-based browsers attempt to model this appropriately, and as such, in
 Russian time zones, when you try to create a new Date(2014, 0, 1, 0, 0, 0,
 0), it actually gives you 23:00:00 Dec 31 2013.

 I think we have a reasonable plan to fix this now, and the fix should be
 available in the next release.

 On Fri Oct 03 2014 at 10:13:19 AM Sergey Grabkovsky gra...@google.com
 wrote:

 Hi Vasiliy,

 This appears to be due to an issue with time zones and certain operating
 systems. I was able to reproduce your issue on Windows 8.1, but not Windows
 7. Could you please elaborate on which version of windows you're running?

 On Fri Oct 03 2014 at 9:30:44 AM Василий Топоров toporo...@gmail.com
 wrote:

 Hello.

 I've got a problem with Line Chart.

 On this page http://www.metrtv.ru/price_dynamics we have charts of
 changing price on real estate (hAxis - date, vAxis - price). This values
 are taken by jquery ajax from pre-generated json files (one file for one
 chart).

 On windows machines in webkit-based browsers (Chrome, Yandex browser) I
 see 2013 two times (see the screenshot). In Firefox and Explorer they looks
 well as well as Chrome on Linux. How could I fix this issue?


 https://lh5.googleusercontent.com/-jdipwuI4n8w/VC6kcPMidCI/ALI/GNdiLIcuQYM/s1600/dyn.jpg



 Js-code for charts:

 google.load('visualization', '1.0', {'packages':['corechart']});
 google.setOnLoadCallback(function(){

 $charts = $('.b-charts__item__chart');
 if ($charts.size()) {

 $charts.each(function(){
 var $el = this;
 $.ajax({
 url: $($el).attr('rel') + '?' + (Math.floor(Math.random() *
 ( - 1000 + 1)) + 1000),
 data: '',
 success: function(jsonData){
 var $chartData = [];
 $.each(jsonData, function(i, row){
 $chartData.push([new Date(row[0]), row[1]]);
 });
 var data = new google.visualization.DataTable();
 data.addColumn('date', 'Дата'); // Date
 data.addColumn('number', 'Средняя цена'); // Average
 price
 data.addRows($chartData);
 var options = {
 'height':240,
 'chartArea':{left:70,top:20,wi
 dth:80%,height:200},
 'legend':'none'
 };
 var chart = new google.visualization.LineChart($el);
 chart.draw(data, options);
 },
 dataType: 'json'
 });

 });
 }

 });

 Thanks for your attention.

 --
 You received this message because you are subscribed to the Google
 Groups Google Visualization API group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to google-visualization-api+unsubscr...@googlegroups.com.
 To post to this group, send email to google-visualization-api@googl
 egroups.com.
 Visit this group at http://groups.google.com/group
 /google-visualization-api.
 For more options, visit https://groups.google.com/d/optout.

  --
 You received this message because you are subscribed to the Google 

Re: [visualization-api] Why date values are repeated on horizontal axis in Webkit browsers?

2014-10-03 Thread 'Sergey Grabkovsky' via Google Visualization API
That last part is basically what the solution is. It's to calculate the
ticks using UTC time, so we don't get into weird situations with DST, but
still display local time. UTC is smarter, so when you do Date(2013, 0, 1,
0, 0, 0) + 1 year, it will be Date(2014, 0, 1, 1, 0, 0); where if you did
that with regular dates, it would give you Date(2013, 11, 31, 23, 0, 0).

On Fri Oct 03 2014 at 5:18:32 PM Daniel LaLiberte dlalibe...@google.com
wrote:

 I wonder about the UTCYear solution, though.  What will it show when UTC
 has crossed the year boundary but the local date has not?

 I think the whole thing about showing local dates and times is wrong.  The
 data should specify the location where a date applies, and we shouldn't
 assume the local date makes sense.  The only benefit of showing local date
 is when it doesn't matter, and the local date seems like it factors out the
 location of where the date really applies, which is where it was created.

 So UTC dates are the only location-independent dates, except they really
 are arbitrarily at one location.  But the benefit for us is that UTC is
 independent of DST, so we should be safe to do our date calculations
 relative to UTC.

 But if we calculate and display in UTC date form, the time will be off for
 everyone except those at the UTC location during non-DST parts of the
 year.  I guess what we should do is calculate in UTC form, but display in
 local time.  Will this still result in the shifted years problem?
  Displaying in local time is what happens currently when we get the full
 year in local time rather than UTC.  So I guess if we are not displaying in
 UTC, then we have to do the half-unit trick when getting any unit.

 And then we should have an option to display in any particular time zone
 independent of the user's location.


 On Fri, Oct 3, 2014 at 4:29 PM, 'Sergey Grabkovsky' via Google
 Visualization API google-visualization-api@googlegroups.com wrote:

 Hi again,

 I looked into this, and as I thought, it's because of Daylight Savings
 Time. Apparently, until the end of 2013, Russia was using permanent
 Daylight Savings Time (reference
 http://en.wikipedia.org/wiki/Daylight_saving_time_by_country). In
 2014, they returned to Standard Time. As a consequence of this, on Jan 1
 2014 12:00am, they subtracted an hour.

 WebKit-based browsers attempt to model this appropriately, and as such,
 in Russian time zones, when you try to create a new Date(2014, 0, 1, 0, 0,
 0, 0), it actually gives you 23:00:00 Dec 31 2013.

 I think we have a reasonable plan to fix this now, and the fix should be
 available in the next release.

 On Fri Oct 03 2014 at 10:13:19 AM Sergey Grabkovsky gra...@google.com
 wrote:

 Hi Vasiliy,

 This appears to be due to an issue with time zones and certain operating
 systems. I was able to reproduce your issue on Windows 8.1, but not Windows
 7. Could you please elaborate on which version of windows you're running?

 On Fri Oct 03 2014 at 9:30:44 AM Василий Топоров toporo...@gmail.com
 wrote:

 Hello.

 I've got a problem with Line Chart.

 On this page http://www.metrtv.ru/price_dynamics we have charts of
 changing price on real estate (hAxis - date, vAxis - price). This values
 are taken by jquery ajax from pre-generated json files (one file for one
 chart).

 On windows machines in webkit-based browsers (Chrome, Yandex browser) I
 see 2013 two times (see the screenshot). In Firefox and Explorer they looks
 well as well as Chrome on Linux. How could I fix this issue?


 https://lh5.googleusercontent.com/-jdipwuI4n8w/VC6kcPMidCI/ALI/GNdiLIcuQYM/s1600/dyn.jpg



 Js-code for charts:

 google.load('visualization', '1.0', {'packages':['corechart']});
 google.setOnLoadCallback(function(){

 $charts = $('.b-charts__item__chart');
 if ($charts.size()) {

 $charts.each(function(){
 var $el = this;
 $.ajax({
 url: $($el).attr('rel') + '?' + (Math.floor(Math.random() *
 ( - 1000 + 1)) + 1000),
 data: '',
 success: function(jsonData){
 var $chartData = [];
 $.each(jsonData, function(i, row){
 $chartData.push([new Date(row[0]), row[1]]);
 });
 var data = new google.visualization.DataTable();
 data.addColumn('date', 'Дата'); // Date
 data.addColumn('number', 'Средняя цена'); // Average
 price
 data.addRows($chartData);
 var options = {
 'height':240,
 'chartArea':{left:70,top:20,wi
 dth:80%,height:200},
 'legend':'none'
 };
 var chart = new google.visualization.LineChart($el);
 chart.draw(data, options);
 },
 dataType: 'json'
 });

 });
 }

 });

 Thanks for your attention.

 --
 You received this message because you are subscribed to the Google
 Groups