Dear All,
I’m using bar chart by morris, I want to show dynamic numbers at the middle of bars, but I don’t know how to do it?
Here is my codes:
$chart_data = '';
while ($row = mysqli_fetch_array($result) and $row2 = mysqli_fetch_array($result2) ) {
$chart_data .= "{ PRODUCT_LINE:'".$row["PRODUCT_LINE"]."',
total_time:".$row["total_time"].", actual_total_time:".$row2["actual_total_time"].", }, ";
}
$chart_data = substr($chart_data, 0, -2);
}
and here is my script
new Morris.Bar({
// ID of the element in which to draw the chart.
element: 'chart',
// Chart data records -- each entry in this array corresponds to a point on
// the chart.
data:[<?php echo $chart_data; ?>],
// The name of the data record attribute that contains x-values.
xkey: 'PRODUCT_LINE',
// A list of names of data record attributes that contain y-values.
ykeys: ['total_time', 'actual_total_time'],
// Labels for the ykeys -- will be displayed when you hover over the
// chart.
labels: ['plan', 'actual'],
hideHover: 'auto',
postUnits: '',
xLabels: '',
gridTextColor: 'yellow',
gridTextSize: '12',
gridTextFamily: 'iSans',
});
does anyone know?