Skip to content
Extraits de code Groupes Projets
Valider a01f09d9 rédigé par ericwang's avatar ericwang
Parcourir les fichiers

graph twitter

parent 203c2117
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
<?php
/* Include the `fusioncharts.php` file that contains functions to embed the charts. */
include("fusioncharts-suite-xt/integrations/php/fusioncharts-wrapper/fusioncharts.php");
require_once('../API_Twitter/userInfosFunctions.php');
/**
* Must have included the JS
*/
......@@ -61,6 +61,48 @@ function lineGraphMean($chartName, $caption, $xAxisName, $yAxisName, $data, $wid
echo '<center> <div id="'.$chartName.'">Chart will render here!</div> </center>';
}
function diagramme($favt){
echo '
<script type="text/javascript" src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<script type="text/javascript" src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<script type="text/javascript">
FusionCharts.ready(function(){
var fusioncharts = new FusionCharts({
type: "bar2d",
renderAt: "diagtwitter",
width: "500",
height: "400",
dataFormat: "json",
dataSource: {
"chart": {
"theme": "fusion",
"caption": "Les meilleurs favoris",
"subCaption": "Twitter",
"yAxisName": "Nombre de followers",
"numberPrefix": "$",
"alignCaptionWithCanvas": "0"
},
"data": [' ;
for( $i=0 ; $i < count($favt)-2 ; $i++){
$name = getUserScreenName($favt[$i]);
$followers = getUserNbFollowers($favt[$i]);
echo ' {
"label": "'.$name.'",
"value": "'.$followers.'"
},';
}
$name = getUserScreenName($favt[count($favt)-1]);
$followers = getUserNbFollowers($favt[count($favt)-1]);
echo '{
"label": "'.$name.'",
"value": "'.$followers.'"
}]
}
})});
fusioncharts.render();
</script>' ;
}
?>
<?php
require_once('../facto.php');
require_once('../API_Twitter/userInfosFunctions.php');
require_once('../graphs/graphFunctions.php');
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<!DOCTYPE html>
<html lang="zxx">
<html>
<?php head(); ?>
......@@ -23,12 +28,9 @@ session_start();
<div class="slider-info bg1">
<div class="w3l-overlay">
<div class="banner-text text-center container">
<table width="400" class="hovertable" align="center" style='text-align:center;background: white' border='1'>
<tr style="background: #3fcbfe;"><th>image</th><th>twitter</th></tr>
<?php
session_start();
<?php
// initializing variables
$username = $_SESSION['username'];
......@@ -50,7 +52,63 @@ session_start();
$result = mysqli_query($db, $fav);
$fav = mysqli_fetch_assoc($result);
$favt = unserialize($fav['twitter']);
?>
<?php echo '<script type="text/javascript" src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<script type="text/javascript" src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<script type="text/javascript">
FusionCharts.ready(function(){
var fusioncharts = new FusionCharts({
type: "bar2d",
renderAt: "diagtwitter",
width: "500",
height: "400",
dataFormat: "json",
dataSource: {
"chart": {
"theme": "fusion",
"caption": "Top 5 Stores by Sales",
"subCaption": "Last month",
"yAxisName": "Sales (In USD)",
"numberPrefix": "$",
"alignCaptionWithCanvas": "0"
},
"data": [{
"label": "Bakersfield Central",
"value": "880000"
}, ';
for( $i=0 ; $i < min(10,count($favt)-2) ; $i++){
$name = getUserScreenName($favt[$i]);
$followers = getUserNbFollowers($favt[$i]);
echo ' {
"label": "'.$name.'",
"value": "'.$followers.'"
},';
}
$name = getUserScreenName($favt[count($favt)-1]);
$followers = getUserNbFollowers($favt[count($favt)-1]);
echo '{
"label": "'.$name.'",
"value": "'.$followers.'"
}
]
}
});
fusioncharts.render();
});
</script>';
?>
<div id="diagtwitter">Le diagramme twitter s affiche ici !
</div>
<table width="400" class="hovertable" align="center" style='text-align:center;background: white' border='1'>
<tr style="background: #3fcbfe;"><th>image</th><th>twitter</th></tr>
<?php
$datarow = count($favt);
for($i=0;$i<$datarow;$i++){
$twitter = getUserScreenName($favt[$i]);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter