user1978109
user1978109

Reputation: 737

Highstock - irregular time interval

Highcharts has an example using irregular time intervals, I want to do the same on highstock howeverthere is no parameter for the xAxis-type.

JSFiddle code

My options are

$(function() {

$.getJSON('http://184.173.195.228/~ktwsn/temp2.php?action=get_sensor&sensor_serial%5B%5D=3B74F41400000069&sensor_serial%5B%5D=3BB2FA14000000E6&sensor_serial%5B%5D=3B91F11400000079&sensor_serial%5B%5D=3BC7F114000000E5&sensor_serial%5B%5D=3BC0F314000000E3&callback=?',
      {action: "get_sensor"},
          function(data) {
              var seriesOptions = [];
              $.each(data, function(key, val) {
                  seriesOptions.push({
                      name: val.name,
                      data: val.samples,
                      marker : {
                          enabled : true,
                          radius : 3
                      }
                  });
              });       
              // create the chart
              chart = new Highcharts.StockChart({
                  chart: {
                      renderTo: 'container',
                  },
                  xAxis: {
                      type: 'datetime'
                  },
                  rangeSelector: {
                      selected: 4
                  },    
                  series: seriesOptions
              });
          });   
});

Upvotes: 7

Views: 3292

Answers (2)

user1978109
user1978109

Reputation: 737

Found it. The nomenclature between highcharts and highstock are different.

For Hightstock it's

xAxis: {       
    ordinal: false
}

The company really needs to combine highcharts and highstock. A single API documentation would be easier to follow.

Upvotes: 20

jlbriggs
jlbriggs

Reputation: 17791

I would verify that the output data is actually using the same time stamp.

Many cases like this include time stamps for the same date, but different times, which will always result in different x axis placement.

(I know that may be an obvious check, but I have seen it many times...)

Upvotes: 0

Related Questions