当前位置: 首页>>代码示例>>PHP>>正文


PHP Highchart::setOptions方法代码示例

本文整理汇总了PHP中Highchart::setOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Highchart::setOptions方法的具体用法?PHP Highchart::setOptions怎么用?PHP Highchart::setOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Highchart的用法示例。


在下文中一共展示了Highchart::setOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

$chart->yAxis->title->text = "Value";
$chart->yAxis->plotLines[] = array('value' => 0, 'width' => 1, 'color' => "#808080");
$chart->tooltip->formatter = new HighchartJsExpr("function() {\n    return '<b>'+ this.series.name +'</b><br/>'+\n    Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+\n    Highcharts.numberFormat(this.y, 2); }");
$chart->legend->enabled = false;
$chart->exporting->enabled = false;
$chart->series[0]->name = "Random data";
$chart->series[0]->data = new HighchartJsExpr("(function() {\n    var data = [],\n        time = (new Date()).getTime(),\n        i;\n\n    for (i = -19; i <= 0; i++) {\n        data.push({\n            x: time + i * 1000,\n            y: Math.random()\n        });\n    }\n    return data; })()");
$globalOptions = new HighchartOption();
$globalOptions->global->useUTC = false;
?>

<html>
  <head>
    <title>Spline updating each second</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 Highchart::setOptions($globalOptions);
echo $chart->render("chart1");
?>
    </script>
  </body>
</html>
开发者ID:google-code-backups,项目名称:simplerisk,代码行数:31,代码来源:spline_updating_each_second.php

示例2: Highchart

$chart = new Highchart(Highchart::HIGHSTOCK);
$chart->chart->renderTo = "container";
$chart->chart->events->load = new HighchartJsExpr("function() {\n    var series = this.series[0];\n    setInterval(function() {\n        var x = (new Date()).getTime(), // current time\n        y = Math.round(Math.random() * 100);\n        series.addPoint([x, y], true, true);\n    }, 1000); }");
$chart->rangeSelector->buttons = array(array('type' => "minute", 'count' => 1, 'text' => "1M"), array('type' => "minute", 'count' => 5, 'text' => "5M"), array('type' => "all", 'text' => "All"));
$chart->rangeSelector->inputEnabled = false;
$chart->rangeSelector->selected = 0;
$chart->title->text = "Live random data";
$chart->exporting->enabled = false;
$chart->series[] = array('name' => "Random data", 'data' => new HighchartJsExpr("(function() {\n    var data = [], time = (new Date()).getTime(), i;\n\n    for( i = -999; i <= 0; i++) {\n        data.push([\n          time + i * 1000,\n          Math.round(Math.random() * 100)\n        ]);\n    }\n    return data;\n  })()"));
?>

<html>
    <head>
        <title>Dynamically updated data</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 
$option = new HighchartOption();
$option->global->useUTC = false;
echo Highchart::setOptions($option);
echo $chart->render("chart");
?>
        </script>
    </body>
</html>
开发者ID:mrtos,项目名称:OpenNVR,代码行数:31,代码来源:dynamically_updated_data.php


注:本文中的Highchart::setOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。