Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
P
pima2018_25
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de conteneurs
Registre de modèles
Opération
Environnements
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Clément VEYSSIÈRE
pima2018_25
Validations
5dd875bb
Valider
5dd875bb
rédigé
Il y a 6 ans
par
Kevin XU
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
ajout fonctions pour faire un line graph
parent
17eb6cec
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
graphs/graphFunctions.php
+66
-0
66 ajouts, 0 suppression
graphs/graphFunctions.php
page_profile/profil.php
+37
-138
37 ajouts, 138 suppressions
page_profile/profil.php
avec
103 ajouts
et
138 suppressions
graphs/graphFunctions.php
0 → 100644
+
66
−
0
Voir le fichier @
5dd875bb
<?php
/* Include the `fusioncharts.php` file that contains functions to embed the charts. */
include
(
"fusioncharts-suite-xt/integrations/php/fusioncharts-wrapper/fusioncharts.php"
);
/**
* Must have included the JS
*/
function
lineGraphMean
(
$chartName
,
$caption
,
$xAxisName
,
$yAxisName
,
$data
,
$width
,
$height
)
{
// Chart Configuration stored in Associative Array
$arrChartConfig
=
array
(
"chart"
=>
array
(
"caption"
=>
$caption
,
//"subCaption" => "In MMbbl = One Million barrels",
"xAxisName"
=>
$xAxisName
,
"yAxisName"
=>
$yAxisName
,
"lineThickness"
=>
"2"
,
"theme"
=>
"fusion"
)
);
// An array of hash objects which stores data
$arrChartData
=
[];
$mean
=
0
;
$count
=
count
(
$data
);
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$arrChartData
[]
=
[
'label'
=>
$i
,
'value'
=>
$data
[
$i
]
];
$mean
+=
$data
[
$i
];
}
$mean
=
round
(
$mean
/
$count
,
2
);
// An array which stores trend-lines
$arrTrendLines
=
[];
$arrTrendLines
[]
=
[
"line"
=>
[
[
"startvalue"
=>
$mean
,
"color"
=>
"#1aaf5d"
,
"displayvalue"
=>
"Mean = "
.
$mean
,
"valueOnRight"
=>
"1"
,
"thickness"
=>
"2"
]
]
];
$arrChartConfig
[
"data"
]
=
$arrChartData
;
$arrChartConfig
[
"trendLines"
]
=
$arrTrendLines
;
// JSON Encode the data to retrieve the string containing the JSON representation of the data in the array.
$jsonEncodedData
=
json_encode
(
$arrChartConfig
);
// chart object
$Chart
=
new
FusionCharts
(
"line"
,
$caption
,
$width
,
$height
,
$chartName
,
"json"
,
$jsonEncodedData
);
// Render the chart
$Chart
->
render
();
echo
'<center> <div id="'
.
$chartName
.
'">Chart will render here!</div> </center>'
;
}
?>
Ce diff est replié.
Cliquez pour l'agrandir.
page_profile/profil.php
+
37
−
138
Voir le fichier @
5dd875bb
...
@@ -3,6 +3,8 @@ require_once('../API_Twitter/userInfosFunctions.php');
...
@@ -3,6 +3,8 @@ require_once('../API_Twitter/userInfosFunctions.php');
require_once
(
'../API_Twitter/tweetInfosFunctions.php'
);
require_once
(
'../API_Twitter/tweetInfosFunctions.php'
);
require_once
(
'../youtube-api/userInfos.php'
);
require_once
(
'../youtube-api/userInfos.php'
);
require_once
(
'../facto.php'
);
require_once
(
'../facto.php'
);
require_once
(
'../graphs/graphFunctions.php'
);
session_start
();
session_start
();
if
(
isset
(
$_POST
[
'username'
]))
{
if
(
isset
(
$_POST
[
'username'
]))
{
...
@@ -41,6 +43,9 @@ $youtube_fav = $_SESSION['youtube'];
...
@@ -41,6 +43,9 @@ $youtube_fav = $_SESSION['youtube'];
?>
?>
<!DOCTYPE html>
<!DOCTYPE html>
<script
type=
"text/javascript"
src=
"../graphs/fusioncharts-suite-xt/js/fusioncharts.js"
></script>
<script
type=
"text/javascript"
src=
"../graphs/fusioncharts-suite-xt/js/themes/fusioncharts.theme.fusion.js"
></script>
<html
lang=
"zxx"
>
<html
lang=
"zxx"
>
<?php
head
();
?>
<?php
head
();
?>
...
@@ -140,147 +145,41 @@ $youtube_fav = $_SESSION['youtube'];
...
@@ -140,147 +145,41 @@ $youtube_fav = $_SESSION['youtube'];
<div
id=
'stats'
>
<div
id=
'stats'
>
<div
id=
'a'
><br/><br/><span
class=
"title_graphs"
>
Evolution of Tweets Likes
</span><br/><br/>
<div
id=
'a'
><br/><br/><span
class=
"title_graphs"
>
Evolution of Tweets Likes
</span><br/><br/>
<?php
/* Include the `fusioncharts.php` file that contains functions to embed the charts. */
include
(
"../graphs/fusioncharts-suite-xt/integrations/php/fusioncharts-wrapper/fusioncharts.php"
);
require_once
(
'../API_Twitter/tweetInfosFunctions.php'
);
?>
<script
type=
"text/javascript"
src=
"../graphs/fusioncharts-suite-xt/js/fusioncharts.js"
></script>
<script
type=
"text/javascript"
src=
"../graphs/fusioncharts-suite-xt/js/themes/fusioncharts.theme.fusion.js"
></script>
<?php
<?php
// Nombre de tweets
// Nombre de tweets
$count
=
50
;
$count
=
50
;
// Chart Configuration stored in Associative Array
$chartName
=
"chart1"
;
$arrChartConfig
=
array
(
$caption
=
"Evolution of likes : Last "
.
$count
.
" tweets"
;
"chart"
=>
array
(
$xAxisName
=
"Tweet (from most recent to oldest)"
;
"caption"
=>
"Evolution of likes : Last "
.
$count
.
" tweets"
,
$yAxisName
=
"Likes"
;
//"subCaption" => "In MMbbl = One Million barrels",
"xAxisName"
=>
"Tweet (from most recent to oldest)"
,
"yAxisName"
=>
"Likes"
,
"lineThickness"
=>
"2"
,
"theme"
=>
"fusion"
)
);
// An array of hash objects which stores data
$arrChartData
=
[];
$likes
=
getNbLikesOfUserByScreenName
(
getUserScreenName
(
$id
),
$count
);
$likes
=
getNbLikesOfUserByScreenName
(
getUserScreenName
(
$id
),
$count
);
$likeMoyen
=
0
;
$count
=
count
(
$likes
);
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$arrChartData
[]
=
[
'label'
=>
$i
,
'value'
=>
$likes
[
$i
]
];
$likeMoyen
+=
$likes
[
$i
];
}
$likeMoyen
=
round
(
$likeMoyen
/
$count
,
2
);
// An array which stores trend-lines
$arrTrendLines
=
[];
$arrTrendLines
[]
=
[
"line"
=>
[
[
"startvalue"
=>
$likeMoyen
,
"color"
=>
"#1aaf5d"
,
"displayvalue"
=>
"Like moyen = "
.
$likeMoyen
,
"valueOnRight"
=>
"1"
,
"thickness"
=>
"2"
]
]
];
$arrChartConfig
[
"data"
]
=
$arrChartData
;
$arrChartConfig
[
"trendLines"
]
=
$arrTrendLines
;
// JSON Encode the data to retrieve the string containing the JSON representation of the data in the array.
$jsonEncodedData
=
json_encode
(
$arrChartConfig
);
// chart object
$Chart
=
new
FusionCharts
(
"line"
,
"MyFirstChart"
,
"700"
,
"400"
,
"chart-container"
,
"json"
,
$jsonEncodedData
);
// Render the chart
$Chart
->
render
();
?>
<center>
<div
id=
"chart-container"
>
Chart will render here!
</div>
</center>
lineGraphMean
(
$chartName
,
$caption
,
$xAxisName
,
$yAxisName
,
$likes
,
700
,
400
);
</br><br/></div>
?>
</br><br/>
</div>
<div
id=
'b'
><br/><br/><span
class=
"title_graphs"
>
Evolution of Tweets Retweets
</span><br/><br/>
<div
id=
'b'
><br/><br/><span
class=
"title_graphs"
>
Evolution of Tweets Retweets
</span><br/><br/>
<?php
<?php
// Nombre de tweets
// Nombre de tweets
$count
=
50
;
$count
=
50
;
// Chart Configuration stored in Associative Array
$chartName
=
"chart2"
;
$arrChartConfig
=
array
(
$caption
=
"Evolution of retweets : Last "
.
$count
.
" tweets"
;
"chart"
=>
array
(
$xAxisName
=
"Tweet (from most recent to oldest)"
;
"caption"
=>
"Evolution of retweets : Last "
.
$count
.
" tweets"
,
$yAxisName
=
"Retweets"
;
//"subCaption" => "In MMbbl = One Million barrels",
"xAxisName"
=>
"Tweet (from most recent to oldest)"
,
"yAxisName"
=>
"Retweets"
,
"lineThickness"
=>
"2"
,
"theme"
=>
"fusion"
)
);
// An array of hash objects which stores data
$arrChartData
=
[];
$retweets
=
getNbRetweetsOfUserByScreenName
(
getUserScreenName
(
$id
),
$count
);
$retweets
=
getNbRetweetsOfUserByScreenName
(
getUserScreenName
(
$id
),
$count
);
$retweetMoyen
=
0
;
$count
=
count
(
$retweets
);
lineGraphMean
(
$chartName
,
$caption
,
$xAxisName
,
$yAxisName
,
$retweets
,
700
,
400
);
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$arrChartData
[]
=
[
'label'
=>
$i
,
'value'
=>
$retweets
[
$i
]
];
$retweetMoyen
+=
$retweets
[
$i
];
}
$retweetMoyen
=
round
(
$retweetMoyen
/
$count
,
2
);
// An array which stores trend-lines
$arrTrendLines
=
[];
$arrTrendLines
[]
=
[
"line"
=>
[
[
"startvalue"
=>
$retweetMoyen
,
"color"
=>
"#1aaf5d"
,
"displayvalue"
=>
"retweet moyen = "
.
$retweetMoyen
,
"valueOnRight"
=>
"1"
,
"thickness"
=>
"2"
]
]
];
$arrChartConfig
[
"data"
]
=
$arrChartData
;
$arrChartConfig
[
"trendLines"
]
=
$arrTrendLines
;
// JSON Encode the data to retrieve the string containing the JSON representation of the data in the array.
$jsonEncodedData
=
json_encode
(
$arrChartConfig
);
// chart object
$Chart
=
new
FusionCharts
(
"line"
,
"MyFirstChart2"
,
"700"
,
"400"
,
"chart-container2"
,
"json"
,
$jsonEncodedData
);
// Render the chart
$Chart
->
render
();
?>
?>
<center>
</br><br/>
<div
id=
"chart-container2"
>
Chart will render here!
</div>
</div>
</center>
</br><br/></div>
</div>
</div>
</div>
</div>
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter