Commit 274d89e3 authored by nextime's avatar nextime

Optimize a little bit graph panel js

parent 53b5855f
......@@ -7,31 +7,34 @@ $daysql = getLastNDays(7, 'Y-m-d');
<script type="text/javascript">
var ajaxCharts = [];
function plotGraph(settings)
{
t = this;
$.extend(t.settings, settings);
$.ajax({
async:false,
url: t.settings.data_url,
dataType: "json",
success: function(res){
res.data.opt.axes.xaxis.renderer=$.jqplot.DateAxisRenderer;
res.data.opt.axes.xaxis.tickRenderer=$.jqplot.CanvasAxisTickRenderer;
$("#"+t.settings.eid).empty();
$.jqplot(t.settings.eid, res.data.data, res.data.opt);
}
});
}
<?
foreach($_SESSION[PANELS_CHARTS] as $eid => $chart)
{
?>
ajaxCharts[ajaxCharts.length] = {
settings: {
eid: "<?=$eid?>",
data_url: "/rest/v1.2/charts/chartbyname/<?=$chart['name']?>/json"
},
plot: function(settings){
t = this;
$.extend(t.settings, settings);
$.ajax({
async:false,
url: t.settings.data_url,
dataType: "json",
success: function(res){
res.data.opt.axes.xaxis.renderer=$.jqplot.DateAxisRenderer;
res.data.opt.axes.xaxis.tickRenderer=$.jqplot.CanvasAxisTickRenderer;
$("#"+t.settings.eid).empty();
$.jqplot(t.settings.eid, res.data.data, res.data.opt);
}
});
}
plot: plotGraph
};
<?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment