0

I am not much aware of the Highcharts

I need to show time as "9:00AM" on xAxis on highchart currently its showing "00:00".. I know I am missing something very obvious here

http://jsfiddle.net/r6emu/2643/

 xAxis: {
        //startOfWeek: 1,
        type: 'datetime',
        dateTimeLabelFormats: {
                hour: '%H:%M',
            },

        labels: {
            formatter: function () { 
                console.debug(this.value)

                return  Highcharts.dateFormat( '%H:%M',(this.value));
            }
        }
    },
webDev
  • 135
  • 3
  • 13
  • `%l:%M %p` for example. [See this](http://stackoverflow.com/a/7104992/2732991). – Halvor Holsten Strand May 19 '15 at 11:00
  • **`this.value`** here doesn't contain time value, only date. All your data contain only dates, not hours. – Raein Hashemi May 19 '15 at 11:18
  • Can I get Time from this.value then? – webDev May 19 '15 at 11:23
  • I can get the Time like this `new Date(this.value).format("%H %M")` but it shows error `(intermediate value).format is not a function` when used in place of `return Highcharts.dateFormat( '%H:%M',(this.value));` – webDev May 19 '15 at 11:29
  • **`format`** is not defined in the Date of jsfiddle. It is irrelevant anyway. All **`this.value`** data has the time **0:0** - http://jsfiddle.net/r6emu/2645/ - – Raein Hashemi May 19 '15 at 11:37
  • I think that [demo](http://jsfiddle.net/r6emu/2646/) should explain a bit more. Data on the chart is mainly daily-based. If you replace with "%H:%M", then it will display "00:00", because tickmark on xAxis is displayed at midnight. You can set offset for ticks, to display them translated by 9hours, but I think there may not be perfect solution with actual data (display 9AM with daily data). Example for offset in tickPositioner: http://jsfiddle.net/r6emu/2648/ – Paweł Fus May 20 '15 at 11:10

0 Answers0