Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HighCharts datetime xAxis without missing values (weekends)

I am unable to render datetime chart without weekends. How can one do it?

Here is sample code (http://jsfiddle.net/LLExL/1720/):

$('#container').highcharts({
  xAxis: {
    type: "datetime",
    ordinal: true,
    dateTimeLabelFormats: {
      day: '%a'
    }
  },
  series: [{
    data: [
      [1375221600000, 180.45999999999998],
      [1375308000000, 144.368],
      [1375394400000, 108.27599999999998],
      [1375653600000, 72.184],
      [1375740000000, 36.092],
      [1375826400000, 0]
    ]
  }]
});

As you can see, I am trying "ordinal" option from highstocks. You can see in highcharts uservoice, that it could work for highcharts too: "In basic charts it can be enabled by setting ordinal to true." from http://highcharts.uservoice.com/forums/55896-general/suggestions/1089981-allow-irregular-datetime-xaxis-note-irregular-po

So, any suggestions how to remove sunday and saturday from xAxis in HighCharts?

like image 832
daviddddd Avatar asked Jun 15 '26 22:06

daviddddd


2 Answers

Highcharts doesn't support ordinal axis. This feature is part of Highstock and require Highstock lbrary to be used. When using Highstock, you are able to create stock charts by calling new Highstock.StockChart() and basic charts by callling new Highstock.Chart().

like image 54
Paweł Fus Avatar answered Jun 17 '26 11:06

Paweł Fus


Oridinal axis is available only in the Highstock.

http://api.highcharts.com/highstock#xAxis.ordinal

like image 40
Sebastian Bochan Avatar answered Jun 17 '26 13:06

Sebastian Bochan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!