Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to get the CategoryAxis in startImageMethod() (HTML Emitter)
Samo
Hi all,<br />
<br />
I need to get the CategoryAxis and the IChartWithAxes includes a method to receive it.<br />
<br />
But my problem is how to use IChartWithAxes.<br />
<br />
I'm modifying the HTML Emitter and this is the code I use till now:<br />
<br />
Class: HTMLReportEmitter<br />
Method:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>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();
}
.
.
.
}</pre>
<br />
Regards,<br />
Samo
Find more posts tagged with
Comments
Samo
Hi again,<br />
<br />
is there no way to get the CategoryAxis?<br />
<br />
In the book Integrating and Extending BIRT (Page 170) I've found this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>IChart chart = (IChart) rptdesign.getReportElement("Chart name");
and
IChartWithAxes chart = (IChartWithAxes) rptdesign.getReportElement("Name of...");
</pre>
<br />
SO I tried it like this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>IChart ic = (IChart) image.getReportContent().getReportContext().getReportRunnable().getDesignInstance().getReportElementByID(deh);
and
IChartWithAxes icwa = (IChartWithAxes) image.getReportContent().getReportContext().getReportRunnable().getDesignInstance().getReportElementByID(deh);</pre>
<br />
I got an ClassCastException for both of them.<br />
<br />
Regards
Samo
Finally I got it.
Here is the solution:
http://www.eclipse.org/forums/index.php/m/1018347/#msg_1018347
Regards,
Samo