本文整理汇总了PHP中Highchart类的典型用法代码示例。如果您正苦于以下问题:PHP Highchart类的具体用法?PHP Highchart怎么用?PHP Highchart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Highchart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tc_ratings_chart_dev_function
function tc_ratings_chart_dev_function($atts, $content = null)
{
extract(shortcode_atts(array("challengetype" => "", "handle" => ""), $atts));
$url = "http://api.topcoder.com/v2/develop/statistics/" . $handle . "/" . $challengetype . "/";
$cdata = get_data_dev($url);
$hseries = $cdata['hseries'];
$dseries = $cdata['dseries'];
/* ratings chart */
$ratingsChart = new Highchart();
$ratingsChart->chart = array('renderTo' => 'chart_' . $handle, 'type' => 'line', 'marginRight' => 15, 'marginLeft' => 30, 'marginBottom' => 20, 'marginTop' => 20, 'width' => 768);
$ratingsChart->credits = array('enabled' => false);
$ratingsChart->title = array('text' => null);
$ratingsChart->yAxis = array('title' => array('text' => null), 'plotLines' => array(array('value' => 0, 'width' => 1, 'color' => '#808080')), 'plotBands' => array(array("from" => 0, "to" => 899, "color" => "rgba(153, 153, 153, 0.2)"), array("from" => 900, "to" => 1199, "color" => "rgba(0, 169, 0, 0.2)"), array("from" => 1200, "to" => 1499, "color" => "rgba(102, 102, 255, 0.2)"), array("from" => 1500, "to" => 2199, "color" => "rgba(221, 204, 0, 0.2)"), array("from" => 2200, "to" => 10000, "color" => "rgba(238, 0, 0, 0.2)")));
$ratingsChart->xAxis = array('type' => "datetime", dateTimeLabelFormats => array(year => '%Y'), tickInterval => 24 * 3600 * 1000 * 356);
$ratingsChart->legend = array('enabled' => false);
$ratingsChart->tooltip = array('formatter' => new HighchartJsExpr("function() {\n\t\t return 'Challenge: <b>'+ this.point.name +'</b><br/>Date: '+\n\t\t Highcharts.dateFormat('%e %b %Y', this.x) +'<br/>Rating: '+ this.y ;\n\t\t }"));
$ratingsChart->series[] = array('name' => 'Rating', 'color' => '#888888', "lineWidth" => 1, 'data' => $hseries);
/* distribution chart */
$distChart = new Highchart();
$distChart->chart = array('renderTo' => 'chart_d_' . $handle, 'type' => 'column', 'marginRight' => 20, 'marginBottom' => 70, 'width' => 768);
$distChart->credits = array('enabled' => false);
$distChart->title = array('text' => null);
$distChart->yAxis = array('title' => array('text' => null), 'plotLines' => array(array('value' => 0, 'width' => 1, 'color' => '#808080')));
$distChart->xAxis = array('title' => array('text' => null), 'min' => 50, 'labels' => array('rotation' => 90, 'step' => 1, 'formatter' => new HighchartJsExpr("function() {\n\t\t\t\t\t\tvar vm = parseInt(this.value)-50;\n\t\t\t\t\t\tvar vMx = parseInt(this.value)+49;\n\t\t\t\t\t\treturn vm+'-'+vMx;\n\t\t\t\t\t}"), 'y' => 18, 'x' => -4), tickPositioner => new HighchartJsExpr("function () {\n\t\t\t\tvar positions = [],\n\t\t\t\ttick = 50,\n\t\t\t\tincrement = 100;\n\t\t\t\n\t\t\t\tfor (; tick - increment <= this.dataMax; tick += increment) {\n\t\t\t\t\tpositions.push(tick);\n\t\t\t\t}\n\t\t\t\treturn positions;\n\t\t\t}"));
$distChart->legend = array('enabled' => false);
$distChart->tooltip = array('formatter' => new HighchartJsExpr("function() {\n\t\t return this.y + (this.y==1?' Coder':' Coders');\n\t\t }"));
$distChart->series[] = array('name' => 'Distribution', 'color' => '#888888', "lineWidth" => 1, 'data' => $dseries);
$html = "\n\t\t<div class='ratingChart distributionType' id='chart_d_{$handle}'></div>\n\t\t<div class='ratingChart historyType' id='chart_{$handle}'></div>\n\t";
global $dev;
$html .= "\n\t\t\t<script type='text/javascript'>\n\t\t\t\tvar chart_{$handle};\n\t\t\t\tvar chart_d_{$handle};\n\t\t\t\tvar currentDistChart;\n\t\t\t\tvar currentChart;\n\t\t\t\tvar ct = \$.trim(\$('.tabNavHead .isActive').text());\n\t\t\t\t\n\t\t\t\$(document).ready(function(){\n\t\t\t\t" . $ratingsChart->render('chart_' . $handle) . "; \n\t\t\t\tcurrentChart = chart_{$handle};\n\t\t\t\t\t\t\n\t\t\t\t" . $distChart->render('chart_d_' . $handle) . "; \n\t\t\t\tcurrentDistChart = chart_d_" . $handle . ";\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tcurrentDistChart.xAxis[0].addPlotLine({\n\t\t value: " . $dev->rating . ",\n\t\t color: '" . get_point_color($dev->rating) . "',\n\t\t width: 2,\n \t\tlabel : {\n\t\t\t\t\t\t\ttext: '" . $dev->rating . "',\n\t\t\t\t\t\t\tstyle:{'color': '" . get_point_color($dev->rating) . "'}\n\t\t\t\t\t\t}\n\t\t });\n\t\t\t\t})\n\t\t \t\n\t\t\t</script>\n\t\t\t";
return $html;
}
示例2: testRenderOptionsEncoding
public function testRenderOptionsEncoding()
{
//Check for encoding problems
$chart = new Highchart();
$chart->test->utf8String = "áù anything ü";
$chart->test->iso88591 = iconv("UTF-8", "ISO-8859-1", "áù anything ü");
$result = $chart->renderOptions();
$this->assertEquals('{"test":{"utf8String":"\\u00e1\\u00f9 anything \\u00fc","iso88591":"\\u00e1\\u00f9 anything \\u00fc"}}', $result);
}
示例3: Highchart
<?php
include_once "../../../Highchart.php";
$chart = new Highchart();
$chart->chart->renderTo = "container";
$chart->title->text = "Logarithmic axis demo";
$chart->xAxis->tickInterval = 1;
$chart->yAxis->type = "logarithmic";
$chart->yAxis->minorTickInterval = 0.1;
$chart->tooltip->headerFormat = "<b>{series.name}</b><br />";
$chart->tooltip->pointFormat = "x = {point.x}, y = {point.y}";
$chart->series[] = array('data' => array(1, 2, 4, 8, 16, 32, 64, 128, 256, 512), 'pointStart' => 1);
?>
<html>
<head>
<title>Logarithmic axis</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
foreach ($chart->getScripts() as $script) {
echo '<script type="text/javascript" src="' . $script . '"></script>';
}
?>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
<?php
echo $chart->render("chart1");
?>
</script>
示例4: Highchart
<?php
include_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Highchart.php';
$chart = new Highchart();
$chart->chart = array('renderTo' => 'container', 'type' => 'line', 'marginRight' => 130, 'marginBottom' => 25);
$chart->title = array('text' => 'Monthly Average Temperature', 'x' => -20);
$chart->subtitle = array('text' => 'Source: WorldClimate.com', 'x' => -20);
$chart->xAxis->categories = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
$chart->yAxis = array('title' => array('text' => 'Temperature (°C)'), 'plotLines' => array(array('value' => 0, 'width' => 1, 'color' => '#808080')));
$chart->legend = array('layout' => 'vertical', 'align' => 'right', 'verticalAlign' => 'top', 'x' => -10, 'y' => 100, 'borderWidth' => 0);
$chart->series[] = array('name' => 'Tokyo', 'data' => array(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6));
$chart->series[] = array('name' => 'New York', 'data' => array(-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5));
$chart->series[] = array('name' => 'Berlin', 'data' => array(-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0));
$chart->series[] = array('name' => 'London', 'data' => array(3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8));
$chart->tooltip->formatter = new HighchartJsExpr("function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +'°C';}");
?>
<html>
<head>
<title>Basic Line</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$chart->printScripts();
?>
</head>
<body>
<div id="container"></div>
<script type="text/javascript"><?php
echo $chart->render("chart1");
?>
</script>
示例5: Highchart
<?php
include_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Highchart.php';
$chart = new Highchart();
$chart->chart->renderTo = "container";
$chart->chart->type = "column";
$chart->title->text = "Data extracted from a HTML table in the page";
$chart->xAxis = new HighchartOption();
// We need it to be empty to avoid js
// errors
$chart->yAxis->title->text = "Units";
$chart->tooltip->formatter = new HighchartJsExpr("function() {\n return '<b>'+ this.series.name +'</b><br/>'+\n this.y +' '+ this.x.toLowerCase();}");
?>
<html>
<head>
<title>Data defined in a HTML table</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$chart->printScripts();
?>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
$(document).ready(function() {
Highcharts.visualize = function(table, options) {
// the categories
options.xAxis.categories = [];
$('tbody th', table).each( function(i) {
options.xAxis.categories.push(this.innerHTML);
示例6: Highchart
<?php
include_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Highchart.php';
$chart = new Highchart();
$chart->includeExtraScripts();
$chart->chart->renderTo = 'container';
$chart->chart->polar = true;
$chart->chart->type = 'line';
$chart->title->text = 'Budget vs spending';
$chart->title->x = -80;
$chart->pane->size = '80%';
$chart->pane->endAngle = 360;
$chart->xAxis->categories = array('Sales', 'Marketing', 'Development', 'Customer Support', 'Information Technology', 'Administration');
$chart->xAxis->tickmarkPlacement = 'on';
$chart->xAxis->lineWidth = 0;
$chart->yAxis->gridLineInterpolation = 'polygon';
$chart->yAxis->lineWidth = 0;
$chart->yAxis->min = 0;
$chart->tooltip->shared = true;
$chart->tooltip->pointFormat = '<span style="color:{series.color}">{series.name}: <b>${point.y:,.0f}</b><br/>';
$chart->legend->align = 'right';
$chart->legend->verticalAlign = 'top';
$chart->legend->y = 70;
$chart->legend->layout = 'vertical';
$chart->series = array(array('name' => 'Allocated Budget', 'data' => array(43000, 19000, 60000, 35000, 17000, 10000), 'pointPlacement' => 'on'), array('name' => 'Actual Spending', 'data' => array(50000, 39000, 42000, 31000, 26000, 14000), 'pointPlacement' => 'on'));
?>
<html>
<head>
<title>Spiderweb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
示例7: HighchartJsExpr
$masterChart->yAxis->min = 0.6;
$masterChart->yAxis->showFirstLabel = false;
$masterChart->tooltip->formatter = new HighchartJsExpr("function() {\n return false; }");
$masterChart->legend->enabled = false;
$masterChart->credits->enabled = false;
$masterChart->plotOptions->series->fillColor->linearGradient = array(0, 0, 0, 70);
$masterChart->plotOptions->series->fillColor->stops[] = array(0, '#4572A7');
$masterChart->plotOptions->series->fillColor->stops[] = array(1, 'rgba(0,0,0,0)');
$masterChart->plotOptions->series->lineWidth = 1;
$masterChart->plotOptions->series->marker->enabled = false;
$masterChart->plotOptions->series->shadow = false;
$masterChart->plotOptions->series->states->hover->lineWidth = 1;
$masterChart->plotOptions->series->enableMouseTracking = false;
$masterChart->series[] = array('type' => "area", 'name' => "USD to EUR", 'pointInterval' => 24 * 3600 * 1000, 'pointStart' => new HighchartJsExpr("Date.UTC(2006, 0, 01)"), 'data' => new HighchartJsExpr("data"));
$masterChart->exporting->enabled = false;
$detailChart = new Highchart();
$detailChart->chart->marginBottom = 120;
$detailChart->chart->renderTo = "detail-container";
$detailChart->chart->reflow = false;
$detailChart->chart->marginLeft = 50;
$detailChart->chart->marginRight = 20;
$detailChart->chart->style->position = "absolute";
$detailChart->credits->enabled = false;
$detailChart->title->text = "Historical USD to EUR Exchange Rate";
$detailChart->subtitle->text = "Select an area by dragging across the lower chart";
$detailChart->xAxis->type = "datetime";
$detailChart->yAxis->title->text = null;
$detailChart->yAxis->maxZoom = 0.1;
$chart->tooltip->formatter = new HighchartJsExpr("function() {\n var point = this.points[0];\n return '<b>'+ point.series.name +'</b><br/>'+\n Highcharts.dateFormat('%A %B %e %Y', this.x) + ':<br/>'+\n '1 USD = '+ Highcharts.numberFormat(point.y, 2) +' EUR'; }");
$detailChart->tooltip->shared = 1;
$detailChart->legend->enabled = false;
示例8: tc_ratings_chart_ds_function
function tc_ratings_chart_ds_function($atts, $content = null)
{
extract(shortcode_atts(array("contest" => "", "handle" => ""), $atts));
$url = "http://api.topcoder.com/v2/users/" . $handle . "/statistics/" . $contest;
$args = array('httpversion' => get_option('httpversion'), 'timeout' => get_option('request_timeout'));
$response = wp_remote_get($url, $args);
if (is_wp_error($response) || !isset($response['body'])) {
return "Error";
}
if ($response['response']['code'] == 200) {
$data = json_decode($response['body']);
}
/* rating history data */
$history = $data->History;
// date format is like: 2005.09.07
$hseries = array();
foreach ($history as &$score) {
$date = explode(".", $score->date);
$dateExp = "Date.UTC(" . $date[0] . "," . $date[1] . "," . $date[2] . ")";
$tTipName = "Contest Name:";
$challengeName = $score->challengeName;
if (empty($challengeName)) {
$tTipName = "Contest Id:";
$challengeName = $score->challengeId;
}
array_push($hseries, array('x' => new HighchartJsExpr($dateExp), 'y' => $score->rating, 'name' => $challengeName, 'marker' => array('fillColor' => get_point_color($score->rating), 'radius' => 4, 'lineWidth' => 0, 'lineColor' => '#666')));
}
$maxVal = -1;
$hMax = "";
$count = 0;
foreach ($hseries as &$hVal) {
if ($hVal['y'] > $maxVal) {
$hMax = $count;
$maxVal = $hVal['y'];
}
$count += 1;
}
$hseries[$hMax]['marker']['lineWidth'] = "2";
$hseries[$hMax]['marker']['radius'] = "8";
foreach ($hseries as $key => $row) {
$x[$key] = $row['x'];
}
array_multisort($x, SORT_ASC, $hseries);
/* Distribution data */
$distribution = $data->Distribution;
$dseries = array();
foreach ($distribution as &$point) {
$range = explode("-", $point->range);
// explode($point->range);
$mean = ((int) $range[0] + (int) $range[1]) / 2;
array_push($dseries, array('x' => $mean, 'y' => $point->number == 0 ? null : $point->number, 'color' => get_point_color($mean)));
}
$cdata = array('hseries' => $hseries, 'dseries' => $dseries);
$ratingsChart = new Highchart();
$ratingsChart->chart = array('renderTo' => 'chart_' . $handle, 'type' => 'line', 'marginRight' => 20, 'marginBottom' => 20, 'width' => 768);
$ratingsChart->credits = array('enabled' => false);
$ratingsChart->title = array('text' => null);
$ratingsChart->yAxis = array('title' => array('text' => null), 'plotLines' => array(array('value' => 0, 'width' => 1, 'color' => '#808080')), 'plotBands' => array(array("from" => 0, "to" => 899, "color" => "rgba(153, 153, 153, 0.2)"), array("from" => 900, "to" => 1199, "color" => "rgba(0, 169, 0, 0.2)"), array("from" => 1200, "to" => 1499, "color" => "rgba(102, 102, 255, 0.2)"), array("from" => 1500, "to" => 2199, "color" => "rgba(221, 204, 0, 0.2)"), array("from" => 2200, "to" => 10000, "color" => "rgba(238, 0, 0, 0.2)")));
$ratingsChart->xAxis = array('type' => "datetime", 'title' => array('text' => null), dateTimeLabelFormats => array(year => '%Y'), tickInterval => 24 * 3600 * 1000 * 356);
$ratingsChart->legend = array('enabled' => false);
$ratingsChart->tooltip = array('formatter' => new HighchartJsExpr("function() {\n\t\t return '" . $tTipName . " <b>'+ this.point.name +'</b><br/>Date: '+\n\t\t Highcharts.dateFormat('%e %b %Y', this.x) +'<br/>Rating: '+ this.y ;\n\t\t }"));
$ratingsChart->series[] = array('name' => 'Rating', 'color' => '#888888', "lineWidth" => 1, 'data' => $hseries);
/* distribution chart */
$distChart = new Highchart();
$distChart->chart = array('renderTo' => 'chart_d_' . $handle, 'type' => 'column', 'marginRight' => 20, 'marginBottom' => 70, 'width' => 768);
$distChart->credits = array('enabled' => false);
$distChart->title = array('text' => null);
$distChart->plotOptions = array('series' => array('minPointLength' => 3));
$distChart->yAxis = array('title' => array('text' => null), 'plotLines' => array(array('value' => 0, 'width' => 1, 'color' => '#808080')));
$distChart->xAxis = array('title' => array('text' => null), 'min' => 50, 'labels' => array('rotation' => 90, 'step' => 1, 'formatter' => new HighchartJsExpr("function() {\n\t\t\t\t\t\tvar vm = parseInt(this.value)-50;\n\t\t\t\t\t\tvar vMx = parseInt(this.value)+49;\n\t\t\t\t\t\treturn vm+'-'+vMx;\n\t\t\t\t\t}"), 'y' => 18, 'x' => -4), tickPositioner => new HighchartJsExpr("function () {\n\t\t\t\tvar positions = [],\n\t\t\t\ttick = 50,\n\t\t\t\tincrement = 100;\n\t\t\t\n\t\t\t\tfor (; tick - increment <= this.dataMax; tick += increment) {\n\t\t\t\t\tpositions.push(tick);\n\t\t\t\t}\n\t\t\t\treturn positions;\n\t\t\t}"));
$distChart->legend = array('enabled' => false);
$distChart->tooltip = array('formatter' => new HighchartJsExpr("function() {\n\t\t return this.y + (this.y==1?' Coder':' Coders');\n\t\t }"));
$distChart->series[] = array('name' => 'Rating', 'color' => '#888888', "lineWidth" => 1, 'data' => $dseries);
global $coder;
$html = "\n\t\t<div class='ratingChart distributionType' id='chart_d_{$handle}'></div>\n\t\t<div class='ratingChart historyType' id='chart_{$handle}'></div>\n\t";
$html .= "\n\t\t\t<script type='text/javascript'>\t\n\t\t\t\tvar chart_{$handle};\n\t\t\t\tvar chart_d_{$handle};\n\t\t\t\t\n\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t" . $ratingsChart->render('chart_' . $handle) . "; var currentChart = chart_" . $handle . ";\n\t\t\t\t" . $distChart->render('chart_d_' . $handle) . "; var currentDistChart = chart_d_" . $handle . ";\n\t\t\t\t\t\t\n\t\t\t\t\t\tcurrentDistChart.xAxis[0].addPlotLine({\n\t\t value: " . $coder->rating . ",\n\t\t color: '" . get_point_color($coder->rating) . "',\n\t\t width: 2,\n \t\tlabel : {\n\t\t\t\t\t\t\ttext: '" . $coder->rating . "',\n\t\t\t\t\t\t\tstyle:{'color': '" . get_point_color($coder->rating) . "'}\n\t\t\t\t\t\t}\n\t\t });\n\t\t\t\t})\n\t\t\t</script>\n\t\t\t";
return $html;
}
示例9: Highchart
<?php
include_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Highchart.php';
$chart = new Highchart();
$chart->includeExtraScripts();
$chart->chart = array('type' => 'gauge', 'alignTicks' => false, 'plotBackgroundColor' => null, 'plotBackgroundImage' => null, 'plotBorderWidth' => 0, 'plotShadow' => false);
$chart->title->text = 'Speedometer with dual axes';
$chart->pane->startAngle = -150;
$chart->pane->endAngle = 150;
$chart->yAxis = array(array('min' => 0, 'max' => 200, 'lineColor' => '#339', 'tickColor' => '#339', 'minorTickColor' => '#339', 'offset' => -25, 'lineWidth' => 2, 'labels' => array('distance' => -20, 'rotation' => 'auto'), 'tickLength' => 5, 'minorTickLength' => 5, 'endOnTick' => 'false'), array('min' => 0, 'max' => 124, 'tickPosition' => 'outside', 'lineColor' => '#933', 'lineWidth' => 2, 'minorTickPosition' => 'outside', 'tickColor' => '#933', 'minorTickColor' => '#933', 'tickLength' => 5, 'minorTickLength' => 5, 'labels' => array('distance' => 12, 'rotation' => 'auto'), 'offset' => -20, 'endOnTick' => 'false'));
$chart->series[] = array('name' => 'Speed', 'data' => array(80), 'dataLabels' => array('formatter' => new HighchartJsExpr("function () {\n var kmh = this.y,\n mph = Math.round(kmh * 0.621);\n return '<span style=\"color:#339\">'+ kmh + ' km/h</span><br/>' +\n '<span style=\"color:#933\">' + mph + ' mph</span>'; }"), 'backgroundColor' => array('linearGradient' => array('x1' => 0, 'y1' => 0, 'x2' => 0, 'y2' => 1), 'stops' => array(array(0, '#DDD'), array(1, '#FFF')))), 'tooltip' => array('valueSuffix' => 'km/h'));
?>
<html>
<head>
<title>Gauge with dual axes</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$chart->printScripts();
?>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
$('#container').highcharts(<?php
echo $chart->renderOptions();
?>
,
// Add some life
function(chart) {
setInterval(function() {
示例10: Highchart
include_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Highchart.php';
$chart = new Highchart();
$chart->chart->renderTo = "container";
$chart->chart->type = "pie";
$chart->title->text = "Browser market share, April, 2011";
$chart->yAxis->title->text = "Total percent market share";
$chart->plotOptions->pie->shadow = false;
$chart->tooltip->formatter = new HighchartJsExpr("function() {\n return '<b>'+ this.point.name +'</b>: '+ this.y +' %'; }");
$chart->series[] = array('name' => "Browsers", 'data' => new HighchartJsExpr("browserData"), 'size' => "60%", 'dataLabels' => array('formatter' => new HighchartJsExpr("function() {\n return this.y > 5 ? this.point.name : null; }"), 'color' => 'white', 'distance' => -30));
$chart->series[1]->name = "Versions";
$chart->series[1]->data = new HighchartJsExpr("versionsData");
$chart->series[1]->innerSize = "60%";
$chart->series[1]->dataLabels->formatter = new HighchartJsExpr("function() {\n return this.y > 1 ? '<b>'+ this.point.name +':</b> '+ this.y +'%' : null;}");
// We can also use Highchart library to produce any kind of javascript
// structures
$chartData = new Highchart();
$chartData[0]->y = 55.11;
$chartData[0]->color = new HighchartJsExpr("colors[0]");
$chartData[0]->drilldown->name = "MSIE versions";
$chartData[0]->drilldown->categories = array('MSIE 6.0', 'MSIE 7.0', 'MSIE 8.0', 'MSIE 9.0');
$chartData[0]->drilldown->data = array(10.85, 7.35, 33.06, 2.81);
$chartData[0]->drilldown->color = new HighchartJsExpr("colors[0]");
$chartData[1]->y = 21.63;
$chartData[1]->color = new HighchartJsExpr("colors[1]");
$chartData[1]->drilldown->name = "Firefox versions";
$chartData[1]->drilldown->categories = array('Firefox 2.0', 'Firefox 3.0', 'Firefox 3.5', 'Firefox 3.6', 'Firefox 4.0');
$chartData[1]->drilldown->data = array(0.2, 0.83, 1.58, 13.12, 5.43);
$chartData[1]->drilldown->color = new HighchartJsExpr("colors[1]");
$chartData[2]->y = 11.94;
$chartData[2]->color = new HighchartJsExpr("colors[2]");
$chartData[2]->drilldown->name = "Chrome versions";
示例11: Highchart
<tr>
<td>' . $s['disk name'] . '</td>
<td>' . $s['disk info']['all size'] . '</td>
<td>' . $s['disk info']['free size'] . '</td>
<td>' . $s['disk info']['used size'] . '</td>
</tr>
';
}
echo '</tbody></table><br/>';
break;
case 'rtmp':
echo $stat;
break;
case 'load':
Yii::import('ext.charts.*');
$chart = new Highchart();
$chart->tooltip->formatter = new HighchartJsExpr("function() { return this.y + ' : ' + this.x; }");
$chart->printScripts();
$i = 0;
//print_r($stat);
foreach ($stat as $key => $value) {
if ($key == 'time') {
continue;
}
echo '<div id="container' . $i . '"></div><br/>';
$chart->chart = array('renderTo' => 'container' . $i, 'type' => 'line', 'marginRight' => 130, 'marginBottom' => 50, 'spacingBottom' => 30);
$chart->title = array('text' => $key, 'x' => -20);
$chart->xAxis = array('categories' => $stat['time'], 'offset' => 20);
$chart->yAxis = array('title' => array('text' => Yii::t('admin', 'Value')), 'min' => 0, 'plotLines' => array(array('value' => 0, 'width' => 1, 'color' => '#808080')));
$chart->legend = array('layout' => 'vertical', 'align' => 'right', 'verticalAlign' => 'top', 'x' => -10, 'y' => 100, 'borderWidth' => 0);
$chart->series = array();
示例12: chartDashboard
function chartDashboard($settings)
{
//Setup analytics
$analytics = getAnalytics();
//Get data
$colors = getColorScheme();
try {
$data = runQuery($analytics, $settings["Account"], $settings["From"], $settings["To"], "ga:pageviews,ga:users", "ga:date");
if (isset($data->ga_error)) {
DoNotCache();
$data = array();
$data[0] = array();
$data[0][0] = 0;
$data[1] = array();
$data[2] = array();
} else {
$data = invertData($data->getRows());
}
} catch (Exception $e) {
return json_encode($e);
}
$att = getAttendanceData($settings["From"], $settings["To"], tryGet("location"));
//Form chart
date_default_timezone_set('UTC');
$start = strtotime($settings["From"]);
$int = 1 * 24 * 60 * 60;
//1 day
$chart = new Highchart('areaspline');
$chart->addPlotOption('fillOpacity', 0.2);
$chart->addSeries($data[1], 'Pageviews', $colors[0]);
$chart->addSeries($data[2], 'Users', $colors[1]);
$chart->addSeries($att, 'Attendance', 'rgba(35,145,35,1)');
if (tryGet('twitter')) {
$chart->addSeries(array(), 'Tweets', 'rgb(80, 171, 241)', array('visible' => false));
}
if (tryGet('fb')) {
$chart->addSeries(array(), 'Facebook Posts', 'rgba(68,97,157, 1)', array('visible' => false));
}
if (tryGet('ig')) {
$chart->addSeries(array(), 'Instagram Images', 'rgba(185,163,140, 1)', array('visible' => false));
}
if (tryGet('ga')) {
$chart->addSeries(array(), 'Anomalies', 'rgba(247,153,28, 1)', array('visible' => false));
}
$chart->addTimestamps($start * 1000, $int * 1000);
//print $chart->toJson();
return $chart->toJson();
}
示例13: Highchart
<?php
include_once "../../../Highchart.php";
$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);}");
示例14: renderChart
/**
* renderChart
*
* display simple text on the web page
*
* @param Highchart $chart number of spaces
* int $id_chart id of the chart in the div to display the content and render it
* @return nothing nothing
*/
function renderChart($chart, $id_chart)
{
foreach ($chart->getScripts() as $script) {
echo '<script type="text/javascript" src="' . $script . '"></script>';
}
echo '<script type="text/javascript">' . $chart->render($id_chart) . '</script>';
}
示例15: array
$srmD1Chart->tooltip->enabled = false;
$srmD1Chart->series[] = array('type' => "pie", 'innerSize' => "90%", 'name' => "Rating", 'data' => array(array('name' => "Division 1", 'color' => "#81bc01", 'y' => $srmD1), array('name' => "null", 'color' => "#eeeeee", 'y' => 100 - $srmD1)));
// donut chart
$srmD2Chart = new Highchart();
$srmD2Chart->credits = array('enabled' => false);
$srmD2Chart->chart = array('renderTo' => 'srmD2Chart', 'type' => 'pie', 'margin' => 0, 'marginRight' => 0, 'marginBottom' => 0, 'width' => 236, 'height' => 164);
$srmD2Chart->plotOptions->pie->dataLabels->enabled = false;
$srmD2Chart->plotOptions->pie->borderWidth = 0;
$srmD2Chart->title->text = null;
$srmD2Chart->yAxis->title->enabled = false;
$srmD2Chart->plotOptions->pie->shadow = false;
$srmD2Chart->plotOptions->pie->states->hover = false;
$srmD2Chart->tooltip->enabled = false;
$srmD2Chart->series[] = array('type' => "pie", 'innerSize' => "90%", 'name' => "Rating", 'data' => array(array('name' => "Division 2", 'color' => "#81bc01", 'y' => $srmD2), array('name' => "null", 'color' => "#eeeeee", 'y' => 100 - $srmD2)));
// donut chart
$srmClnge = new Highchart();
$srmClnge->credits = array('enabled' => false);
$srmClnge->chart = array('renderTo' => 'srmChallenge', 'type' => 'pie', 'margin' => 0, 'marginRight' => 0, 'marginBottom' => 0, 'width' => 236, 'height' => 164);
$srmClnge->plotOptions->pie->dataLabels->enabled = false;
$srmClnge->plotOptions->pie->borderWidth = 0;
$srmClnge->title->text = null;
$srmClnge->yAxis->title->enabled = false;
$srmClnge->plotOptions->pie->shadow = false;
$srmClnge->plotOptions->pie->states->hover = false;
$srmClnge->tooltip->enabled = false;
$srmClnge->series[] = array('type' => "pie", 'innerSize' => "90%", 'name' => "Rating", 'data' => array(array('name' => "Challenge", 'color' => "#ffae00", 'y' => $srmClngeVal), array('name' => "null", 'color' => "#eeeeee", 'y' => 100 - $srmClngeVal)));
}
?>