Skip to content

Commit

Permalink
add svg format
Browse files Browse the repository at this point in the history
  • Loading branch information
julles committed Mar 21, 2016
1 parent 438be53 commit 3fff5b7
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/Highcharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function export($id,$array = [])
$array = json_encode($array);

$export = '
<script>
<script type="text/javascript">
$(document).ready(function(){
$("#'.$id.'").exportChart('.$array.');
});
Expand All @@ -56,23 +56,21 @@ public function export($id,$array = [])
return $export;
}

public function display($id = "" , $array = [] , $options = ['jquery.js' => true , 'highcharts.js' => true,'exporting.js'=> true])

public function display($id = "" , $array = [] , $options = ['jquery.js' => true , 'highcharts.js' => true,'exporting.js'=> true,'format' => 'chart'])
{
// belon sempurna display nya brayse

$array = json_encode($array);

$jquery = $options['jquery.js'];
$jquery = !isset($options['jquery.js']) ? $options['jquery.js'] = true : $options['jquery.js'];

$installJquery = $jquery == true ? $this->installJquery() : '';

$highcharts = $options['highcharts.js'];
$highcharts = !isset($options['highcharts.js']) ? $options['highcharts.js'] = true : $options['highcharts.js'];

$installHighchart = $highcharts == true ? $this->installHighchart() : '';


$exporting = $options['exporting.js'];
$exporting = !isset($options['exporting.js']) ? $options['exporting.js'] = true : $options['exporting.js'];

$installExporting = $exporting == true ? $this->installExport() : '';

Expand All @@ -88,8 +86,17 @@ public function display($id = "" , $array = [] , $options = ['jquery.js' => true
$(document).ready(function(){
$("#'.$id.'").highcharts('.$array.')
$("#'.$id.'").highcharts('.$array.');
format = "'.$options['format'].'";
if(format == "svg")
{
var chart = $("#'.$id.'").highcharts(),
svg = chart.getSVG();
$("#'.$id.'").text(svg);
}
});
</script>
Expand All @@ -98,4 +105,6 @@ public function display($id = "" , $array = [] , $options = ['jquery.js' => true

return $view;
}


}

0 comments on commit 3fff5b7

Please sign in to comment.