dongqu9972 2017-04-24 12:09
浏览 67

index.php:212未捕获的ReferenceError:未定义FusionCharts

i want to retrieve data from mysql database into bar chart using Fusion chart. but i get this error when try to debug with console log (ctrl+shift+j in chrome): index.php:212 Uncaught ReferenceError: FusionCharts is not defined

here is my code so far

<?php
                            include "../../koneksi.php";
                            //require_once __DIR__ . '/fusioncharts.php';
                            include "fusioncharts.php";

                        // Form the SQL query that returns the top 10 most populous countries
                          $strQuery = mysql_query("select calType, count(cal_num) as count from calequipment Group By CalType order by calType desc");

                          // If the query returns a valid response, prepare the JSON string
                          if ($strQuery) {
                            // The `$arrData` array holds the chart attributes and data
                            $arrData = array(
                              "chart" => array(
                                  "caption" => "Calibration Type",
                                  "paletteColors" => "#0075c2",
                                  "bgColor" => "#ffffff",
                                  "borderAlpha"=> "20",
                                  "canvasBorderAlpha"=> "0",
                                  "usePlotGradientColor"=> "0",
                                  "plotBorderAlpha"=> "10",
                                  "showXAxisLine"=> "1",
                                  "xAxisLineColor" => "#999999",
                                  "showValues" => "0",
                                  "divlineColor" => "#999999",
                                  "divLineIsDashed" => "1",
                                  "showAlternateHGridColor" => "0"
                                )
                            );

                            $arrData["data"] = array();

                            // Push the data into the array
                            while($row = mysql_fetch_assoc($strQuery)) {
                              array_push($arrData["data"], array(
                                  "label" => $row["calType"],
                                  "value" => $row["count"]
                                  )
                              );
                            }

                            /*JSON Encode the data to retrieve the string containing the JSON representation of the data in the array. */

                            $jsonEncodedData = json_encode($arrData);

                            /*Create an object for the column chart using the FusionCharts PHP class constructor. Syntax for the constructor is ` FusionCharts("type of chart", "unique chart id", width of the chart, height of the chart, "div id to render the chart", "data format", "data source")`. Because we are using JSON data to render the chart, the data format will be `json`. The variable `$jsonEncodeData` holds all the JSON data for the chart, and will be passed as the value for the data source parameter of the constructor.*/

                            $columnChart = new FusionCharts("Pie3D", "myFirstChart" , 600, 300, "chart-1", "json", $jsonEncodedData);

                            // Render the chart
                            $columnChart->render();

                          }
                        ?>

the error said in line 212 and line 217. this the code :

212. <div class="panel panel-default">
217. <?php

its not make sense so i feel confused

i sure that the path includes correctly. please anyone help me. every suggestion would be appreciate thanks :)

edit: i got something different between my php file and console log file. i mean when i try to see the code in console log, the error is in this code:

<script type="text/javascript">
        FusionCharts.ready(function () {
            new FusionCharts({"type":"Pie3D","id":"myFirstChart","width":600,"height":300,"renderAt":"chart-1","dataFormat":"json","dataSource":{"chart":{"caption":"Calibration Type","paletteColors":"#0075c2","bgColor":"#ffffff","borderAlpha":"20","canvasBorderAlpha":"0","usePlotGradientColor":"0","plotBorderAlpha":"10","showXAxisLine":"1","xAxisLineColor":"#999999","showValues":"0","divlineColor":"#999999","divLineIsDashed":"1","showAlternateHGridColor":"0"},"data":[{"label":"Internal","value":"1"},{"label":"External","value":"2"}]}});
        });
    </script>
    <script type="text/javascript">
        FusionCharts.ready(function () {
            FusionCharts("myFirstChart").render();
        });
    </script>

but that code is very different with my php file when i open in notepad++

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测