0

I'm trying to show 12 hours format on Google Chart timeline.

This is the example from Google with arrayToDataTable method. It is working fine and this is the result I really want in 12hrs format with am & pm.

Code Pen link 1: http://codepen.io/Thein/pen/mAOrow

This is how I populated dataTable using google.visualization.DataTable(). Additionally, I formatted -

var formatter_12h = new google.visualization.DateFormat({ pattern: "d/MM/yy h:m:s aa" });
formatter_12h.format(dataTable, 1);
formatter_12h.format(dataTable, 2);

It always comes up with 24 hours format in tooltip.

Code Pen link 2: http://codepen.io/Thein/pen/KgNvJA

I tried to play with Culture value in in web.config as follow but it is still showing 24h format.

<globalization enableClientBasedCulture="false" uiCulture="en-AU" culture="en-AU" />

EDIT: It seems that Snippet 2 code is working with 12 hours format on Apahache server and It is showing 24 hours format on IIS server.

Jonas T
  • 2,989
  • 4
  • 32
  • 43
  • you can provide custom tooltip to control exact content -- [here is an example](http://stackoverflow.com/a/38306489/5090771) that builds the tooltip dynamically from the data, and uses the `formatValue` method on `DateFormat` – WhiteHat Sep 20 '16 at 12:23

1 Answers1

0

Thanks to WhiteHat and his solution. I have fixed the Timeline chart as follow:

Code Pen link 3: http://codepen.io/Thein/pen/LRbdKv

HhAxis is quite messy though. It is so much cleaner in Code Pen link 1(http://codepen.io/Thein/pen/mAOrow). Please post your answer if you can get the result exactly like Code Pen link 1 with dataTable, I will accept your answer.

Jonas T
  • 2,989
  • 4
  • 32
  • 43