Disable on-click listener in chart via script [message #1033508] |
Thu, 04 April 2013 05:49  |
Eclipse Guest Messages: 93 Registered: February 2013 Location: Vienna |
Member |
|
|
Hi,
I know that I can disable the whole interactivity of a chart e.g. in beforeGeneration() via
chart.getInteractivity().setEnable(false);
But how can I disable just the on-click listener of the y-series interactivity and legend interactivity while keeping the on-mouse-over listener enabled?
The use case is that I have to programmatically disable the possibility to invoke a drill-down while it should still be possible to get a tooltip with the series' data.
Thanks in advance for any input! Cheers, Jakob
|
|
|
|
Re: Disable on-click listener in chart via script [message #1036360 is a reply to message #1033983] |
Mon, 08 April 2013 05:19   |
Eclipse Guest Messages: 93 Registered: February 2013 Location: Vienna |
Member |
|
|
Hi,
thanks for the reply. Unfortunately I can't get it working. I assume this code is supposed to be placed in the chart's beforeDrawSeries() method, right?
function beforeDrawSeries( series, isr, icsc )
{
var isFurtherDrillDown = myChart.isFurtherDrillDown();
if (isFurtherDrillDown == false){
series.getTriggers().remove(0);
}
}
(myChart is a java object of my own. It is valid and is not the reason for the exception)
I get the following exception:
Apr 08, 2013 11:13:16 AM org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor processExtendedContent
SEVERE: Wrapped org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0 at line 71 of chart script:''
org.eclipse.birt.chart.exception.ChartException: Wrapped org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0 at line 71 of chart script:''
at org.eclipse.birt.chart.script.AbstractScriptHandler.convertException(AbstractScriptHandler.java:738)
at org.eclipse.birt.chart.script.AbstractScriptHandler.callJavaScriptFunction(AbstractScriptHandler.java:374)
at org.eclipse.birt.chart.script.AbstractScriptHandler.callFunction(AbstractScriptHandler.java:558)
at org.eclipse.birt.chart.render.BaseRenderer.renderPlot(BaseRenderer.java:1826)
at org.eclipse.birt.chart.render.BaseRenderer.render(BaseRenderer.java:476)
at org.eclipse.birt.chart.factory.Generator.render(Generator.java:1375)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.renderToImageFile(ChartReportItemPresentationBase.java:1066)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.generateRenderObject(ChartReportItemPresentationBase.java:917)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.onRowSets(ChartReportItemPresentationBase.java:854)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationProxy.onRowSets(ChartReportItemPresentationProxy.java:108)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:1067)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localizeForeign(LocalizedContentVisitor.java:588)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:173)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:37)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at de.asweb.statistik.service.report.ReportHandler.produceReport(ReportHandler.java:66)
at de.asweb.statistik.service.report.ReportController.processRequest(ReportController.java:55)
at de.asweb.statistik.service.report.ReportController.doGet(ReportController.java:40)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.mozilla.javascript.WrappedException: Wrapped org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0 (/report/body/extended-item[@id="7"]/method[@name="onRender"]#71)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:183)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen.c801._c3(/report/body/extended-item[@id="7"]/method[@name="onRender"]:71)
at org.mozilla.javascript.gen.c801.call(/report/body/extended-item[@id="7"]/method[@name="onRender"])
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.gen.c801.call(/report/body/extended-item[@id="7"]/method[@name="onRender"])
at org.eclipse.birt.chart.script.AbstractScriptHandler.callJavaScriptFunction(AbstractScriptHandler.java:370)
... 38 more
Caused by: org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0
at org.eclipse.emf.common.util.BasicEList.remove(BasicEList.java:602)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doRemove(NotifyingListImpl.java:756)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.remove(NotifyingListImpl.java:737)
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.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
... 46 more
Apart from that, I think that this code is supposed to disable the onClick listener for the y-series interactivity. Furthermore, I have to disable the legend onClick listener as well. How would I do that?
|
|
|
Re: Disable on-click listener in chart via script [message #1036379 is a reply to message #1036360] |
Mon, 08 April 2013 05:51   |
Eclipse Guest Messages: 93 Registered: February 2013 Location: Vienna |
Member |
|
|
Oh ok, I solved it and it all works fine now!
Obviously, the beforeDrawSeries() method was called twice. On the first call, series.getTriggers().size() is 0, on the second call it is 2. This is the case even though I only have one series. Anyways, using the following workaroud it works. And by the way, as you may have known but as I did not but as I know now, getTriggers().remove() removes the onClick listeners both for the y series and for the legend.
function beforeDrawSeries( series, isr, icsc )
{
if (series.getTriggers().size() > 0){
var isFurtherDrillDown = myChart.isFurtherDrillDown();
// chart.getInteractivity().setEnable(isFurtherDrillDown);
if (isFurtherDrillDown == false){
series.getTriggers().remove(1);
}
}
}
Thanks again for your help! Cheers, Jakob
[Updated on: Mon, 08 April 2013 05:52] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.09492 seconds