Commit 274d89e3 authored by nextime's avatar nextime

Optimize a little bit graph panel js

parent 53b5855f
......@@ -7,17 +7,8 @@ $daysql = getLastNDays(7, 'Y-m-d');
<script type="text/javascript">
var ajaxCharts = [];
<?
foreach($_SESSION[PANELS_CHARTS] as $eid => $chart)
function plotGraph(settings)
{
?>
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({
......@@ -31,7 +22,19 @@ ajaxCharts[ajaxCharts.length] = {
$.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: 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