T
T
tosteruseruser2014-08-01 16:12:37
JavaScript
tosteruseruser, 2014-08-01 16:12:37

How to display the date and time on the x-axis, in highstock?

Hello!
I've been struggling with highstock for a week now. Their API is clear, but I can’t figure out how to make my values ​​\u200b\u200bin the x axis.
My dataset is [["July 30, 2014 7:14 PM",24],["July 30, 2014 7:16 PM",41],["July 30, 2014 7:16 PM",12]
] these values.
Part of my working code. The rest is chart settings.

var seriesOptions = [],
seriesCounter = 0,

//Входные данные
names = ['data_input_1', 'data_input_2'],colors = Highcharts.getOptions().colors;
//Надписи 
captions = ['Датчик 1', 'Датчик 2'];
//Вид (тип) графика area, areaspline, bar, column, line, pie, scatter, spline, candlestick or ohlc
type = ['line', 'line'];

$.each(names, function(i, name) 
{
$.getJSON('../graph/select_data.php?'+ name.toLowerCase() +'',	

function(data) 
{
seriesOptions[i] = 
{
name: captions[i],
data: data,
type:type[i],
//Наверно тут нужно вставить код и я вставлял, но ось x никак не хочет меняться (
// это не работает, ни тут нигде categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
// всё остальное работает и тут и везде

};

seriesCounter++;
if (seriesCounter == names.length){createChart();}
});
});

Result
cdab530f97154a1599e31d45b00bab17.png
Please tell me how can I display the date and time on the x-axis? Or at least give a hint where highstock takes the x-axis values ​​from and why I have them 00 00 00 001, 00 00 00 002, etc.?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question