fmsf
fmsf

Reputation: 37177

How to display Google viz line chart interval in hours and minutes?

I got a line chart displaying intervals in minutes or hours. The dates are correctly set and the chart displays correctly. My problem here are the labels.

data passed to the chart:

U
 D: Array[96]
  0: Object
  c: Array[2]
   0: Object
    v: Wed Jun 27 2012 00:00:00 GMT+0200 (Romance Daylight Time)
    __proto__: Object
   1: Object
   length: 2
   __proto__: Array[0]
   __proto__: Object
  1: Object
   c: Array[2]
    0: Object
     v: Wed Jun 27 2012 00:15:00 GMT+0200 (Romance Daylight Time)
     __proto__: Object
    1: Object
    length: 2
  (...)

and the chart displays like this: enter image description here

now the issue is that the label should display the hour range and the vertical lines disapear :( (they show up if there is more than 1 day being displayed).

I've been shewing up https://developers.google.com/chart/interactive/docs/gallery/linechart#Data_Format to check for a solution for this but I can't find any references to why the hours get hidden on the vAxis.

Anyone knows how to display them?

Upvotes: 0

Views: 621

Answers (1)

fmsf
fmsf

Reputation: 37177

(I'll update this answer when I find the rest of it) To display the hours in the tooltip it's configurable with the DateFormat:

var dateFormatter = new google.visualization.DateFormat({pattern : 'HH:mm'});
dateFormatter.format(googledata, 0);
(...)
vis.draw(googledata, {

All references I found pointed to not being able change the labels on the hAxis when using Line Charts :(

Upvotes: 1

Related Questions