summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Metzler2013-06-01 15:41:21 (GMT)
committer David Metzler2013-06-01 15:41:21 (GMT)
commitc6203d5734a9fe153ec44366be6b0a9bd902bdfe (patch)
tree87b998ce2cd8e9af1caff201049fac29f750577c
parent3ca213811b07caa49e0239387244a74b4b3f9889 (diff)
Adding javascript support to graphs.
-rwxr-xr-xrenderers/FrxSVGGraph.inc8
1 files changed, 7 insertions, 1 deletions
diff --git a/renderers/FrxSVGGraph.inc b/renderers/FrxSVGGraph.inc
index 8ebc1c6..86e4bff 100755
--- a/renderers/FrxSVGGraph.inc
+++ b/renderers/FrxSVGGraph.inc
@@ -78,6 +78,7 @@ class FrxSVGGraph extends FrxChart {
function renderGraph($type, $options, $data) {
+ static $jsinc = FALSE;
// Default in Skin Options for Graph type
$skin = Frx::Data()->getContext('skin');
if (@is_array($skin['SVGGraph'][$type])) {
@@ -86,6 +87,7 @@ class FrxSVGGraph extends FrxChart {
$options = array_merge($skin_option, $options);
}
+
if (!isset($options['scatter_2d']) && ($type == 'ScatterGraph' || $type=='MultiScatterGraph') && $this->xy_data && !isset($options['scatter_2d'])) {
$options['scatter_2d'] = TRUE;
}
@@ -110,9 +112,13 @@ class FrxSVGGraph extends FrxChart {
$output = str_replace('<svg width', "<svg viewBox='0 0 $width $height' width", $output);
$javascript = '/<script[^>]*?>.*?<\/script>/si';
$noscript = '';
- if ($this->format != 'web') {
+ if (!$jsinc && $this->format == 'web') {
+ $output .= $graph->FetchJavascript();
+ }
+ else {
$output = preg_replace($javascript, $noscript, $output);
}
+
return $output;
}