var history = [], max, rows, measures, colors, info, fade_dur, chart_options, stats_to_update = ['uptime_in_seconds', 'uptime_in_days'] var initialize = function(params) { measures = params.measures colors = params.colors max = params.max rows = params.rows fade_dur = params.fade_dur info = $("#info") chart_options = { chart1: { seriesDefaults: { showMarker: false, shadow: false }, axesDefaults: { labelRenderer: $.jqplot.CanvasAxisLabelRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer }, axes: { xaxis: { pad: 1, min: - max, tickOptions: { show: true } }, yaxis: { label:'Commands/sec', min: 0, pad: 1.2 } }, grid: { borderWidth: 0.0, borderColor: '#ddd', background: '#ffffff', shadowAlpha: 0.03 } }, chart2: { seriesDefaults: { showMarker: false, shadow: false, fill: true }, series: [ { label: "user" }, { label: "sys" } ], stackSeries: true, axesDefaults: { labelRenderer: $.jqplot.CanvasAxisLabelRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer, shadow: false }, axes: { xaxis: { pad: 1, min: - max, tickOptions: { show: true } }, yaxis: { label:'CPU usage', min: 0, pad: 1.0 } }, legend: { show: true, location: 'se' }, grid: { borderWidth: 0.0, borderColor: '#ddd', background: '#ffffff', shadowAlpha: 0.03 } }, chart3: { seriesDefaults: { showMarker: false, shadow: false, }, series: [ { label: "used" }, { label: "rss" } ], axesDefaults: { labelRenderer: $.jqplot.CanvasAxisLabelRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer, shadow: false }, axes: { xaxis: { pad: 1, min: - max, tickOptions: { show: true } }, yaxis: { label:'Memory usage', min: 0, pad: 1.2, tickOptions: { formatString: "%dMB" } } }, legend: { show: true, location: 'se' }, grid: { borderWidth: 0.0, borderColor: '#ddd', background: '#ffffff', shadowAlpha: 0.03 } }, } // chart_options for (var i = 0; i < params.history.length; ++i) { appendToHistory(params.history[i]) if (params.history.length - i <= rows) updateTable() } updatePlot() } var appendToHistory = function(json) { history.push(json) if (history.length > max) history.shift() } var updateTable = function() { var json = history[ history.length - 1 ], js = json.static, jd = json.dynamic // Instance information (mostly static) // for (stat in js) { for (var i = 0; i < stats_to_update.length; ++i) { var stat = stats_to_update[i] $("#" + stat).replaceWith( "