I'm trying to create a CSS/HTML based graph using this tutorial here.
However instead of putting the data directly into the html code I'm importing it from a CSV file using PHP with the following code.
<?PHP
/* Open CSV file */
$handle = fopen("defects.csv", "r");
$c = 0;
/* gets data from csv file */
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
/* stores dates as variable $date */
$date[$c] = $data[0];
$c++;
/* inserts defect data into html code */
echo "<dd class=\"p" . $data[2] . "\"><span><b>" . $data[2] . "</b></span></dd>";
echo "<dd class=\"sub p" . $data[3] . "\" ><span><b>" . $data[3] . "</b></span></dd>";
}
echo "</dl>";
echo "<ul class=\"xAxis\">";
/* X AXIS */
/* inserts date data into html code for x axis */
for ($d=0; $d < $c; $d++) {
echo "<li>" . $date[$d] . "</li>";
}
?>
The values are being placed correctly on the chart, but the bars aren't appearing. The CSS code I have for the bars is:
/* default column styling */
dl#csschart span{
height:50%;
background:url(../images/barx.png) repeat-y;
}
dl#csschart .sub{
margin-left:-33px;
}
dl#csschart .sub span{
background:url(../images/subBarx.png) repeat-y;
}
Just in case it helps, I've print screened how the graph should look. You can see it at: http://allured.info/graph/failgraph.png