graph topics by month
graph posts by month
I used the below php code and google chart/graphs api
for graph topics by month
Code: Select all
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year-Mo', 'Topics']
<?php
//connect to your database
mysql_connect('localhost','bakon306_phpb537','password'); //(host, username, password)
//specify database
mysql_select_db('bakon306_phpb537') or die("Unable to select database"); //select which database we're using
$query = "
SELECT DATE_FORMAT(from_unixtime(topic_time),'%Y-%m') as dt,
count(*) as count
FROM `phpbbsf_topics`
GROUP BY dt
ORDER BY dt";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
// next determine if s has been passed to script, if not use 0
// get results
#$query .= " limit 30";
$result = mysql_query($query) or die("Couldn't execute query");
// now you can display the results returned
while ($row=mysql_fetch_array($result)) {
//$filename = $row["physical_filename"];
$dt = $row["dt"];
$count = $row["count"];
print ",['".$dt."',".$count."]";
#['2005', 1170, 460],
}
?>
]);
var options = {
title: 'Topics added by month',
//curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
Topics added by month graph on <a href="http://gimplearn.net/">GIMP LEARN forum</a><br/>
<a href="http://gimplearn.net/styles/prosilver/template/graph_topics.php">graph topics by month</a><br/>
<a href="http://gimplearn.net/styles/prosilver/template/graph_posts.php">graph posts by month</a><br/>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
Code: Select all
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year-Mo', 'Posts']
<?php
//connect to your database
mysql_connect('localhost','bakon306_phpb537','password'); //(host, username, password)
//specify database
mysql_select_db('bakon306_phpb537') or die("Unable to select database"); //select which database we're using
$query = "
SELECT DATE_FORMAT(from_unixtime(post_time),'%Y-%m') as dt,
count(*) as count
FROM `phpbbsf_posts`
GROUP BY dt
ORDER BY dt";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
// next determine if s has been passed to script, if not use 0
// get results
#$query .= " limit 30";
$result = mysql_query($query) or die("Couldn't execute query");
// now you can display the results returned
while ($row=mysql_fetch_array($result)) {
//$filename = $row["physical_filename"];
$dt = $row["dt"];
$count = $row["count"];
print ",['".$dt."',".$count."]";
#['2005', 1170, 460],
}
?>
]);
var options = {
title: 'Posts added by month',
//curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
Posts added by month graph on <a href="http://gimplearn.net/">GIMP LEARN forum</a><br/>
<a href="http://gimplearn.net/styles/prosilver/template/graph_topics.php">graph topics by month</a><br/>
<a href="http://gimplearn.net/styles/prosilver/template/graph_posts.php">graph posts by month</a><br/>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
You'll have change database, username and password for your own phpbb forum if you want to use it.