11

I need to display only time labels on xAxis. I'm using Highcharts and don't fully understand how to do it. On xAxis there should be time labels in format like 21:00. I do not need dates, only time is needed. In addition, the difference between two labels should be 00:30 (half an hour) or 01:30 and it should be zoomable. My PHP script writes some value in database every half an hour and I need to display it on a graph. Sorry for my poor English, I'm Russian. Any help would be appreciated :)

1 Answer 1

18

In xAxis of your chart you need to provide tickinterval and dateTimeLabelFormats. Following code gives the tick interval of 1.5 hours. You can change that to any number of hours you want by replacing 1.5 in tickInterval: 1.5 * 3600 * 1000,

xAxis: {
    type: 'datetime',
    //Sets tickInterval to 24 * 3600 * 1000 if display is by day
    tickInterval: 1.5 * 3600 * 1000,
    dateTimeLabelFormats : {
        day: '%H:%M'
    }
}
3
  • Thank You for such a quick answer! Now I have another problem - I can't understand how to make the numbers on yAxis match time labels on xAxis. Could you help me, please?
    – starky
    Commented Jul 4, 2012 at 13:58
  • If you are using json data to bind the charts than this will help you highcharts.com/ref/show/gh/get/jquery/1.7.1/highslide-software/… Commented Jul 4, 2012 at 17:46
  • The above link retrieves a 404 Commented Sep 23, 2015 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.