Greetings everyone!
I am new to PHP development and need to use highgraphs stock in my cake PHP based webpage. I am able to use the simple high graph chart but the stock chart is not working. Any help or guidance in this regard will be highly appreciated. Thanks
Hi @hassam91,
Please share some code or let us know what issues you facing along with implementation steps you are doing.
Hello, Kindly find the codes below:
In ArticlesController.php
$stockChart = new Highchart(Highchart::HIGHSTOCK); $stockChart->series[] = array('name' => 'Tokyo', 'data' => array(7.0, 6.9, 9.5), 'renderTo' => 'container'); $this->set( compact( 'chart' ) );
In index.php `
< div id=“container” style=“height: 400px; min-width: 310px”> <?php $stockChart->printScripts(); ?> <script type="text/javascript"> <?php echo $stockChart->render("chart");?> </script>
< div id=“container” style=“height: 400px; min-width: 310px”> <?php $stockChart->printScripts(); ?>
<script type="text/javascript"> <?php echo $stockChart->render("chart");?> </script>
I was able to resolve it. By using $stockChart->chart instead of $stockChart->stockChart