I am trying to overlay a stacked vertical Bar Chart with a Line Chart.
The verticalStackBar always overwrites the Line Chart . As a result the Line Chart is not visible .
I have written the following postprocessor for displaying the stacked vertical Bar .
<jsp:useBean id="lineGraphData" class="com.testing.LineGraphData"/>
<%
final com.testing.BarGraphData barGraphData1 = barGraphData;
final com.testing.LineGraphData lineGraphData1 = lineGraphData;
ChartPostProcessor postprocessor1 = new ChartPostProcessor() {
public void processChart(Object chart, Map params) {
JFreeChart jfc = (JFreeChart) chart;
XYPlot plot = (XYPlot) jfc.getPlot();
StackedXYBarRenderer r = new StackedXYBarRenderer();
try {
plot.setDataset((XYDataset)barGraphData1.produceDataset (params));
}catch(Exception e){}
plot.setRenderer(r);
}
};
pageContext.setAttribute("postprocessor1", postprocessor1);
%>
The overlay code is also attached below :
<cewolf:overlaidchart
id="kapaChart"
title="KAPA Customer Requests"
type="overlaidxy"
xaxistype="number"
yaxistype="number"
xaxislabel="Months"
yaxislabel="Customer Requests">
<cewolf:gradientpaint>
<cewolf:point x="0" y="0" color="#FFFFFFEE" />
<cewolf:point x="0" y="300" color="#AAAAFFEE" />
</cewolf:gradientpaint>
<cewolf:colorpaint color="#FFFFFF"/>
<cewolf:plot type="xyline">
<cewolf:data>
<cewolf:producer id="lineGraphData" />
</cewolf:data>
</cewolf:plot>
<cewolf:plot type="xyverticalbar" >
<cewolf:data>
<cewolf:producer id="barGraphData" />
</cewolf:data>
</cewolf:plot>
<cewolf:chartpostprocessor id="postprocessor1" />
</cewolf:overlaidchart>
<p>
<cewolf:img chartid="kapaChart" renderer="/cewolf" width="550" height="285"/>
Whenever I execute the same , The verticalStackBar overwrites the Line Chart .
Can anyone help me on this ?
Overlay Problem with StackedVerticalBar and Line Chart
Overlay Problem with StackedVerticalBar and Line Chart
See, if we create overlaid bar-line charts using one CategoryPlot and two CategoryData sets (one for Bar and one for Line), we can define rendering orders of datasets using "setDatasetRenderingOrder" method of CategoryPlot class. Which takes care of what overlays what.
I don't know if we can define any such order with XYPlots.
I don't know if we can define any such order with XYPlots.