Fusion Charts FusionTime 从 mySQL 制作时间序列图表

问题描述 投票:0回答:2

我是所有编码方面的初学者,但如果有人可以提供帮助,我需要一些 Fusion Charts 的帮助。

我已经按照 Fusion Charts 的教程将其链接到 MySQL 数据库并毫无问题地显示图表。

但是,我想显示一个时间序列图表,它使用FusionTime。这要求数据位于数据表中。 “FusionTime 接受行和列中的数据作为数据表”。

我无法在网上找到任何获取 SQL 数据并将其转换为包含其似乎需要的数据和模式的数据表的示例。这与 fusioncharts 的工作方式不同。

https://www.fusioncharts.com/dev/fusiontime/getting-started/create-your-first-chart-in-fusiontime

My SQL 数据库包含许多表和许多列,因此需要选择适当的列来显示。

我将不胜感激任何人可以提供的任何建议。主要问题是我不知道如何将 SQL 数据库放入数据和模式文件中以通过 fusiontime 显示。这将显示在本地托管的网页上。

非常感谢您随时提供帮助

java html mysql fusioncharts
2个回答
0
投票

您可以参考文档来实现案例,对您有帮助-

  1. 使用主机名、用户名、密码和数据库名称建立与 MySQL 数据库的连接。
  2. 执行查询从数据库获取玩家列表并将其存储在变量中。
  3. 迭代结果集以构建映射数组,其中每个映射由两个键组成,即:标签和值。

https://www.fusioncharts.com/dev/using-with-server-side-languages/tutorials/php-mysql-charts

<?php
    //address of the server where db is installed
    $servername = "localhost";
    //username to connect to the db
    //the default value is root
    $username = "root";
    //password to connect to the db
    //this is the value you specified during installation of WAMP stack
    $password = "password";
    //name of the db under which the table is created
    $dbName = "test";
    //establishing the connection to the db.
    $conn = new mysqli($servername, $username, $password, $dbName);
    //checking if there were any error during the last connection attempt
    if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
    }
?>

另请参阅此 - https://www.fusioncharts.com/blog/javascript-charts-using-php-and-mysql-with-fusioncharts-xt-part-2/


-1
投票

ft需要一个json,你必须从php类型json编写一个文件

像这样 ......

 $result = json_encode($dataIngGast, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE |JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT);
         //echo $result;
         
         $arquivo = "column-line-combination-data-gasto-ingreso-finanzas.json";
         $fp = fopen($arquivo, "a+");
         fwrite($fp, $result);
         
fclose($fp);
© www.soinside.com 2019 - 2024. All rights reserved.