Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Exception While Chart Generation
Rapporter
Hi Everyone,
I am trying to generate Line Chart through RE API. I am getting following error. Please help. I am really stuck with it.
Column binding "advertiser_id" has dependency cycle.
data.engine.ColumnBindingCycle ( 1 time(s) )
detail : org.eclipse.birt.data.engine.core.DataException: Column binding "advertiser_id" has dependency cycle.
at org.eclipse.birt.data.engine.impl.ExprManagerUtil.isValidNode(ExprManagerUtil.java:372)
at org.eclipse.birt.data.engine.impl.ExprManagerUtil.validateNodes(ExprManagerUtil.java:352)
at org.eclipse.birt.data.engine.impl.ExprManagerUtil.checkDependencyCycle(ExprManagerUtil.java:174)
at org.eclipse.birt.data.engine.impl.ExprManagerUtil.validateColumnBinding(ExprManagerUtil.java:68)
at org.eclipse.birt.data.engine.impl.ExprManager.validateColumnBinding(ExprManager.java:213)
at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.validateQuery(ServiceForQueryResults.java:929)
at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:155)
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:83)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:157)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:117)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:182)
at org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.executeQueries(ExtendedGenerateExecutor.java:197)
at org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.execute(ExtendedGenerateExecutor.java:63)
at org.eclipse.birt.report.engine.executor.ExtendedItemExecutor.execute(ExtendedItemExecutor.java:60)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:42)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:45)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:33)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:63)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:85)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:106)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:140)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:68)
at com.tcs.incubation.mDeals.servlet.mDealsAdvanceReportServlet.generateChart(mDealsAdvanceReportServlet.java:337)
at com.tcs.incubation.mDeals.servlet.mDealsAdvanceReportServlet.doPost(mDealsAdvanceReportServlet.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
I am using following code to generate my chart:-
ExtendedItemHandle eih = designFactory.newExtendedItem(null, "Chart");
eih.setHeight("175pt");//$NON-NLS-1$
eih.setWidth("450pt");//$NON-NLS-1$
eih.setDataSet( reportDesignHandle.findDataSet("ChartDS"));//$NON-NLS-1$
eih.setProperty("outputFormat", "PNG");
PropertyHandle cs = eih.getColumnBindings();
ComputedColumn cs1 = StructureFactory.createComputedColumn();
cs1.setName("advertiser_id");
cs1.setExpression((new StringBuilder("row["")).append("advertiser_id").append(""]").toString());
cs.addItem(cs1);
ComputedColumn cs2 = StructureFactory.createComputedColumn();
cs2.setName("count(campaign_id)");
cs2.setExpression("row["count(campaign_id)"]");
cs.addItem(cs2);
ChartWithAxes cwaLine = ChartWithAxesImpl.create();
cwaLine.setType("Line Chart"); //$NON-NLS-1$
cwaLine.setSubType("Overlay"); //$NON-NLS-1$
// Plot
cwaLine.getBlock().setBackground(ColorDefinitionImpl.WHITE());
Plot p = cwaLine.getPlot();
p.getClientArea().setBackground(ColorDefinitionImpl.create(255, 255,
225));
// Title
cwaLine.getTitle().getLabel().getCaption().setValue("Trend Report");//$NON-NLS-1$
// Legend
Legend lg = cwaLine.getLegend();
lg.getText().getFont().setSize(16);
lg.getInsets().set(10, 5, 0, 0);
lg.setAnchor(Anchor.NORTH_LITERAL);
Axis xAxisPrimary = cwaLine.getPrimaryBaseAxes()[0];
xAxisPrimary.setType(AxisType.TEXT_LITERAL);
xAxisPrimary.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
xAxisPrimary.getOrigin().setType(IntersectionType.MIN_LITERAL);
Axis yAxisPrimary = cwaLine.getPrimaryOrthogonalAxis(xAxisPrimary);
yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL);
Series seCategory = SeriesImpl.create();
Query xQ = QueryImpl.create( "row["advertiser_id"]" );
seCategory.getDataDefinition( ).add( xQ );
SeriesDefinition sdX = SeriesDefinitionImpl.create();
sdX.getSeriesPalette().update(0); // SET THE COLORS IN THE PALETTE
xAxisPrimary.getSeriesDefinitions().add(sdX);
sdX.getSeries().add(seCategory);
LineSeries ls1 = (LineSeries) LineSeriesImpl.create();
Query yQ = QueryImpl.create( "row["count(campaign_id)"]" );
ls1.getDataDefinition( ).add( yQ );
ls1.getLineAttributes().setColor(ColorDefinitionImpl.RED());
for (int i = 0; i < ls1.getMarkers().size(); i++) {
((Marker) ls1.getMarkers().get(i)).setType(MarkerType.TRIANGLE_LITERAL);
}
ls1.getLabel().setVisible(true);
SeriesDefinition sdY = SeriesDefinitionImpl.create();
sdY.getSeriesPalette().update(1); // SET THE COLOR IN THE PALETTE
yAxisPrimary.getSeriesDefinitions().add(sdY);
sdY.getSeries().add(ls1);
eih.getReportItem().setProperty("chart.instance", cwaLine);
reportDesignHandle.getBody().add(eih);
Please help.Its bit urgent.
Find more posts tagged with
Comments
bhanley
Where in the code is the exception thrown? Is it where you set up the computed column or where you build out your query?
Rapporter
Hi Bhanley,
This Exception is coming when IReportRunnable is running the task.Please Help.
Thanks in Advance.
Rapporter
Hi,
Please help with my above problem. I am really stuck with it and it has become urgent now.
Rapporter
Hi,
I am able to Get rid of the Exception but now the chart generated is blank. Please help me. Code used for generation is as follows.
ExtendedItemHandle eih = designFactory.newExtendedItem(null, "Chart");
eih.setHeight("175pt");//$NON-NLS-1$
eih.setWidth("450pt");//$NON-NLS-1$
eih.setDataSet( reportDesignHandle.findDataSet("ChartDS"));//$NON-NLS-1$
eih.setProperty("outputFormat", "PNG");
PropertyHandle cs = eih.getColumnBindings();
ComputedColumn cs1 = StructureFactory.createComputedColumn();
cs1.setName("pincode");
cs1.setExpression((new StringBuilder("dataSetRow["")).append("pincode").append(""]").toString());
cs.addItem(cs1);
ComputedColumn cs2 = StructureFactory.createComputedColumn();
cs2.setName("count");
cs2.setExpression("dataSetRow["count"]");
cs.addItem(cs2);
ChartWithAxes cwaLine = ChartWithAxesImpl.create();
cwaLine.setType("Line Chart"); //$NON-NLS-1$
cwaLine.setSubType("Overlay"); //$NON-NLS-1$
// Plot
cwaLine.getBlock().setBackground(ColorDefinitionImpl.WHITE());
Plot p = cwaLine.getPlot();
p.getClientArea().setBackground(ColorDefinitionImpl.create(255, 255,
225));
// Title
cwaLine.getTitle().getLabel().getCaption().setValue("Trend Report");//$NON-NLS-1$
// Legend
Legend lg = cwaLine.getLegend();
lg.getText().getFont().setSize(16);
lg.getInsets().set(10, 5, 0, 0);
lg.setAnchor(Anchor.NORTH_LITERAL);
Axis xAxisPrimary = cwaLine.getPrimaryBaseAxes()[0];
xAxisPrimary.setType(AxisType.TEXT_LITERAL);
xAxisPrimary.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
xAxisPrimary.getOrigin().setType(IntersectionType.MIN_LITERAL);
Axis yAxisPrimary = cwaLine.getPrimaryOrthogonalAxis(xAxisPrimary);
yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL);
Series seCategory = SeriesImpl.create();
Query xQ = QueryImpl.create( "row["pincode"]" );
seCategory.getDataDefinition( ).add( xQ );
SeriesDefinition sdX = SeriesDefinitionImpl.create();
sdX.getSeriesPalette().update(0); // SET THE COLORS IN THE PALETTE
xAxisPrimary.getSeriesDefinitions().add(sdX);
sdX.getSeries().add(seCategory);
LineSeries ls1 = (LineSeries) LineSeriesImpl.create();
Query yQ = QueryImpl.create( "row["count"]" );
ls1.getDataDefinition( ).add( yQ );
ls1.getLineAttributes().setColor(ColorDefinitionImpl.RED());
for (int i = 0; i < ls1.getMarkers().size(); i++) {
((Marker) ls1.getMarkers().get(i)).setType(MarkerType.TRIANGLE_LITERAL);
}
ls1.getLabel().setVisible(true);
SeriesDefinition sdY = SeriesDefinitionImpl.create();
sdY.getSeriesPalette().update(1); // SET THE COLOR IN THE PALETTE
yAxisPrimary.getSeriesDefinitions().add(sdY);
sdY.getSeries().add(ls1);
eih.getReportItem().setProperty("chart.instance", cwaLine);
reportDesignHandle.getBody().add(eih);
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask(design);
task.setAppContext(contextMap);
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat("html");
options.setEmbeddable(true);
options.setOutputStream(out);
task.setRenderOption(options);
task.run();
task.close();
Thanks in Advance. Please help.