2

I'm trying to set custom date formatting on Google Timeline Chart. I have working examples for other chart types and documentation, but this does not seem to work for timelines.

                        for (var i = 0, len = container.clientWidth / 90; i <= len; i++) {
                            var realDate = START + (END - START) * i / len;
                            ticks.push({
                                v: new Date(realDate * 1000),
                                f: moment.unix(realDate).format(formatStr)
                            });
                        }

                        chart.draw(dataTable, {
                            hAxis: {
                                minValue: st,
                                maxValue: en,
                                ticks: ticks
                            },
                        });

The not working part seems to be

                            ticks.push({
                                v: new Date(realDate * 1000),
                                f: moment.unix(realDate).format(formatStr)
                            });
Dan
  • 55,715
  • 40
  • 116
  • 154

1 Answers1

0

You can use hAxis.format option config to setup the time format in hAxis ticks.

timekeeper
  • 698
  • 15
  • 37