Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » How to get the CategoryAxis in startImageMethod() (HTML Emitter)
How to get the CategoryAxis in startImageMethod() (HTML Emitter) [message #1016929] Fri, 08 March 2013 09:00 Go to next message
Samo B. is currently offline Samo B.
Messages: 41
Registered: December 2012
Member
Hi all,

I need to get the CategoryAxis and the IChartWithAxes includes a method to receive it.

But my problem is how to get an Object of IChartWithAxes.

I'm modifying the HTML Emitter and this is the code I use till now:

Class: HTMLReportEmitter
Method:

public void startImage(IImageContent image) {
.
.
.
ExecutionContext exeContext = ((ReportContent) image.getReportContent())
				.getExecutionContext();

		Object genby = image.getGenerateBy();
		if (genby instanceof ExtendedItemDesign) {

			ExtendedItemDesign mychart = (ExtendedItemDesign) image
					.getGenerateBy();
			long deh = mychart.getHandle().getID();
			ReportDesignHandle rdh = image.getReportContent().getDesign()
					.getReportDesign();

			ExtendedItemHandle eih = (ExtendedItemHandle) rdh
					.getElementByID(deh);

			IDataQueryDefinition qd = mychart.getQuery();

			try {
				IDataEngine de = (IDataEngine) exeContext.getDataEngine();

				QueryResultSet qr = (QueryResultSet) de.execute(qd);

				IResultIterator ri = qr.getResultIterator();
				int cc = ri.getResultMetaData().getColumnCount();
				IResultMetaData rsmd = ri.getResultMetaData();


			} catch (EngineException e2) {
				e2.printStackTrace();
			} catch (BirtException e2) {
				e2.printStackTrace();
			}


			try {
;

				ChartWithAxes cwa = (ChartWithAxes) (eih.getReportItem()
						.getProperty("chart.instance"));
				
				[color="#FF0000"]IChartWithAxes icwa = (IChartWithAxes) (eih.getReportItem()
						.getProperty("chart.instance"));[/color] [color="#FF0000"]// That doesn't work!![/color]

				IAxis iaxisTemp = icwa.getCategoryAxis();
                        }

.
.
.

}


Regards,
SG

[Updated on: Tue, 12 March 2013 10:29]

Report message to a moderator

Re: How to get an Object of IChartWithAxes in startImageMethod() (HTML Emitter) [message #1017046 is a reply to message #1016929] Fri, 08 March 2013 18:29 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

That is the script interface not the Java definition. Try:

cwa.getAxes().get(0);

Jason
Re: How to get an Object of IChartWithAxes in startImageMethod() (HTML Emitter) [message #1017121 is a reply to message #1017046] Sat, 09 March 2013 15:27 Go to previous messageGo to next message
Samo B. is currently offline Samo B.
Messages: 41
Registered: December 2012
Member
Hi Jason,

I get following error:
- org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace:org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
	at org.eclipse.birt.report.service.ReportEngineService.throwDummyException(ReportEngineService.java:1115)
	at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:943)
	at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
	at org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(BirtRunAndRenderActionHandler.java:76)
	at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
	at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(EngineFragment.java:318)
	at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76)
	at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(BirtEngineServlet.java:116)
	at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:185)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116)
	at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
	at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:384)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
	at org.eclipse.jetty.server.Server.handle(Server.java:350)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
	at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2265)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:190)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
	at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:937)
	... 38 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/birt/chart/model/component/Axis
	at org.eclipse.birt.report.engine.emitter.html.HTMLReportEmitter.startImage(HTMLReportEmitter.java:2838)
	at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startImage(CompositeContentEmitter.java:274)
	at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:74)
	at org.eclipse.birt.report.engine.layout.html.buffer.DummyPageBuffer.startContent(DummyPageBuffer.java:126)
	at org.eclipse.birt.report.engine.layout.html.HTMLLeafItemLM.start(HTMLLeafItemLM.java:67)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
	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:180)
	... 40 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.birt.chart.model.component.Axis
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	... 50 more

	{http://xml.apache.org/axis/}hostname:SGOEKBAYRAK
	{}:org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
	at org.eclipse.birt.report.service.ReportEngineService.throwDummyException(ReportEngineService.java:1115)
	at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:943)
	at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
	at org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(BirtRunAndRenderActionHandler.java:76)
	at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
	at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(EngineFragment.java:318)
	at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76)
	at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(BirtEngineServlet.java:116)
	at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:185)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116)
	at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
	at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:384)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
	at org.eclipse.jetty.server.Server.handle(Server.java:350)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
	at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2265)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:190)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
	at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:937)
	... 38 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/birt/chart/model/component/Axis
	at org.eclipse.birt.report.engine.emitter.html.HTMLReportEmitter.startImage(HTMLReportEmitter.java:2838)
	at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startImage(CompositeContentEmitter.java:274)
	at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:74)
	at org.eclipse.birt.report.engine.layout.html.buffer.DummyPageBuffer.startContent(DummyPageBuffer.java:126)
	at org.eclipse.birt.report.engine.layout.html.HTMLLeafItemLM.start(HTMLLeafItemLM.java:67)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
	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:180)
	... 40 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.birt.chart.model.component.Axis
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	... 50 more


