Row values in Y series of the chart???
Hello All,
I have row["val1"] to row["val15"] computed values for 15 yrs in table.
I want to plot a graph based on this data.
I want to take this row["val1"] to row["val15"] as y axis series and 1 to 15 yrs as X axis in the line chart.
can i create a dataset by using these values or something like this to use it for the chart.
Is it possible???
Do reply your suggestion.
Thanks In Advance...
With Regards,
Vishal KP.
I have row["val1"] to row["val15"] computed values for 15 yrs in table.
I want to plot a graph based on this data.
I want to take this row["val1"] to row["val15"] as y axis series and 1 to 15 yrs as X axis in the line chart.
can i create a dataset by using these values or something like this to use it for the chart.
Is it possible???
Do reply your suggestion.
Thanks In Advance...
With Regards,
Vishal KP.
0
Comments
-
Hello Jason,
I am getting 15 static data values which are calculated using the parameter passed to the report.
These 15 values are of same measures but different calaculations (for example Cash Flow for 15 yrs but i have calculated each of them seperately i.e. cashFlow1,CashFlow2...CashFlow15)
I want to use these values in chart's Y axis and years in the X axis.
please reply your suggestions...
Thanks,
Vishal KP.0 -
Hello Jason,
These values are created (calculated fields) by me not coming from dataset.
Is there any method by which, i can create a dataset by using these computed values.
Actually i have taken this chart in the table's footer to access these computed values but they appear as columns in the chart data edit window.
Thats why i cant use them for Y axis or X axis.
Do reply your Suggestion...
Thanks,
Vishal KP.0 -
Hello Jason,
You have used Detail row whereas I have taken all the 15 calculated fields on the footer of the table (as they had diff calculations) and on the last footer of the table I am trying to take the chart.
So Can you guide me in that directions.
I have attached the sample screen of table and chart.
Blue line is revenue, red is O&M, green is cash flow.
Thanks for your valuable replies...
Do reply your suggestion...
Thanks,
Vishal KP.0 -
Hello Jason,
Thanks for your valuable response.
I did little changes to my report as compared to your report.
You have taken the counter to the each field on detail row, i have just taken dynamic numbers to the footer row of my report.
My report is working fine in the Preview but when i tried to run the report, I am getting error.
So I tried to run your report and if anything i had missed.
But when i run your report, i get the same error which i get when i run my report.
Here is the error I am getting:
The following items have errors:
Chart NewChart:
- TypeError: Cannot read property "length" from null at line 36 of chart script:''
exception.javascript.error ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: TypeError: Cannot read property "length" from null at line 36 of chart script:'' at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1121) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:933) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.visitForeign(LocalizedContentVisitor.java:501) at org.eclipse.birt.report.engine.content.impl.ForeignContent.accept(ForeignContent.java:69) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:150) at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:36) 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:90) at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:101) at org.eclipse.birt.report.engine.api.impl.RenderTask$PageRangeRender.render(RenderTask.java:534) at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:209) at org.eclipse.birt.report.service.ReportEngineService.renderReport(ReportEngineService.java:1444) at org.eclipse.birt.report.service.BirtViewerReportService.getPage(BirtViewerReportService.java:194) at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.doExecution(AbstractGetPageActionHandler.java:238) at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.__execute(AbstractGetPageActionHandler.java:105) at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90) at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47) at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143) at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPage(BirtDocumentProcessor.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112) at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397) at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186) at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281) at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699) at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:616) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122) at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180) at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:269) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428) at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568) at org.mortbay.http.HttpContext.handle(HttpContext.java:1530) at org.mortbay.http.HttpContext.handle(HttpContext.java:1482) at org.mortbay.http.HttpServer.service(HttpServer.java:909) at org.mortbay.http.HttpConnection.service(HttpConnection.java:820) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986) at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837) at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245) at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357) at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)Caused by: org.eclipse.birt.chart.exception.ChartException: TypeError: Cannot read property "length" from null at line 36 of chart script:'' at org.eclipse.birt.chart.script.ScriptHandler.convertException(ScriptHandler.java:1138) at org.eclipse.birt.chart.script.ScriptHandler.callJavaScriptFunction(ScriptHandler.java:616) at org.eclipse.birt.chart.script.ScriptHandler.callFunction(ScriptHandler.java:916) at org.eclipse.birt.chart.factory.Generator.build(Generator.java:991) at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.buildChart(ChartReportItemPresentationBase.java:877) at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.onRowSets(ChartReportItemPresentationBase.java:736) at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationProxy.onRowSets(ChartReportItemPresentationProxy.java:105) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:909) ... 59 moreCaused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "length" from null (/report/body/extended-item[@id="55"]/method[@name="onRender"]#36) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356) at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3375) at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3388) at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1362) at org.mozilla.javascript.gen.c21._c1(/report/body/extended-item[@id="55"]/method[@name="onRender"]:36) at org.mozilla.javascript.gen.c21.call(/report/body/extended-item[@id="55"]/method[@name="onRender"]) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834) at org.mozilla.javascript.gen.c21.call(/report/body/extended-item[@id="55"]/method[@name="onRender"]) at org.eclipse.birt.chart.script.ScriptHandler.callJavaScriptFunction(ScriptHandler.java:612) ... 65 more
I am using BIRT 2.3.2.
Is there any issues of version mismatch or something likethat.
Do reply your suggestion.
Thanks In Advance.
Vishal KP.0 -
Vishal,
Attached is an example that works. It appears that we have a bug persisting JavaScript Arrays. It would be good if you could log a bug for this. To work around the issue I used a Java ArrayList to store the values. The ArrayList implements serializable and persist in the report document.
Jason0 -
Hi Jason,
Thanks a lot for your great help. It is working fine now.
I had been stuck for this from last 2 days, but wasn?t able to get it right. With your valuable guidance I accomplished the task.
Thanks a lot? once again!!! :-)
With Regards,
Vishal KP.0 -
Hello Jason,<br />
<br />
I have tried the sample report AddSeriesToChart.rptdesign which you have sent me.<br />
It works fine for with multiple y series.<br />
<br />
But when I try to have the same coding in my chart, I get the Mismatch(40!=1) in dataset count found in stacked runtime series error.<br />
I searched on birt exchange and eclipse to solve this error.<br />
Jason, u have mentioned on the eclipse forum that the Dataset should have the same size, which I have in my report.<br />
Can you guide me on how to solve this error.<br />
<br />
The coding is as follows:<br />
<br />
X-axis array<br />
importPackage(Packages.java.util);<br />
var jal = new ArrayList();<br />
for( ii=0; ii<aData[0].length; ii++){<br />
jal.add( aData[0][ii]);<br />
}<br />
reportContext.setPersistentGlobalVariable("pr", jal);<br />
<br />
aData[0].toString();<br />
<br />
Y-Axis Array<br />
importPackage(Packages.java.util);<br />
var jal = new ArrayList();<br />
for( ii=0; ii<aData[1].length; ii++){<br />
jal.add( aData[1][ii]);<br />
}<br />
reportContext.setPersistentGlobalVariable("rev", jal);<br />
aData[1].toString();<br />
<br />
Y2-Axis array<br />
importPackage(Packages.java.util);<br />
var jal = new ArrayList();<br />
for( ii=1; ii<aData[2].length; ii++){<br />
jal.add( aData[2][ii]);<br />
}<br />
reportContext.setPersistentGlobalVariable("om", jal);<br />
aData[2].toString();<br />
<br />
<br />
Chart's OnRender Script:<br />
function beforeGeneration( chart, icsc )<br />
{<br />
importPackage(Packages.java.util);<br />
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);<br />
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);<br />
importPackage(Packages.org.eclipse.birt.chart.model.type.impl);<br />
importPackage(Packages.org.eclipse.birt.chart.util);<br />
importPackage(Packages.java.util);<br />
<br />
var xAxis = chart.getAxes().get(0);<br />
<br />
var yAxis = xAxis.getAssociatedAxes().get(0);<br />
<br />
var yAxis1 = xAxis.getAssociatedAxes().get(0);<br />
<br />
<br />
var xSerieDef = xAxis.getSeriesDefinitions().get(0);<br />
<br />
var ySerieDef = yAxis.getSeriesDefinitions().get(0);<br />
<br />
var ySerieDef1 = yAxis1.getSeriesDefinitions().get(0);<br />
<br />
<br />
// create custom data<br />
<br />
var xData = new ArrayList( );<br />
ydata1 =icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("rev");<br />
xdata1 =icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("pr");<br />
ydata2 =icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("om"); <br />
<br />
<br />
//var cal;<br />
for( i=0;i<xdata1.size();i++){//changed as per J<br />
//for( i=1;i<=1;i++){<br />
<br />
//var cdt = new CDateTime( cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH) );<br />
xData.add(xdata1.get(i));<br />
<br />
}<br />
<br />
<br />
//for( i=0;i<8;i++){<br />
//yData.add( ydata1);<br />
//}<br />
<br />
<br />
var categoryValues = NumberDataSetImpl.create( xData );<br />
<br />
var orthoValues = NumberDataSetImpl.create( ydata1 );<br />
<br />
var orthoValues1 = NumberDataSetImpl.create( ydata2 );<br />
<br />
<br />
// create custom series <br />
<br />
var seCategory = SeriesImpl.create( );<br />
<br />
// or just change existing series<br />
<br />
// var seCategory = xSerieDef.getRuntimeSeries().get(0);<br />
<br />
seCategory.setDataSet( categoryValues );<br />
<br />
<br />
var bs = LineSeriesImpl.create( );<br />
var bs1 = LineSeriesImpl.create( );<br />
<br />
// or just change existing series<br />
<br />
// var bs = ySerieDef.getRuntimeSeries().get(0);<br />
<br />
bs.setSeriesIdentifier( "Revenue" ); //$NON-NLS-1$<br />
bs1.setSeriesIdentifier( "DynamicrnBar Series1" );<br />
<br />
bs.setDataSet( orthoValues );<br />
bs1.setDataSet( orthoValues1 );<br />
<br />
// clear existing series<br />
<br />
xSerieDef.getSeries().clear();<br />
<br />
ySerieDef.getSeries().clear();<br />
<br />
ySerieDef1.getSeries().clear();<br />
<br />
// bind new sereis to chart<br />
<br />
xSerieDef.getSeries().add(seCategory);<br />
<br />
ySerieDef.getSeries().add(bs);<br />
<br />
ySerieDef1.getSeries().add(bs1);<br />
<br />
}<br />
<br />
The error:<br />
Chart NewChart: <br />
- Mismatch (42!=41) in dataset count found in stacked runtime series <br />
Mismatch (42!=41) in dataset count found in stacked runtime series ( 1 time(s) )<br />
detail : org.eclipse.birt.report.engine.api.EngineException: Mismatch (42!=41) in dataset count found in stacked runtime series at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1121) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:933) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.visitForeign(LocalizedContentVisitor.java:501) at org.eclipse.birt.report.engine.content.impl.ForeignContent.accept(ForeignContent.java:69) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:150)0 -
Hi Jason,
I got it working fine.
Actually i was making a mistake in the chart's layout.
I was taking 2 series in the chart, but when i deleted the second series everything is working fine.
Atlast I completed a report which can have any no of calculated fields in any no. of columns in the footer of the table and can take those each values of every footer in the array
and then can use them to create chart.
Thanks for your suggestions.
With regards,
Vishal KP :-)0 -
The values for a open graph can be modified in code. This may be performed in the before generation program or the after dataset filled script. Check open graph generator to during this illustration of how to utilise javascript arrays that are filled with data when a table is formed.
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 150 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories