public function grouped_column() { $chartName = 'Stacked Grouped Column Chart'; $mychart = $this->Highcharts->create($chartName, 'column'); $this->Highcharts->setChartParams($chartName, array('renderTo' => 'columnwrapper', 'chartWidth' => 1000, 'chartHeight' => 750, 'chartBackgroundColorLinearGradient' => array(0, 0, 0, 300), 'chartBackgroundColorStops' => array(array(0, 'rgb(217, 217, 217)'), array(1, 'rgb(255, 255, 255)')), 'title' => 'Total fruit consumption, grouped by gender', 'subtitle' => 'Source: World Bank', 'xAxisLabelsEnabled' => TRUE, 'xAxisCategories' => array('Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'), 'yAxisTitleText' => 'Number of Fruits', 'enableAutoStep' => FALSE, 'creditsEnabled' => FALSE, 'plotOptionsSeriesStacking' => 'normal')); $johnSeries = $this->Highcharts->addChartSeries(); $janeSeries = $this->Highcharts->addChartSeries(); $joeSeries = $this->Highcharts->addChartSeries(); $jillSeries = $this->Highcharts->addChartSeries(); $johnSeries->addName('John')->addData($this->johnData)->stack = 'male'; $janeSeries->addName('Jane')->addData($this->janeData)->stack = 'female'; $joeSeries->addName('Joe')->addData($this->joeData)->stack = 'male'; $jillSeries->addName('Jill')->addData($this->jillData)->stack = 'female'; $mychart->addSeries($johnSeries); $mychart->addSeries($janeSeries); $mychart->addSeries($joeSeries); $mychart->addSeries($jillSeries); $this->set(compact('chartName')); }
public function funnel() { // anonymous Callback function to format the dataLabel $dataLabelFormatFunction = <<<EOF function() { return '<b>' + {point.name} + '</b>' + ({point.y:,.0f});} EOF; $funnelData = array(array('Website Visits', 15654), array('Downloads', 4064), array('Requested Price List', 1987), array('Invoice Sent', 976), array('Finalized', 846)); $chartName = 'Funnel Chart'; $funnelChart = $this->Highcharts->create($chartName, 'funnel'); $this->Highcharts->setChartParams($chartName, array('renderTo' => 'funnelwrapper', 'chartWidth' => 1024, 'chartHeight' => 768, 'title' => 'Sales Funnel', 'legendEnabled' => true, 'plotOptionsReversed' => true, 'plotOptionsSeriesDataLabelsFormat' => $dataLabelFormatFunction, 'plotOptionsSeriesDataLabelsEnabled' => true, 'plotOptionsSeriesDataLabelsSoftConnector' => true, 'plotOptionsNeckWidth' => '30%', 'plotOptionsNeckHeight' => '35%')); $series = $this->Highcharts->addChartSeries(); $series->addName('Unique Users')->addData($funnelData); $funnelChart->addSeries($series); $this->set(compact('chartName')); }