Whitney R.
Whitney R.

Reputation: 630

Highstock xAxis datetime

I use Highstock to display a graph showing the number of visitors in column and I need the zoom to display the number of visitors per day, per month and per year

In my graph I can display a number of visitor per day, but I would like display a number of visitor per month and per year too. But when I look my graph (per month) I don't have a graph with 12 column, I have a graph with 365 column (one per day).

I use the type datetime for xAxis, but it doesn't work...

x rangeSelector: {

       inputDateFormat:'%d.%m.%Y',
       inputEditDateFormat:'%d.%m.%Y',
       buttonTheme: {
           width: 80
       },
       buttons: [{
               type: 'day',
               count: 7,
               text: 'day'
           }, {
               type: 'month',
               count: 12,
               text: 'month'
           }, {
               type: 'year',
               count: 1,
               text: 'years'
           }],
       selected: 0
   },

Axis: {

      minTickInterval: 24 * 3600 * 1000,
       type: 'datetime',
       title: {
           text: 'Time'
       },
       dateTimeLabelFormats: {
           day: '%d.%m<br/>%Y'
      }
   }

How can I have a graph with "a addition of the visitors per column" ?

Below is what I get now. The first graph is OK, but the second, it's not OK. I would 12 columns and not 365.

Per Days: Per Days: Per Years: enter image description here

Upvotes: 1

Views: 1251

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

Range selector buttons affecting to the time span which should be displayed on a chart. If you want to display specific unit on a chart, you need to use forced dataGrouping, see:

Example could be found here: http://www.highcharts.com/stock/demo/candlestick-and-volume

Upvotes: 0

Related Questions