Код длинный, так что частично.
<script>
var points=<?=json_encode($diag)?>;
var comments=<?=json_encode($comments)?>;
var Xcomments=<?=json_encode($Xcomments)?>;
function showDiag(){
var emin=document.getElementById("min");
var emax=document.getElementById("max");
var edelta=document.getElementById("delta");
for (var key in points){
var min = parseFloat(emin.value);
var max = parseFloat(emax.value);
var delta = parseFloat(edelta.value);
if(key=='time'){
delta = 1;
max=0;
for(var i=0;i<points['time'].length;++i){
max=Math.max(max,points['time'][i]);
};
max = Math.ceil(max);
}
if(key[0]=='a'){
delta = 1;
max=0;
for(var i=0;i<points['attempts'].length;++i){
max=Math.max(max,points['attempts'][i]);
};
}
createDiag(points[key],min,max,delta,"diagram_"+key, Xcomments[key], "<?=$Ycomment?>", comments[key]);
}
return false;
};
</script>
<button type="button" onclick="return showDiag();">Построить диаграмму</button>
<br>
<div id="container" style="width:100%; height:400px;"></div>
<script>
$(function () {
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
});
});
var chart1; // globally available
$(function() {
chart1 = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
rangeSelector: {
selected: 1
},
series: [{
name: 'USD to EUR',
data: usdtoeur // predefined JavaScript array
}]
});
});
</script>
<script type="text/javascript" src="/js/themes/gray.js"></script>
В начале библиотеки подключаю следующим образом:
<?PHP ?>
<script language="JavaScript" src="<?=SITE_URI_ROOT?>js/prototype.js" type="text/javascript"></script>
<script language="JavaScript" src="<?=SITE_URI_ROOT?>js/module/<?=$STORAGE['module'].'/'.$STORAGE['action']?>.js" type="text/javascript"></script>
<script language="JavaScript" src="<?=SITE_URI_ROOT?>js/jquery.js" type="text/javascript"></script>
<script language="JavaScript" src="<?=SITE_URI_ROOT?>js/highcharts/js/highcharts.js" type="text/javascript"></script>
<script language="JavaScript" src="<?=SITE_URI_ROOT?>js/highcharts/js/modules/exporting.js" type="text/javascript"></script>
<?