예제 #1
0
/**
 * 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>';
}
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>
  </body>
</html>
$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;
$detailChart->plotOptions->series->marker->enabled = false;
$detailChart->plotOptions->series->marker->states->hover->enabled = 1;
$detailChart->plotOptions->series->marker->states->hover->radius = 3;
$detailChart->series[] = array('name' => "USD to EUR", 'pointStart' => new HighchartJsExpr("detailStart"), 'pointInterval' => 24 * 3600 * 1000, 'data' => new HighchartJsExpr("detailData"));
$detailChart->exporting->enabled = false;
?>

<html>
  <head>
    <title>Master detail chart</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php 
foreach ($masterChart->getScripts() as $script) {
    echo '<script type="text/javascript" src="' . $script . '"></script>';
}
?>
  </head>
  <body>
    <div id="container"></div>
    <script type="text/javascript">
        var data = [
            0.8446, 0.8445, 0.8444, 0.8451, 0.8418, 0.8264, 0.8258, 0.8232, 0.8233, 0.8258,
            0.8283, 0.8278, 0.8256, 0.8292, 0.8239, 0.8239, 0.8245, 0.8265, 0.8261, 0.8269,
            0.8273, 0.8244, 0.8244, 0.8172, 0.8139, 0.8146, 0.8164, 0.82, 0.8269, 0.8269,
            0.8269, 0.8258, 0.8247, 0.8286, 0.8289, 0.8316, 0.832, 0.8333,  0.8352, 0.8357,
            0.8355, 0.8354, 0.8403, 0.8403, 0.8406, 0.8403, 0.8396, 0.8418, 0.8409, 0.8384,
            0.8386, 0.8372, 0.839, 0.84, 0.8389, 0.84, 0.8423, 0.8423, 0.8435, 0.8422,
            0.838, 0.8373, 0.8316, 0.8303,  0.8303, 0.8302, 0.8369, 0.84, 0.8385, 0.84,