Код хайстока брал из примера откуда-то и немного правил (свои датчики, цвета и толщины линиям задал свои, это всё работало):
Код: Выделить всё
<script type="text/javascript" src="../../highcharts/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../../highcharts/js/highstock.js"></script>
<script type="text/javascript">
$(function () {
var seriesOptions = [],
obsss = 0,
seriesCounter = 0,
timeback = 0,
names = ['Датчик 1','Датчик 2','Датчик 3'],
sensornames = ['oThermoSensor0.value',
'oThermoSensor1.value',
'oThermoSensor2.value'],
chartcolor = ['#ff0000','#00ff00','#0000ff'];
Highcharts.setOptions({
lang: {
months: ['Январь','Февраль','Март','Апрель','Май','Июнь','Июль',
'Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
shortMonths: ['Янв','Фев','Мар','Апр','Май','Июн','Июл',
'Авг','Сен','Окт','Ноя','Дек'],
weekdays: ['Вск','Пнд','Втр','Срд','Чтв','Птн','Сбт'],
rangeSelectorZoom: 'Маcштаб',
rangeSelectorFrom: 'От',
rangeSelectorTo: 'До',
thousandsSep: ' '
},
global: {
useUTC: false
}
});
// create the chart when all data is loaded
createChart = function () {
$('#container').highcharts('StockChart', {
rangeSelector: {
buttons: [{ type: 'hour', count: 1, text: '1 ч' },
{ type: 'day', count: 1, text: '1 д' },
{ type: 'day', count: 2, text: '2 д' },
{ type: 'week', count: 1, text: 'нед' },
{ type: 'month', count: 1, text: 'мес' },
{ type: 'month', count: 6, text: '6 мес' },
{ type: 'year', count: 1, text: 'год' },
{ type: 'all', text: 'Всё' }],
selected: 1 // Какая кнопка выбрана по умолчанию
},
title: { text : 'График температур в доме'},
legend: { enabled : true,
layout : 'horizontal',
align : 'center',
verticalAlign : 'top',
borderWidth: 0,
x : 0,
y : 20 },
xAxis : {
ordinal: false,
minRange: 3600 * 1000 // one hour
},
yAxis: {
title: {
text: 'Температура (°C)'
}
},
plotOptions: {
series: {
lineWidth: 2,
point: {
events: {
'click': function () {
if (this.series.data.length > 1) {
this.remove();
}
}
}
}
}
},
exporting: {
enabled: false
},
series: seriesOptions
});
};
$.each(names, function (i, name) {
$.getJSON('/objects/?script=jconhs&name='+sensornames[i]+'&callback=?', function (data) {
seriesOptions[i] = {
name: name,
data: data,
type: 'spline',
color: chartcolor[i]
};
// As we're loading the data asynchronously, we don't know what order it will arrive. So
// we keep a counter and create the chart when all the data is loaded.
seriesCounter += 1;
if (seriesCounter === names.length) {
createChart();
}
});
});
});
</script>
<div id="container" style="height: 1000px; min-width: 500px"></div>