org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
	at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
	at org.eclipse.birt.report.utility.BirtUtility.makeAxisFault(BirtUtility.java:777)
	at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:94)
	at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(EngineFragment.java:318)
	at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76)
	at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(BirtEngineServlet.java:116)
	at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:185)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116)
	at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
	at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:384)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
	at org.eclipse.jetty.server.Server.handle(Server.java:350)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
	at org.eclipse.birt.report.service.ReportEngineService.throwDummyException(ReportEngineService.java:1115)
	at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:943)
	at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
	at org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(BirtRunAndRenderActionHandler.java:76)
	at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
	... 35 more
Caused by: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
	at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2265)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:190)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
	at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:937)
	... 38 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/birt/chart/model/component/Axis
	at org.eclipse.birt.report.engine.emitter.html.HTMLReportEmitter.startImage(HTMLReportEmitter.java:2838)
	at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startImage(CompositeContentEmitter.java:274)
	at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:74)
	at org.eclipse.birt.report.engine.layout.html.buffer.DummyPageBuffer.startContent(DummyPageBuffer.java:126)
	at org.eclipse.birt.report.engine.layout.html.HTMLLeafItemLM.start(HTMLLeafItemLM.java:67)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
	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:180)
	... 40 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.birt.chart.model.component.Axis
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	... 50 more



When I just use
List<Axis> blabla = cwa.getAxes();
and read out the axes there ist also just a categoryAxis as an boolean variable. I can't get the binding column.

Regards,
SG

[Updated on: Sat, 09 March 2013 16:10]

Report message to a moderator

