This PHP snippet is pretty customised but shows how you can use variables passed in a view to created more graphical representations of the results with just CSS and no need for a graphs module. This snippet calculates percentage heights of a total graph area for each node in the view result and then sets the CSS height for the view styles:
<?php
// $thecount = count($view->result);
$thecount = count($view->result);
$thesize = ($thecount / 100);
$onepercent = 400 / $thecount;
?>
<style>
.onepercent {
display: block;
width:100px;
height:<?php print $onepercent;?>px;
background-color: #0082d8;
color:#0082d8;
font-size: 1px;
overflow: hidden;
}
.daycol {
display: block;
width:100px;
float: left;
height:400px;
overflow: hidden;
margin-right: 0px;
margin-left:10px;
}
.daycol1 {
position: absolute;
bottom:0px;
}
</style>
<?php if ($rows): ?>
<div class=”graph”>
<?php print $rows; ?>
</div>
<?php elseif ($empty): ?>
<div class=”view-empty”>
<?php print $empty; ?>
</div>
<?php endif; ?>
The result is a graph that shows the number of nodes posted in each day (the nodes are grouped by post date limited just to day name).
