misp-dashboard/static/js/index/index_lineChart.js

58 lines
1.5 KiB
JavaScript
Raw Normal View History

var updateIntervalDirect = 1000*2; // 2s
var updateInterval = 1000*60*60*graph_log_refresh_rate; // 1h
var maxNumPoint = hours_spanned+1;
2017-10-20 15:09:53 +02:00
var optionsLineChart = {
series: {
shadowSize: 0 ,
lines: {
fill: true,
fillColor: {
colors: [ { opacity: 1 }, { opacity: 0.1 } ]
}
}
},
//colors: ["#2fa1db"],
yaxis: { min: 0, max: 20 },
xaxis: { min: 0, max: maxNumPoint },
ticks: maxNumPoint+1,
2017-10-24 12:21:50 +02:00
points: { show: true },
lines: { show: true, fill: true },
2017-10-20 15:09:53 +02:00
grid: {
tickColor: "#dddddd",
borderWidth: 0
},
legend: {
show: true,
position: "nw"
}
};
var rData = [
{ label: "Series1", data: 10},
{ label: "Series2", data: 30},
{ label: "Series3", data: 60}
];
var plotLineChart = $.plot("#feedDiv3", sources.getEmptyData(), optionsLineChart);
function updateChart() {
sources.slideSource();
sources.resetCountOnSource();
plotLineChart.setData(sources.toArray());
plotLineChart.getOptions().yaxes[0].max = sources.getGlobalMax();
plotLineChart.setupGrid();
plotLineChart.draw();
setTimeout(updateChart, updateInterval);
}
updateChart()
function updateChartDirect() {
plotLineChart.setData(sources.toArrayDirect());
plotLineChart.getOptions().yaxes[0].max = sources.getGlobalMax();
plotLineChart.setupGrid();
plotLineChart.draw();
//setTimeout(updateChartDirect, updateIntervalDirect);
}
updateChartDirect()