Line graph, bug with legend and only one series name?
Posted: Tue Feb 07, 2012 3:06 am
When I give my line a series name, the legend refuses to show the series name unless there are multiple series
For example:
With the following series title set,
$myline->setTitle("UTILITIES Actual");
The graph will not display the series under one title in the legend, but instead shows a legend entry for each point on the graph
The only work-around for this is to draw a 'fake line' on top of one of the axes
$line_fake=new Line($c->getChart());
$line_fake->setTitle(" ");
$line_fake->setLabels($labels);
$line_fake->addArray($data_fake);
$line_fake->setColor(new Color(128,128,128));
Now, I get the desired result, except for the extra line that appears in the legend
Is there any other way to do this?
I think that the natural behavior for legends should be to use the series title if it exists, otherwise do a point-by-point listing
Thanks
For example:
With the following series title set,
$myline->setTitle("UTILITIES Actual");
The graph will not display the series under one title in the legend, but instead shows a legend entry for each point on the graph
The only work-around for this is to draw a 'fake line' on top of one of the axes
$line_fake=new Line($c->getChart());
$line_fake->setTitle(" ");
$line_fake->setLabels($labels);
$line_fake->addArray($data_fake);
$line_fake->setColor(new Color(128,128,128));
Now, I get the desired result, except for the extra line that appears in the legend
Is there any other way to do this?
I think that the natural behavior for legends should be to use the series title if it exists, otherwise do a point-by-point listing
Thanks