Topic: Bug creating bar chart
Hello,
I made a new graphics in the dashboard. It should be relatively simple and in my local it does work as expected.
My code is below:
function display_sales_per_month()
{
$pg = new graph();
$this_year = date('Y');
$title = _('Sales per month');
$data = get_sales_in_year($this_year);
$months = array(_('Jan'), _('Feb'), _('Mar'),
_('Apr'), _('May'), _('Jun'),
_('Jul'), _('Aug'), _('Sep'),
_('Oct'), _('Nov'), _('Dec'),
);
$x_axis = array();
$y_axis = array();
foreach($data['monthly'] as $k=>$v){
$x_axis[] = $months[$k-1];
$y_axis[] = $v;
}
$pg->x = $x_axis;
$pg->y = $y_axis;
source_graphic($this_year, $title, _(""), $pg, _("Sales per month"), null, 1);
}
It just display total invoice per month.
What I got when I upload is this:
https://i.imgur.com/FEpxLtq.png
It got some weird string.