Re: How to get an Object of IChartWithAxes in startImageMethod() (HTML Emitter) [message #1017687 is a reply to message #1017121] Tue, 12 March 2013 10:28 Go to previous messageGo to next message
Samo B. is currently offline Samo B.
Messages: 41
Registered: December 2012
Member
Hi Jason,

is there no way to get the Category Axis?

---
In the book Integrating and Extending BIRT (Page 170) I've found this:

IChart chart = (IChart) rptdesign.getReportElement("Chart name");

and

IChartWithAxes chart = (IChartWithAxes) rptdesign.getReportElement("Name of...");


SO I tried it like this:

IChart ic = (IChart) image.getReportContent().getReportContext().getReportRunnable().getDesignInstance().getReportElementByID(deh);

and

IChartWithAxes icwa = (IChartWithAxes) image.getReportContent().getReportContext().getReportRunnable().getDesignInstance().getReportElementByID(deh);


I got an ClassCastException for both of them.


Regards

[Updated on: Tue, 12 March 2013 10:49]

Report message to a moderator

Re: How to get an Object of IChartWithAxes in startImageMethod() (HTML Emitter) [message #1018300 is a reply to message #1017687] Wed, 13 March 2013 15:27 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I just tested this in my code using:
Object genby = image.getGenerateBy();
if( genby instanceof ExtendedItemDesign){

ExtendedItemDesign mychart = (ExtendedItemDesign) image.getGenerateBy();
long deh = mychart.getHandle().getID();
ReportDesignHandle rdh = image.getReportContent().getDesign().getReportDesign();


//ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getBody( ).getContents( ).get( 0 );
ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getElementByID(deh);

try {
Chart cm = (Chart) eih.getReportItem( ).getProperty( "chart.instance" );
if( cm instanceof ChartWithAxesImpl){
ChartWithAxesImpl cwa = (ChartWithAxesImpl) cm;
Axis[] axaBase = cwa.getBaseAxes( );
Axis axPrimaryBase = axaBase[0];
System.out.println("test");
}
} catch (ExtendedElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
It worked fine. Make sure you add the chart engine to the required bundles. Here is my manifest:
It is using an older version, so just disregard version numbers.
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Csv Plug-in
Bundle-SymbolicName: org.eclipse.birt.report.engine.emitter.csv;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.eclipse.birt.report.engine.emitter.csv.CsvPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.birt.report.engine,
com.ibm.icu;bundle-version="4.2.1",
org.eclipse.birt.data;bundle-version="2.6.1",
org.eclipse.birt.report.data.adapter;bundle-version="2.6.1",
org.eclipse.birt.chart.engine;bundle-version="2.6.1"
Eclipse-LazyStart: true
Bundle-Vendor: Eclipse.org
Export-Package: org.eclipse.birt.report.engine.emitter.csv
Import-Package: org.eclipse.birt.chart.model

Jason


Re: How to get an Object of IChartWithAxes in startImageMethod() (HTML Emitter) [message #1018303 is a reply to message #1018300] Wed, 13 March 2013 15:33 Go to previous messageGo to next message
Samo B. is currently offline Samo B.
Messages: 41
Registered: December 2012
Member
Hi Jason,

thanks again, I will test it.
I could also get the axes but there is not the categoryAxis. There was just a boolean value for categoryAxis if it's set or not.
But I need the column of this categoryAxis.

First of all i should try yours Smile


Regards,
Samo

[Updated on: Wed, 13 March 2013 15:45]

Report message to a moderator

Re: How to get an Object of IChartWithAxes in startImageMethod() (HTML Emitter) [message #1018323 is a reply to message #1018303] Wed, 13 March 2013 16:01 Go to previous messageGo to next message
Samo B. is currently offline Samo B.
Messages: 41
Registered: December 2012
Member
I still can't get the categoryAxis Value (for example row['CUSTOMER']). :/

[Updated on: Wed, 13 March 2013 16:05]

Report message to a moderator

Re: How to get an Object of IChartWithAxes in startImageMethod() (HTML Emitter) [message #1018336 is a reply to message #1018323] Wed, 13 March 2013 16:24 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

The query is on the series:

try {
Chart cm = (Chart) eih.getReportItem( ).getProperty( "chart.instance" );
if( cm instanceof ChartWithAxesImpl){
ChartWithAxesImpl cwa = (ChartWithAxesImpl) cm;
Axis[] axaBase = cwa.getBaseAxes( );
Axis axPrimaryBase = axaBase[0];
SeriesDefinition sd =axPrimaryBase.getSeriesDefinitions( ).get( 0 );
Query catQuery = sd.getSeries().get(0).getDataDefinition().get(0);
System.out.println("cat Query " + catQuery.getDefinition());
}
System.out.println("test");
} catch (ExtendedElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Jason
Re: How to get an Object of IChartWithAxes in startImageMethod() (HTML Emitter) [message #1018347 is a reply to message #1018336] Wed, 13 March 2013 16:46 Go to previous message
Samo B. is currently offline Samo B.
Messages: 41
Registered: December 2012
Member
Thank you!
Finally I got it Smile

Previous Topic:problem with visibility settings
Next Topic:BiRT "Workbench has not been created yet" exception
Goto Forum:
  


Current Time: Fri Sep 19 12:11:51 GMT 2014

Powered by FUDForum. Page generated in 0.03964 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software