$chart = new Highchart(); $chart->chart->renderTo = "container"; $chart->chart->type = "column"; $chart->title->text = "Browser market share, April, 2011"; $chart->subtitle->text = "Click the columns to view versions. Click again to view brands."; $chart->xAxis->categories = new HighchartJsExpr("categories"); $chart->yAxis->title->text = "Total percent market share"; $chart->plotOptions->column->cursor = "pointer"; $chart->plotOptions->column->point->events->click = new HighchartJsExpr( "function() { var drilldown = this.drilldown; if (drilldown) { // drill down setChart(drilldown.name, drilldown.categories, drilldown.data, drilldown.color); } else { // restore setChart(name, categories, data); }}"); $chart->plotOptions->column->dataLabels->enabled = 1; $chart->plotOptions->column->dataLabels->color = new HighchartJsExpr("colors[0]"); $chart->plotOptions->column->dataLabels->style->fontWeight = "bold"; $chart->plotOptions->column->dataLabels->formatter = new HighchartJsExpr("function() { return this.y +'%';}"); $chart->tooltip->formatter = new HighchartJsExpr( "function() { var point = this.point, s = this.x +':<b>'+ this.y +'% market share</b><br/>'; if (point.drilldown) { s += 'Click to view '+ point.category +' versions'; } else { s += 'Click to return to browser brands'; } return s;}"); $chart->series[] = array( 'name' => new HighchartJsExpr("name"), 'data' => new HighchartJsExpr("data"), 'color' => 'white' ); $chart->exporting->enabled = false;