cewolf and/or jfreechart seem be be ignoring showlegend="false" above, as the legend always displays. Also, if the legend always displays at the bottom of the page, ignoring the legendanchor="north" tag.
Can anyone help me out here? Is showlegend and/or legendanchor broken when using cewolf 1.0 and/or jfreechart 1.0.6? Perhaps I should be looking at those post processor thingies instead?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dealt with this a while back - JFreeChart 1.0.6 causes this because of some underlying legend changes.
Going mostly from memory here, as I've lost these changes and no longer use cewolf.
The problem is in AbstractChartDefinition:
//removes first legend in the list
public void removeLegend()
{
List subTitles = chart.getSubtitles();
Iterator iter = subTitles.iterator();
while (iter.hasNext())
{
Object o = iter.next();
if (o instanceof LegendTitle)
{
iter.remove();
break; // remove this break to fix the showlegend problem
}
}
}
Think the fix is to remove the break statement, thus iterating through the entire list to remove all instances of LegendTitle.
And while you're in AbstractChartDefinition, you might want to fix the east/west legend anchor behavior that seems backwards to me.
In method getChart():
...
if (showLegend)
{
LegendTitle legend = this.getLegend();
switch (legendAnchor)
{
case ANCHOR_NORTH :
legend.setPosition(RectangleEdge.TOP);
break;
case ANCHOR_WEST :
legend.setPosition(RectangleEdge.RIGHT);
break;
case ANCHOR_EAST :
legend.setPosition(RectangleEdge.LEFT);
break;
default :
legend.setPosition(RectangleEdge.BOTTOM);
}
}
...
reverse east/west to:
case ANCHOR_WEST :
legend.setPosition(RectangleEdge.LEFT);
break;
case ANCHOR_EAST :
legend.setPosition(RectangleEdge.RIGHT);
break;
-Brian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all
I'm using jfreechart 1.0.6 and cewolf 1.0 in my project and am having trouble getting the legend to not display
My JSP is as follows
<p>
<cewolf:chart id="line" title="${player.person.fullName}" type="line" showlegend="false" xaxislabel="Match" yaxislabel="Runs" legendanchor="north">
<cewolf:data><cewolf:producer id="stats"/></cewolf:data>
</cewolf:chart>
</p>
<p>
<cewolf:img chartid="line" renderer="/cewolf.chart" width="600" height="500" >
<cewolf:map linkgeneratorid="stats" tooltipgeneratorid="stats" />
</cewolf:img>
</p>
cewolf and/or jfreechart seem be be ignoring showlegend="false" above, as the legend always displays. Also, if the legend always displays at the bottom of the page, ignoring the legendanchor="north" tag.
Can anyone help me out here? Is showlegend and/or legendanchor broken when using cewolf 1.0 and/or jfreechart 1.0.6? Perhaps I should be looking at those post processor thingies instead?
Dealt with this a while back - JFreeChart 1.0.6 causes this because of some underlying legend changes.
Going mostly from memory here, as I've lost these changes and no longer use cewolf.
The problem is in AbstractChartDefinition:
//removes first legend in the list
public void removeLegend()
{
List subTitles = chart.getSubtitles();
Iterator iter = subTitles.iterator();
while (iter.hasNext())
{
Object o = iter.next();
if (o instanceof LegendTitle)
{
iter.remove();
break; // remove this break to fix the showlegend problem
}
}
}
Think the fix is to remove the break statement, thus iterating through the entire list to remove all instances of LegendTitle.
And while you're in AbstractChartDefinition, you might want to fix the east/west legend anchor behavior that seems backwards to me.
In method getChart():
...
if (showLegend)
{
LegendTitle legend = this.getLegend();
switch (legendAnchor)
{
case ANCHOR_NORTH :
legend.setPosition(RectangleEdge.TOP);
break;
case ANCHOR_WEST :
legend.setPosition(RectangleEdge.RIGHT);
break;
case ANCHOR_EAST :
legend.setPosition(RectangleEdge.LEFT);
break;
default :
legend.setPosition(RectangleEdge.BOTTOM);
}
}
...
reverse east/west to:
case ANCHOR_WEST :
legend.setPosition(RectangleEdge.LEFT);
break;
case ANCHOR_EAST :
legend.setPosition(RectangleEdge.RIGHT);
break;
-Brian
>
>And while you're in AbstractChartDefinition, you might want to fix the >east/west legend anchor behavior that seems backwards to me.
I think it is
https://sourceforge.net/tracker/?func=detail&aid=1479568&group_id=57282&atid=483599
and
https://sourceforge.net/tracker/index.php?func=detail&aid=1480122&group_id=57282&atid=483601
It is regression at update to Rev.239
http://cewolf.svn.sourceforge.net/viewvc/cewolf/tags/Root_jfc1_0_0_rc1/cewolf_old/src/de/laures/cewolf/taglib/AbstractChartDefinition.java?r1=221&r2=239