简体   繁体   中英

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 Years: 在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM