Answer the question
In order to leave comments, you need to log in
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();}
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question