Commit c6203d57 authored by metzlerd's avatar metzlerd
Browse files

Adding javascript support to graphs.

parent 3ca21381
......@@ -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;
}
......
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