File "chart_01.php"
Full Path: /home/analogde/www/download/CHESS_2022/chart_01.php
File size: 6.79 KB
MIME-type: text/html
Charset: utf-8
<!doctype html>
<html>
<head>
<!--
<script src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
-->
<script src="Charts_2022/js/fusioncharts.js"></script>
</head>
<body>
<div id="chart-container"></div>
<script>
FusionCharts.ready(function () {
// chart instance
var chart = new FusionCharts({
type: "column2d",
renderAt: "chart-container", // container where chart will render
width: "600",
height: "400",
dataFormat: 'xmlurl',
dataSource: 'data.xml'
//dataFormat: "json",
/*dataSource: {
// chart configuration
chart: {
caption: "Countries With Most Oil Reserves [2017-18]",
subcaption: "In MMbbl = One Million barrels"
},
// chart data
data: [
{ label: "Venezuela", value: "290000" },
{ label: "Saudi", value: "260000" },
{ label: "Canada", value: "180000" },
{ label: "Iran", value: "140000" },
{ label: "Russia", value: "115000" },
{ label: "UAE", value: "100000" },
{ label: "US", value: "30000" },
{ label: "China", value: "30000" }
]
}*/
}).render();
});
</script>
<?php
echo "<br><br>";
echo "------";
echo "<br><br>";
?>
<script>
/*
Promise.all([
loadData(
"https://s3.eu-central-1.amazonaws.com/fusion.store/ft/data/data.json"
),
loadData(
"https://s3.eu-central-1.amazonaws.com/fusion.store/ft/schema/schema.json"
)
]).then(function(res) {
const data = res[0];
const schema = res[1];
const dataStore = new FusionCharts.DataStore();
const dataSource = {
legend: {
enabled: "0"
},
caption: {
text: "Daily Visitors Count of a Website"
},
subcaption: {
text: "The legend is disabled by default"
},
yaxis: [
{
columnname: "Daily Visitors",
title: "Daily Visitors"
}
]
};
dataSource.data = dataStore.createDataTable(data, schema);
new FusionCharts({
type: "timeseries",
renderAt: "chart-container",
width: "100%",
height: "500",
dataSource: dataSource
}).render();
});
*/
FusionCharts.ready(function() {
var d = new Date();
var monthArr = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"June",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
];
var outDate =
monthArr[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
new FusionCharts({
type: "realtimeline",
renderAt: "chart-container",
width: "600",
height: "400",
dataFormat: "json",
dataSource: {
chart: {
caption: "Bitcoin Price Ticker",
subCaption: outDate,
numberPrefix: "$",
numdisplaysets: "10",
labeldisplay: "rotate",
showRealTimeValue: "0",
theme: "umber",
plotToolText: "$label<br>Price: <b>$dataValue</b>",
setAdaptiveYMin: "1"
},
categories: [
{
category: [
{
label:
d.getHours() +
":" +
d.getMinutes() +
":" +
(d.getSeconds() - 2)
},
{
label:
d.getHours() +
":" +
d.getMinutes() +
":" +
(d.getSeconds() - 1)
},
{
label:
d.getHours() +
":" +
d.getMinutes() +
":" +
d.getSeconds()
}
]
}
],
dataset: [
{
data: [
{
value: "7358"
},
{
value: "7361"
},
{
value: "7362"
}
]
}
]
},
events: {
initialized: function(evt, arg) {
// Get reference to the chart
var chartRef = evt.sender;
function updateData() {
var t = new Date(),
date =
t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds(),
val = Math.floor(Math.random() * (7800 - 7200 + 1)) + 7200,
strData = "&label=" + date + "&value=" + val;
// Feed it to chart.
chartRef.feedData(strData);
}
chartRef.intervalUpdateId = setInterval(updateData, 1000);
},
disposed: function(evt, args) {
clearInterval(evt.sender.intervalUpdateId);
}
}
}).render();
});
</script>
<div id="chart-container"></div>
</body>
<?php
//include("includes/fusioncharts.php");
include("FusionChartsFree/Code/PHP/Includes/fusioncharts.php")
?>
<html>
<head>
<!-- FusionCharts Library -->
<script type="text/javascript" src="path/to/fusioncharts.js"></script>
</head>
<body>
<?php
$data = file_get_contents('https://s3.eu-central-1.amazonaws.com/fusion.store/ft/data/line-chart-with-time-axis-data.json');
$schema = file_get_contents('https://s3.eu-central-1.amazonaws.com/fusion.store/ft/schema/line-chart-with-time-axis-schema.json');
$fusionTable = new FusionTable($schema, $data);
$timeSeries = new TimeSeries($fusionTable);
$timeSeries->AddAttribute('chart', '{}');
$timeSeries->AddAttribute('caption', '{"text":"Sales Analysis"}');
$timeSeries->AddAttribute('subcaption', '{"text":"Grocery"}');
$timeSeries->AddAttribute('yaxis', '[{"plot":{"value":"Grocery Sales Value"},"format":{"prefix":"$"},"title":"Sale Value"}]');
// chart object
$Chart = new FusionCharts(
"timeseries",
"MyFirstChart" ,
"700",
"450",
"time_chart-container",
"json",
$timeSeries
);
// Render the chart
$Chart->render();
?>
<div id="time_chart-container">Chart will render here!</div>
</body>
</html>
</html>