This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
lnhighchart/classes/HighChart/Bubble.php

105 lines
1.8 KiB
PHP
Raw Normal View History

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Combo HighCharts
*
* @package HighChart
* @category Helper
* @author Deon George
* @copyright (c) 2012-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
class HighChart_Bubble extends HighChart {
protected $_data_type = array(
'bubble',
);
/**
* Get our series data, and return it as a JSON array
*/
public function json() {
$output = '';
$result = array();
Sort::MASort($this->_series,'order()',0);
foreach ($this->_series as $axis => $datapoints) {
if ($output)
$output .= ',';
$result['data'] = array();
foreach ($datapoints as $o)
array_push($result['data'],$o->as_array());
$result['name'] = $axis;
$output .= json_encode($result);
}
return '['.$output.']';
}
public function render() {
parent::render_init();
Script::add(array(
'type'=>'file',
'data'=>'media/js/highcharts-more.js',
));
Script::add(array(
'type'=>'stdin',
'data'=>"
$(document).ready(function() {
$('#".$this->_divname."').highcharts({
chart: {
type: 'bubble',
height: ".$this->_height.",
width: ".$this->_width.",
},
title: {
text: '".$this->_title."',
},
subtitle: {
text: '".$this->_subtitle."',
},
xAxis: {
title: {
text: '".$this->_xmetric."'
},
},
yAxis: {
title: {
text: '".$this->_ymetric."'
},
},".($this->_tooltip ? "
tooltip: {
pointFormat: '".$this->_tooltip."',
}," : '')."
credits: {
enabled: false
},
2015-09-30 11:33:00 +00:00
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
location.href = site_url+'".$this->_pointurl."'+this.options.id;
}
}
}
}
},
series: ".$this->json().",
});
});",
));
return parent::render_post();
}
}
?>