Skip to content

Commit 4ccb1ca

Browse files
committed
Update charts
* Charts formatting update
1 parent 671030d commit 4ccb1ca

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Diff for: pChart/index.php

+16-8
Original file line numberDiff line numberDiff line change
@@ -284,19 +284,27 @@
284284
$height = 500;
285285
}
286286

287-
288287
if (!is_array($_GET['p'])) {
289-
$code = '<iframe allowfullscreen="true" src="' . ROOTHTML . 'module/charts.html?id=config&enable_fullscreen=1&period=' . $_GET['subop'] . '&chart_type=' . urlencode($_GET['chart_type']) . '&group=' . $group . '&property=' . urlencode($_GET['p']) . '&height=' . $height . '&theme=grid-light" width=100% height=' . ($height) . ' frameBorder=0></iframe>';
288+
$properties=array($_GET['p']);
290289
} else {
291-
$p_url = '';
292-
foreach ($_GET['p'] as $p) {
293-
$p_url .= '&properties[]=' . urlencode($p);
294-
}
290+
$properties = $_GET['p'];
295291
$p_url .= '&height=' . $height;
296-
$code = '<iframe allowfullscreen="true" src="' . ROOTHTML . 'module/charts.html?id=config&enable_fullscreen=1&period=' . $_GET['subop'] . '&chart_type=' . urlencode($_GET['chart_type']) . '&group=' . $group . $p_url . '&theme=grid-light&frameBorder=0" width=100% height=' . $height . '></iframe>';
297292
}
293+
$p_url = '';
294+
foreach ($properties as $p) {
295+
$p_url .= '&properties[]=' . urlencode($p);
296+
if (preg_match('/^(\w+)\.(\w+)$/',$p,$m)) {
297+
$object = getObject($m[1]);
298+
if ($object->description) {
299+
$p_url .= '&legend[]=' . urlencode($object->description.' ('.$m[2].')');
300+
} else {
301+
$p_url .= '&legend[]=' . urlencode($p);
302+
}
303+
}
304+
}
305+
$code = '&nbsp;<iframe allowfullscreen="true" border="0" frameborder="0" src="' . ROOTHTML . 'module/charts.html?id=config&enable_fullscreen=1&period=' . $_GET['subop'] . '&chart_type=' . urlencode($_GET['chart_type']) . '&group=' . $group . $p_url . '&theme=grid-light&frameBorder=0" width=100% height=' . $height . '></iframe>';
298306
} else {
299-
$code = '<img src="' . ROOTHTML . '3rdparty/jpgraph/?p=' . $p . '&type=' . $_GET['subop'] . '&width=500&"/>';
307+
$code = '&nbsp;<img src="' . ROOTHTML . '3rdparty/jpgraph/?p=' . $p . '&type=' . $_GET['subop'] . '&width=500&"/>';
300308
}
301309
echo $code;
302310
/*

0 commit comments

Comments
 (0)