$chart = new Highchart(); $chart->chart->renderTo = 'container'; $chart->title->text = 'Daily visits at www.highcharts.com'; $chart->subtitle->text = 'Source: Google Analytics'; $chart->xAxis->type = 'datetime'; $chart->xAxis->tickInterval = 7 * 24 * 3600 * 1000; $chart->xAxis->tickWidth = 0; $chart->xAxis->gridLineWidth = 1; $chart->xAxis->labels->align = 'left'; $chart->xAxis->labels->x = 3; $chart->xAxis->labels->y = - 3; $leftYaxis = new HighchartOption(); $leftYaxis->title->text = null; $leftYaxis->labels->align = 'left'; $leftYaxis->labels->x = 3; $leftYaxis->labels->y = 16; $leftYaxis->labels->formatter = new HighchartJsExpr("function() { return Highcharts.numberFormat(this.value, 0);}"); $leftYaxis->showFirstLabel = false; $chart->yAxis[] = $leftYaxis; $rightYaxis = new HighchartOption(); $rightYaxis->linkedTo = 0; $rightYaxis->gridLineWidth = 0; $rightYaxis->opposite = true; $rightYaxis->title->text = null; $rightYaxis->labels->align = 'right'; $rightYaxis->labels->x = - 3; $rightYaxis->labels->y = 16; $rightYaxis->labels->formatter = new HighchartJsExpr("function() { return Highcharts.numberFormat(this.value, 0);}"); $rightYaxis->showFirstLabel = false; $chart->yAxis[] = $rightYaxis; // The yAxis can also be an array of non-associative arrays /* * $chart->yAxis = array(array('title' => array('text' => null), 'labels' => * array('align' => 'left', 'x' => 3, 'y' => 16, 'formatter' => new * HighchartJsExpr("function() { return Highcharts.numberFormat(this.value, * 0);}")), 'showFirstLabel' => false), array('linkedTo' => 0, 'gridLineWidth' * => 0, 'opposite' => true, 'title' => array('text' => null), 'labels' => * array('align' => 'right', 'x' => -3, 'y' => 16, 'formatter' => new * HighchartJsExpr("function() { return Highcharts.numberFormat(this.value, * 0);}")) )); */ $chart->legend = array( 'align' => 'left', 'verticalAlign' => 'top', 'y' => 20, 'floating' => true, 'borderWidth' => 0 ); $chart->tooltip = array( 'shared' => true, 'crosshairs' => true ); $clickFunction = new HighchartJsExpr( "function() { hs.htmlExpand(null, { pageOrigin: { x: this.pageX, y: this.pageY }, headingText: this.series.name, maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) +':<br/> '+ this.y +' visits', width: 200 }); }" ); $chart->plotOptions->series->cursor = 'pointer'; $chart->plotOptions->series->point->events->click = $clickFunction; $chart->plotOptions->series->marker->lineWidth = 1; $chart->series[] = array( 'name' => 'All visits', 'lineWidth' => 4, 'marker' => array( 'radius' => 4 ) ); $chart->series[]->name = 'New visitors';