Home » Archived » BIRT » couldn't create pie chart at runtime
couldn't create pie chart at runtime [message #182729] |
Fri, 04 August 2006 10:10 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Lavanya Pinnamareddy![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=lavanya%40pramati.com) Messages: 81 Registered: July 2009 |
Member |
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0053_01C6B7DC.49F048D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
=20
I'm tring to create a pie chart at runtime.
I'm getting script error.
to my knowledge, this is due to improper representaion of DB column in =
the program.
but i'm not able to get proper representaion.
Attached is the code.
actually i don't require 'buyprice' here.
how do i create a slicesize definition?
how do i create category definiton?
how do i add them to chart?
give me some clue on this.
Thanks
package charts;
import java.io.File;
import java.io.IOException;
import org.eclipse.birt.chart.model.ChartWithoutAxes;
import org.eclipse.birt.chart.model.attribute.DataPointComponent;
import org.eclipse.birt.chart.model.attribute.DataPointComponentTyp e;
import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
import org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionI mpl;
import =
org.eclipse.birt.chart.model.attribute.impl.DataPointCompone ntImpl;
import org.eclipse.birt.chart.model.attribute.impl.GradientImpl;
import =
org.eclipse.birt.chart.model.attribute.impl.JavaNumberFormat SpecifierImpl=
;
import org.eclipse.birt.chart.model.component.Series;
import org.eclipse.birt.chart.model.component.impl.SeriesImpl;
import org.eclipse.birt.chart.model.data.BaseSampleData;
import org.eclipse.birt.chart.model.data.DataFactory;
import org.eclipse.birt.chart.model.data.OrthogonalSampleData;
import org.eclipse.birt.chart.model.data.Query;
import org.eclipse.birt.chart.model.data.SampleData;
import org.eclipse.birt.chart.model.data.SeriesDefinition;
import org.eclipse.birt.chart.model.data.impl.QueryImpl;
import org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl;
import org.eclipse.birt.chart.model.impl.ChartWithoutAxesImpl;
import org.eclipse.birt.chart.model.type.PieSeries;
import org.eclipse.birt.chart.model.type.impl.PieSeriesImpl;
import org.eclipse.birt.chart.reportitem.ChartReportItemImpl;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.model.api.CellHandle;
import org.eclipse.birt.report.model.api.DataItemHandle;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.DesignElementHandle;
import org.eclipse.birt.report.model.api.ElementFactory;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.GridHandle;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
import org.eclipse.birt.report.model.api.LabelHandle;
import org.eclipse.birt.report.model.api.OdaDataSetHandle;
import org.eclipse.birt.report.model.api.OdaDataSourceHandle;
import org.eclipse.birt.report.model.api.PropertyHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.RowHandle;
import org.eclipse.birt.report.model.api.SessionHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.StyleHandle;
import org.eclipse.birt.report.model.api.TableHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException ;
import org.eclipse.birt.report.model.api.command.ContentException;
import org.eclipse.birt.report.model.api.command.NameException;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConst ants;
import =
org.eclipse.birt.report.model.api.elements.structures.Comput edColumn;
import =
org.eclipse.birt.report.model.api.extension.ExtendedElementE xception;
import com.ibm.icu.util.ULocale;
/**
* @author lavanya Aug 3, 2006
*/
public class TestPieChart {
private ReportDesignHandle reportDesignHandle =3D null;
private ElementFactory elementFactory =3D null;
private OdaDataSourceHandle customerDataSource =3D null;
private String dataSourceName =3D "cust-DataSource";
private String prodDataSet =3D "cust-DataSet";
private String query =3D "select productLine , quantityInStock , =
buyprice from products group by productLine";
=20
ComputedColumn cs1, cs2, cs3 =3D null;
OdaDataSetHandle dataSetHandle =3D null;
DesignConfig config =3D null;
public static void main(String[] args) {
try {
new TestPieChart().buildReport();
} catch (IOException e) {
e.printStackTrace();
} catch (SemanticException e) {
e.printStackTrace();
}
}
public void buildReport() throws IOException, SemanticException {
init();
createMasterPages();
createDataSources();
createDataSets();
createBody();
String outputPath =3D "C:/test";//$NON-NLS-1$
File outputFolder =3D new File(outputPath);
if (!outputFolder.exists() && !outputFolder.mkdir()) {
throw new IOException("Can not create the output =
folder");//$NON-NLS-1$
}
if (reportDesignHandle !=3D null) {
System.out.println("reportDesignHandle is not NULL");
}
System.out.println("B4 saveAs() method...");
=
reportDesignHandle.saveAs("E:/workspace/BIRT/TEST/TestPieChart.rptdesign "=
);
System.out.println("after saveAs() method...");
System.out.println("Finished");
}
private void init() {
config =3D new DesignConfig();
config.setProperty("BIRT_HOME",
=
"C:/birt-runtime-2_1_0/birt-runtime-2_1_0/ReportEngine");
IDesignEngine engine =3D null;
try {
Platform.startup(config);
IDesignEngineFactory factory =3D (IDesignEngineFactory) =
Platform
=
..createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ ENGINE_FACTORY=
);
if (config =3D=3D null) {
System.out.println("CONFIG IS NULL");
}
if (factory =3D=3D null) {
System.out.println("factory is NULL");
}
engine =3D factory.createDesignEngine(config);
SessionHandle sessionHandle =3D engine
.newSessionHandle(ULocale.ENGLISH);
reportDesignHandle =3D sessionHandle.createDesign();
elementFactory =3D reportDesignHandle.getElementFactory();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void createMasterPages() throws ContentException, =
NameException {
DesignElementHandle simpleMasterPage =3D elementFactory
.newSimpleMasterPage("Master Page");
reportDesignHandle.getMasterPages().add(simpleMasterPage);
}
private void createDataSets() throws SemanticException {
// type of the data set or extension ID
String dataSetType =3D =
"org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet";
dataSetHandle =3D elementFactory.newOdaDataSet(prodDataSet,
dataSetType);
dataSetHandle.setQueryText(query);
dataSetHandle.setDataSource(dataSourceName);
reportDesignHandle.getDataSets().add(dataSetHandle);
}
private void createDataSources() throws SemanticException {
String extensionID =3D "org.eclipse.birt.report.data.oda.jdbc";
String driverClassName =3D "com.mysql.jdbc.Driver";
String driverURL =3D "jdbc:mysql://sudha-k:3306/classicmodels";
String userName =3D "root";
String userPassword =3D "pramati";
customerDataSource =3D =
elementFactory.newOdaDataSource(dataSourceName,
extensionID);
customerDataSource.setProperty("odaDriverClass", =
driverClassName);
customerDataSource.setProperty("odaURL", driverURL);
customerDataSource.setProperty("odaUser", userName);
customerDataSource.setProperty("odaPassword", userPassword);
System.out.println("odaURL is "
+ customerDataSource.getProperty("odaURL"));
System.out.println("odaUser is "
+ customerDataSource.getProperty("odaUser"));
System.out.println("odaPassword is "
+ customerDataSource.getProperty("odaPassword"));
reportDesignHandle.getDataSources().add(customerDataSource);
}
private void createBody() throws IOException, SemanticException {
GridHandle grid =3D elementFactory.newGridItem("My Grid", 3, 5);
grid.setDataSet(dataSetHandle);
grid.setWidth("100%");
reportDesignHandle.getBody().add(grid);
RowHandle row =3D (RowHandle) grid.getRows().get(0);
CellHandle cell =3D (CellHandle) row.getCells().get(0);
=20
cell =3D (CellHandle) row.getCells( ).get( 0 );
cell.setProperty( StyleHandle.TEXT_ALIGN_PROP,
DesignChoiceConstants.TEXT_ALIGN_CENTER );
cell.getContent().add( createPieChart() );
=20
}
private ExtendedItemHandle createPieChart() throws SemanticException =
{
ExtendedItemHandle eih =3D elementFactory.newExtendedItem(null, =
"Chart");//$NON-NLS-1$
try {
eih.setHeight("288pt");//$NON-NLS-1$
eih.setWidth("100%");//$NON-NLS-1$
eih.setProperty(ExtendedItemHandle.DATA_SET_PROP, =
prodDataSet);//$NON-NLS-1$
PropertyHandle computedSet =3D eih.getColumnBindings();
=20
cs1 =3D StructureFactory.createComputedColumn();
cs1.setName("ProductLine");
cs1.setExpression("dataSetRow[\"ProductLine\"]");
computedSet.addItem(cs1);
=20
cs2 =3D StructureFactory.createComputedColumn();
cs2.setName("quantityinstock");
cs2.setExpression("dataSetRow[\"quantityinstock\"]");
computedSet.addItem(cs2);
=20
cs3 =3D StructureFactory.createComputedColumn();
cs3.setName("buyprice1");//$NON-NLS-1$
cs3.setExpression("row[\"buyprice\"]");//$NON-NLS-1$
computedSet.addItem(cs3);
=20
} catch (SemanticException e) {
e.printStackTrace();
}
ChartWithoutAxes cwoaPie =3D ChartWithoutAxesImpl.create();
cwoaPie.setType("Pie Chart");//$NON-NLS-1$
cwoaPie.setSubType("Standard Pie Chart");//$NON-NLS-1$
cwoaPie.getTitle().setVisible(false);
=20
cwoaPie.getBlock().setBounds(BoundsImpl.create(0, 0, 252, 288));
cwoaPie.getBlock().getOutline().setVisible(true);
cwoaPie.getBlock().setBackground(
GradientImpl.create(ColorDefinitionImpl.create(204, 254, =
204),
ColorDefinitionImpl.create(254, 226, 240), -35, =
false));
cwoaPie.getPlot().getClientArea().setBackground(
ColorDefinitionImpl.TRANSPARENT());
=
cwoaPie.getLegend().setBackground(ColorDefinitionImpl.TRANSP ARENT());
cwoaPie.getLegend().getClientArea().setBackground(
ColorDefinitionImpl.TRANSPARENT());
SampleData sd =3D DataFactory.eINSTANCE.createSampleData();
BaseSampleData sdBase =3D =
DataFactory.eINSTANCE.createBaseSampleData();
sdBase.setDataSetRepresentation("Category-A, =
Category-B");//$NON-NLS-1$
sd.getBaseSampleData().add(sdBase);
OrthogonalSampleData sdOrthogonal =3D DataFactory.eINSTANCE
.createOrthogonalSampleData();
sdOrthogonal.setDataSetRepresentation("4,12");//$NON-NLS-1$
sdOrthogonal.setSeriesDefinitionIndex(0);
sd.getOrthogonalSampleData().add(sdOrthogonal);
cwoaPie.setSampleData(sd);=20
Series seCategory =3D SeriesImpl.create( );
Query query =3D =
QueryImpl.create("row[\"ProductLine\"]");//$NON-NLS-1$ =20
seCategory.getDataDefinition().add( query );
SeriesDefinition series =3D SeriesDefinitionImpl.create( );
series.getSeries( ).add( seCategory );
cwoaPie.getSeriesDefinitions( ).add( series );
PieSeries ps =3D (PieSeries) PieSeriesImpl.create( );
Query query2 =3D QueryImpl.create( "row[\"quantityinstock\"]" =
);//$NON-NLS-1$
ps.getDataDefinition( ).add( query2 );
SeriesDefinition seGroup =3D SeriesDefinitionImpl.create( );
Query query1 =3D QueryImpl.create( "row[\"buyprice\"]" =
);//$NON-NLS-1$
seGroup.setQuery( query1 );
series.getSeriesPalette( ).update( -2 );
series.getSeriesDefinitions( ).add( seGroup );
seGroup.getSeries( ).add( ps );
DataPointComponent dpc =3D DataPointComponentImpl.create(
DataPointComponentType.ORTHOGONAL_VALUE_LITERAL,
=
JavaNumberFormatSpecifierImpl.create("###,###"));//$NON-NLS-1$
ps.getDataPoint().getComponents().clear();
ps.getDataPoint().getComponents().add(dpc);
ps.getLabel().setVisible(true);
ChartReportItemImpl crii;
try {
// Add ChartReportItemImpl to ExtendedItemHandle
crii =3D (ChartReportItemImpl) eih.getReportItem();
// Add chart instance to ChartReportItemImpl
crii.setProperty("chart.instance", cwoaPie);//$NON-NLS-1$
} catch (ExtendedElementException e) {
e.printStackTrace();
}
return eih;
}
}
and here is the stack trace , when i excute the report
There are errors evaluating script "row["ProductLine"]".=20
Error.ScriptEvaluationError ( 14 time(s) )detail : =
org.eclipse.birt.report.engine.api.EngineException: There are errors =
evaluating script "row["ProductLine"]".
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:572)
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:534)
at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.evaluat e(DteResultSe=
t.java:328)
at =
org.eclipse.birt.report.engine.extension.internal.RowSet.eva luate(RowSet.=
java:114)
at =
org.eclipse.birt.chart.reportitem.ChartReportItemGenerationI mpl.onRowSets=
(ChartReportItemGenerationImpl.java:166)
at =
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateCont=
ent(ExtendedItemExecutor.java:143)
at =
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(Exte=
ndedItemExecutor.java:89)
at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:63)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLay=
out(HTMLInlineStackingLM.java:94)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChi=
ldren(HTMLInlineStackingLM.java:138)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.jav=
a:30)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:68)
at =
org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTM=
LTableLM.java:74)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:139)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)
at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)
at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:187)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderRepor=
t(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandl=
er.__execute(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.e=
xecute(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.do=
Service(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.ser=
vice(Unknown Source)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known =
Source)
at =
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown =
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at =
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.ja=
va:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at =
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(Applicat=
ionFilterChain.java:247)
at =
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilte=
rChain.java:193)
at =
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve=
..java:256)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve=
..java:191)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.jav=
a:246)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422=
)
at =
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:=
180)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherVal=
ve.java:171)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorRe=
portValve.java:153)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.j=
ava:174)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
at =
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828=
)
at =
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processCo=
nnection(Http11Protocol.java:700)
at =
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584=
)
at =
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.=
java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.mozilla.javascript.EvaluatorException: =
org.eclipse.birt.data.engine.core.DataException: Invalid field name: =
ProductLine
at =
org.eclipse.birt.report.engine.data.dte.NativeRowObject.get( NativeRowObje=
ct.java:94)
at =
org.mozilla.javascript.ScriptableObject.getProperty(Scriptab leObject.java=
:1263)
at =
org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:130=
1)
at =
org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:128=
3)
at org.mozilla.javascript.gen.c131._c0(<inline>:1)
at org.mozilla.javascript.gen.c131.call(<inline>)
at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
at org.mozilla.javascript.gen.c131.call(<inline>)
at org.mozilla.javascript.gen.c131.exec(<inline>)
at =
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:565)
... 63 more
- There are errors evaluating script "row["quantityinstock"]".=20
Error.ScriptEvaluationError ( 14 time(s) )detail : =
org.eclipse.birt.report.engine.api.EngineException: There are errors =
evaluating script "row["quantityinstock"]".
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:572)
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:534)
at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.evaluat e(DteResultSe=
t.java:328)
at =
org.eclipse.birt.report.engine.extension.internal.RowSet.eva luate(RowSet.=
java:114)
at =
org.eclipse.birt.chart.reportitem.ChartReportItemGenerationI mpl.onRowSets=
(ChartReportItemGenerationImpl.java:166)
at =
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateCont=
ent(ExtendedItemExecutor.java:143)
at =
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(Exte=
ndedItemExecutor.java:89)
at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:63)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLay=
out(HTMLInlineStackingLM.java:94)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChi=
ldren(HTMLInlineStackingLM.java:138)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.jav=
a:30)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:68)
at =
org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTM=
LTableLM.java:74)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:139)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)
at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)
at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:187)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderRepor=
t(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandl=
er.__execute(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.e=
xecute(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.do=
Service(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.ser=
vice(Unknown Source)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known =
Source)
at =
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown =
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at =
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.ja=
va:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at =
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(Applicat=
ionFilterChain.java:247)
at =
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilte=
rChain.java:193)
at =
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve=
..java:256)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve=
..java:191)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.jav=
a:246)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422=
)
at =
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:=
180)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherVal=
ve.java:171)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorRe=
portValve.java:153)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.j=
ava:174)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
at =
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828=
)
at =
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processCo=
nnection(Http11Protocol.java:700)
at =
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584=
)
at =
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.=
java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.mozilla.javascript.EvaluatorException: =
org.eclipse.birt.data.engine.core.DataException: Invalid field name: =
quantityinstock
at =
org.eclipse.birt.report.engine.data.dte.NativeRowObject.get( NativeRowObje=
ct.java:94)
at =
org.mozilla.javascript.ScriptableObject.getProperty(Scriptab leObject.java=
:1263)
at =
org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:130=
1)
at =
org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:128=
3)
at org.mozilla.javascript.gen.c132._c0(<inline>:1)
at org.mozilla.javascript.gen.c132.call(<inline>)
at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
at org.mozilla.javascript.gen.c132.call(<inline>)
at org.mozilla.javascript.gen.c132.exec(<inline>)
at =
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:565)
... 63 more
- $NO-RB$ null=20
null ( 1 time(s) )detail : =
org.eclipse.birt.chart.exception.ChartException: $NO-RB$ null
at =
org.eclipse.birt.chart.reportitem.ChartReportItemPresentatio nImpl.onRowSe=
ts(ChartReportItemPresentationImpl.java:529)
at =
org.eclipse.birt.report.engine.presentation.LocalizedContent Visitor.proce=
ssExtendedContent(LocalizedContentVisitor.java:591)
at =
org.eclipse.birt.report.engine.presentation.LocalizedContent Visitor.visit=
Foreign(LocalizedContentVisitor.java:347)
at =
org.eclipse.birt.report.engine.content.impl.ForeignContent.a ccept(Foreign=
Content.java:52)
at =
org.eclipse.birt.report.engine.presentation.LocalizedContent Visitor.local=
ize(LocalizedContentVisitor.java:107)
at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:38)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:63)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLay=
out(HTMLInlineStackingLM.java:94)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChi=
ldren(HTMLInlineStackingLM.java:138)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.jav=
a:30)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:68)
at =
org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTM=
LTableLM.java:74)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:139)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)
at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)
at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:187)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderRepor=
t(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandl=
er.__execute(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.e=
xecute(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.do=
Service(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.ser=
vice(Unknown Source)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known =
Source)
at =
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown =
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at =
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.ja=
va:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at =
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(Applicat=
ionFilterChain.java:247)
at =
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilte=
rChain.java:193)
at =
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve=
..java:256)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve=
..java:191)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.jav=
a:246)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422=
)
at =
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:=
180)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherVal=
ve.java:171)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorRe=
portValve.java:153)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.j=
ava:174)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
at =
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828=
)
at =
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processCo=
nnection(Http11Protocol.java:700)
at =
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584=
)
at =
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.=
java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
at =
org.eclipse.birt.chart.internal.factory.DataProcessor.adjust EachDataSet(D=
ataProcessor.java:1469)
at =
org.eclipse.birt.chart.internal.factory.DataProcessor.adjust DataSet(DataP=
rocessor.java:1438)
at =
org.eclipse.birt.chart.internal.factory.DataProcessor.genera teRuntimeSeri=
es(DataProcessor.java:1168)
at =
org.eclipse.birt.chart.internal.factory.DataProcessor.genera teRuntimeSeri=
es(DataProcessor.java:1019)
at =
org.eclipse.birt.chart.factory.Generator.bindData(Generator. java:567)
at =
org.eclipse.birt.chart.reportitem.ChartReportItemPresentatio nImpl.onRowSe=
ts(ChartReportItemPresentationImpl.java:399)
... 61 more
=20
--=20
Regards
Lavanya PinnamaReddy
--=20
Regards
Lavanya PinnamaReddy
------=_NextPart_000_0053_01C6B7DC.49F048D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2> =20
<DIV><FONT face=3DArial size=3D2>I'm tring to create a pie chart at=20
runtime.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm getting script error.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>to my knowledge, this is due to =
improper=20
representaion of DB column in the program.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>but i'm not able to get proper=20
representaion.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Attached is the code.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>actually i don't require 'buyprice'=20
here.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>how do i create a slicesize=20
definition?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>how do i create category =
definiton?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>how do i add them to =
chart?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>give me some clue on this.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>package charts;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>import java.io.File;<BR>import=20
java.io.IOException;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>import=20
org.eclipse.birt.chart.model.ChartWithoutAxes;<BR>import=20
org.eclipse.birt.chart.model.attribute.DataPointComponent;<BR >import=20
org.eclipse.birt.chart.model.attribute.DataPointComponentTyp e; <BR>import =
org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;<BR>import=20
org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionI mpl; <BR>impor=
t=20
org.eclipse.birt.chart.model.attribute.impl.DataPointCompone ntImpl; <BR>im=
port=20
org.eclipse.birt.chart.model.attribute.impl.GradientImpl;<BR >import=20
org.eclipse.birt.chart.model.attribute.impl.JavaNumberFormat SpecifierImpl=
;<BR>import=20
org.eclipse.birt.chart.model.component.Series;<BR>import=20
org.eclipse.birt.chart.model.component.impl.SeriesImpl;<BR>import=20
org.eclipse.birt.chart.model.data.BaseSampleData;<BR>import=20
org.eclipse.birt.chart.model.data.DataFactory;<BR>import=20
org.eclipse.birt.chart.model.data.OrthogonalSampleData;<BR>import=20
org.eclipse.birt.chart.model.data.Query;<BR>import=20
org.eclipse.birt.chart.model.data.SampleData;<BR>import=20
org.eclipse.birt.chart.model.data.SeriesDefinition;<BR>import=20
org.eclipse.birt.chart.model.data.impl.QueryImpl;<BR>import=20
org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl; <BR>import=20
org.eclipse.birt.chart.model.impl.ChartWithoutAxesImpl;<BR>import=20
org.eclipse.birt.chart.model.type.PieSeries;<BR>import=20
org.eclipse.birt.chart.model.type.impl.PieSeriesImpl;<BR>import=20
org.eclipse.birt.chart.reportitem.ChartReportItemImpl;<BR>import=20
org.eclipse.birt.core.framework.Platform;<BR>import=20
org.eclipse.birt.report.model.api.CellHandle;<BR>import=20
org.eclipse.birt.report.model.api.DataItemHandle;<BR>import=20
org.eclipse.birt.report.model.api.DesignConfig;<BR>import=20
org.eclipse.birt.report.model.api.DesignElementHandle;<BR>import=20
org.eclipse.birt.report.model.api.ElementFactory;<BR>import=20
org.eclipse.birt.report.model.api.ExtendedItemHandle;<BR>import=20
org.eclipse.birt.report.model.api.GridHandle;<BR>import=20
org.eclipse.birt.report.model.api.IDesignEngine;<BR>import=20
org.eclipse.birt.report.model.api.IDesignEngineFactory;<BR>import=20
org.eclipse.birt.report.model.api.LabelHandle;<BR>import=20
org.eclipse.birt.report.model.api.OdaDataSetHandle;<BR>import=20
org.eclipse.birt.report.model.api.OdaDataSourceHandle;<BR>import=20
org.eclipse.birt.report.model.api.PropertyHandle;<BR>import=20
org.eclipse.birt.report.model.api.ReportDesignHandle;<BR>import=20
org.eclipse.birt.report.model.api.RowHandle;<BR>import=20
org.eclipse.birt.report.model.api.SessionHandle;<BR>import=20
org.eclipse.birt.report.model.api.StructureFactory;<BR>import=20
org.eclipse.birt.report.model.api.StyleHandle;<BR>import=20
org.eclipse.birt.report.model.api.TableHandle;<BR>import=20
org.eclipse.birt.report.model.api.activity.SemanticException ; <BR>import=20
org.eclipse.birt.report.model.api.command.ContentException;<BR >import=20
org.eclipse.birt.report.model.api.command.NameException;<BR >import=20
org.eclipse.birt.report.model.api.elements.DesignChoiceConst ants; <BR>impo=
rt=20
org.eclipse.birt.report.model.api.elements.structures.Comput edColumn; <BR>=
import=20
org.eclipse.birt.report.model.api.extension.ExtendedElementE xception; </FO=
NT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>import =
com.ibm.icu.util.ULocale;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>/**<BR> * @author lavanya Aug 3,=20
2006<BR> */<BR>public class TestPieChart {<BR> =
private=20
ReportDesignHandle reportDesignHandle =3D null;<BR> =
private=20
ElementFactory elementFactory =3D null;<BR> private=20
OdaDataSourceHandle customerDataSource =3D null;<BR> =
private=20
String dataSourceName =3D "cust-DataSource";<BR> =
private String=20
prodDataSet =3D "cust-DataSet";<BR> private String =
query =3D=20
"select productLine , quantityInStock , buyprice from products group by=20
productLine";<BR> <BR> =
ComputedColumn cs1,=20
cs2, cs3 =3D null;<BR> OdaDataSetHandle dataSetHandle =
=3D=20
null;<BR> DesignConfig config =3D null;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> public static void =
main(String[]=20
args) {<BR> try=20
{<BR> =
new=20
TestPieChart().buildReport();<BR> &nbs=
p; }=20
catch (IOException e)=20
{<BR> =20
e.printStackTrace();<BR> } =
catch=20
(SemanticException e)=20
{<BR> =20
e.printStackTrace();<BR> =20
}<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> public void =
buildReport() throws=20
IOException, SemanticException =
{<BR> =20
init();<BR> =20
createMasterPages();<BR> =20
createDataSources();<BR> =20
createDataSets();<BR> =20
createBody();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> String=20
outputPath =3D=20
"C:/test";//$NON-NLS-1$<BR> =
File=20
outputFolder =3D new=20
File(outputPath);<BR> if=20
(!outputFolder.exists() && !outputFolder.mkdir())=20
{<BR> =
throw=20
new IOException("Can not create the output=20
folder");//$NON-NLS-1$<BR> =20
}<BR> if (reportDesignHandle =
!=3D null)=20
{<BR> =20
System.out.println("reportDesignHandle is not=20
NULL");<BR> =20
}<BR> System.out.println("B4 =
saveAs()=20
method...");<BR> =20
reportDesignHandle.saveAs("E:/workspace/BIRT/TEST/TestPieChart.rptdesign "=
);<BR> =20
System.out.println("after saveAs()=20
method...");<BR> =20
System.out.println("Finished");<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> private void init()=20
{<BR> config =3D new=20
DesignConfig();<BR> =20
config.setProperty("BIRT_HOME",<BR> &n=
bsp; &n bsp; =20
"C:/birt-runtime-2_1_0/birt-runtime-2_1_0/ReportEngine");<BR > =
=20
IDesignEngine engine =3D =
null;<BR> try=20
{<BR> =20
Platform.startup(config);<BR> &n=
bsp; =20
IDesignEngineFactory factory =3D (IDesignEngineFactory)=20
Platform<BR> &=
nbsp; & nbsp; =20
..createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ ENGINE_FACTORY=
);<BR> =
if (config =3D=3D null)=20
{<BR> &n=
bsp; =20
System.out.println("CONFIG IS=20
NULL");<BR> &n=
bsp;=20
}<BR> =
if=20
(factory =3D=3D null)=20
{<BR> &n=
bsp; =20
System.out.println("factory is =20
NULL");<BR> &n=
bsp;=20
}<BR> =
engine =3D=20
factory.createDesignEngine(config);<BR> &nbs=
p; =20
SessionHandle sessionHandle =3D=20
engine<BR> &nb=
sp; &nb sp; =20
..newSessionHandle(ULocale.ENGLISH);<BR> &nbs=
p; =20
reportDesignHandle =3D=20
sessionHandle.createDesign();<BR> &nbs=
p; =20
elementFactory =3D=20
reportDesignHandle.getElementFactory();<BR> =
=20
} catch (Exception ex)=20
{<BR> =20
ex.printStackTrace();<BR> =20
}<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> private void =
createMasterPages()=20
throws ContentException, NameException=20
{<BR> DesignElementHandle=20
simpleMasterPage =3D=20
elementFactory<BR> &=
nbsp; =20
..newSimpleMasterPage("Master=20
Page");<BR> =20
reportDesignHandle.getMasterPages().add(simpleMasterPage);<BR >  =
; =20
}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> private void =
createDataSets()=20
throws SemanticException {<BR> =
// type=20
of the data set or extension =
ID<BR> =20
String dataSetType =3D=20
"org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet";<BR >  =
; =20
dataSetHandle =3D=20
elementFactory.newOdaDataSet(prodDataSet,<BR> &nbs=
p; &nbs p; =20
dataSetType);<BR> =20
dataSetHandle.setQueryText(query);<BR>  =
; =20
dataSetHandle.setDataSource(dataSourceName);<BR> &=
nbsp; =20
reportDesignHandle.getDataSets().add(dataSetHandle);<BR>  =
;=20
}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> private void =
createDataSources()=20
throws SemanticException {<BR> =
String=20
extensionID =3D=20
"org.eclipse.birt.report.data.oda.jdbc";<BR>  =
; =20
String driverClassName =3D=20
"com.mysql.jdbc.Driver";<BR> =
String=20
driverURL =3D=20
"jdbc:mysql://sudha-k:3306/classicmodels";<BR> &nb=
sp; =20
String userName =3D =
"root";<BR> String=20
userPassword =3D "pramati";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
customerDataSource =3D=20
elementFactory.newOdaDataSource(dataSourceName,<BR> &nbs=
p; &nbs p; =20
extensionID);<BR> =20
customerDataSource.setProperty("odaDriverClass",=20
driverClassName);<BR> =20
customerDataSource.setProperty("odaURL",=20
driverURL);<BR> =20
customerDataSource.setProperty("odaUser",=20
userName);<BR> =20
customerDataSource.setProperty("odaPassword", =
userPassword);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
System.out.println("odaURL is=20
"<BR> &n=
bsp; =20
+=20
customerDataSource.getProperty("odaURL"));<BR> &nb=
sp; =20
System.out.println("odaUser is=20
"<BR> &n=
bsp; =20
+=20
customerDataSource.getProperty("odaUser"));<BR> &n=
bsp; =20
System.out.println("odaPassword is=20
"<BR> &n=
bsp; =20
+ c
|
|
|
Re: couldn't create pie chart at runtime- Resolved [message #182783 is a reply to message #182729] |
Fri, 04 August 2006 13:26 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Lavanya Pinnamareddy![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=lavanya%40pramati.com) Messages: 81 Registered: July 2009 |
Member |
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_007B_01C6B7F7.A79B8470
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Resloved.
problem was:
case-sensitiveness of DB column name in the expression.
and also.. series and grouping .
This thread helped me.
http://dev.eclipse.org/newslists/news.eclipse.birt/msg11336. html
Thanks David!
--=20
Regards
Lavanya PinnamaReddy
"Lavanya" <lavanya@pramati.com> wrote in message =
news:eav5tk$jbl$1@utils.eclipse.org...
=20
I'm tring to create a pie chart at runtime.
I'm getting script error.
to my knowledge, this is due to improper representaion of DB column =
in the program.
but i'm not able to get proper representaion.
Attached is the code.
actually i don't require 'buyprice' here.
how do i create a slicesize definition?
how do i create category definiton?
how do i add them to chart?
give me some clue on this.
Thanks
package charts;
import java.io.File;
import java.io.IOException;
import org.eclipse.birt.chart.model.ChartWithoutAxes;
import org.eclipse.birt.chart.model.attribute.DataPointComponent;
import org.eclipse.birt.chart.model.attribute.DataPointComponentTyp e;
import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
import =
org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionI mpl;
import =
org.eclipse.birt.chart.model.attribute.impl.DataPointCompone ntImpl;
import org.eclipse.birt.chart.model.attribute.impl.GradientImpl;
import =
org.eclipse.birt.chart.model.attribute.impl.JavaNumberFormat SpecifierImpl=
;
import org.eclipse.birt.chart.model.component.Series;
import org.eclipse.birt.chart.model.component.impl.SeriesImpl;
import org.eclipse.birt.chart.model.data.BaseSampleData;
import org.eclipse.birt.chart.model.data.DataFactory;
import org.eclipse.birt.chart.model.data.OrthogonalSampleData;
import org.eclipse.birt.chart.model.data.Query;
import org.eclipse.birt.chart.model.data.SampleData;
import org.eclipse.birt.chart.model.data.SeriesDefinition;
import org.eclipse.birt.chart.model.data.impl.QueryImpl;
import org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl;
import org.eclipse.birt.chart.model.impl.ChartWithoutAxesImpl;
import org.eclipse.birt.chart.model.type.PieSeries;
import org.eclipse.birt.chart.model.type.impl.PieSeriesImpl;
import org.eclipse.birt.chart.reportitem.ChartReportItemImpl;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.model.api.CellHandle;
import org.eclipse.birt.report.model.api.DataItemHandle;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.DesignElementHandle;
import org.eclipse.birt.report.model.api.ElementFactory;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.GridHandle;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
import org.eclipse.birt.report.model.api.LabelHandle;
import org.eclipse.birt.report.model.api.OdaDataSetHandle;
import org.eclipse.birt.report.model.api.OdaDataSourceHandle;
import org.eclipse.birt.report.model.api.PropertyHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.RowHandle;
import org.eclipse.birt.report.model.api.SessionHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.StyleHandle;
import org.eclipse.birt.report.model.api.TableHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException ;
import org.eclipse.birt.report.model.api.command.ContentException;
import org.eclipse.birt.report.model.api.command.NameException;
import =
org.eclipse.birt.report.model.api.elements.DesignChoiceConst ants;
import =
org.eclipse.birt.report.model.api.elements.structures.Comput edColumn;
import =
org.eclipse.birt.report.model.api.extension.ExtendedElementE xception;
import com.ibm.icu.util.ULocale;
/**
* @author lavanya Aug 3, 2006
*/
public class TestPieChart {
private ReportDesignHandle reportDesignHandle =3D null;
private ElementFactory elementFactory =3D null;
private OdaDataSourceHandle customerDataSource =3D null;
private String dataSourceName =3D "cust-DataSource";
private String prodDataSet =3D "cust-DataSet";
private String query =3D "select productLine , quantityInStock , =
buyprice from products group by productLine";
=20
ComputedColumn cs1, cs2, cs3 =3D null;
OdaDataSetHandle dataSetHandle =3D null;
DesignConfig config =3D null;
public static void main(String[] args) {
try {
new TestPieChart().buildReport();
} catch (IOException e) {
e.printStackTrace();
} catch (SemanticException e) {
e.printStackTrace();
}
}
public void buildReport() throws IOException, SemanticException {
init();
createMasterPages();
createDataSources();
createDataSets();
createBody();
String outputPath =3D "C:/test";//$NON-NLS-1$
File outputFolder =3D new File(outputPath);
if (!outputFolder.exists() && !outputFolder.mkdir()) {
throw new IOException("Can not create the output =
folder");//$NON-NLS-1$
}
if (reportDesignHandle !=3D null) {
System.out.println("reportDesignHandle is not NULL");
}
System.out.println("B4 saveAs() method...");
=
reportDesignHandle.saveAs("E:/workspace/BIRT/TEST/TestPieChart.rptdesign "=
);
System.out.println("after saveAs() method...");
System.out.println("Finished");
}
private void init() {
config =3D new DesignConfig();
config.setProperty("BIRT_HOME",
=
"C:/birt-runtime-2_1_0/birt-runtime-2_1_0/ReportEngine");
IDesignEngine engine =3D null;
try {
Platform.startup(config);
IDesignEngineFactory factory =3D (IDesignEngineFactory) =
Platform
=
..createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ ENGINE_FACTORY=
);
if (config =3D=3D null) {
System.out.println("CONFIG IS NULL");
}
if (factory =3D=3D null) {
System.out.println("factory is NULL");
}
engine =3D factory.createDesignEngine(config);
SessionHandle sessionHandle =3D engine
.newSessionHandle(ULocale.ENGLISH);
reportDesignHandle =3D sessionHandle.createDesign();
elementFactory =3D reportDesignHandle.getElementFactory();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void createMasterPages() throws ContentException, =
NameException {
DesignElementHandle simpleMasterPage =3D elementFactory
.newSimpleMasterPage("Master Page");
reportDesignHandle.getMasterPages().add(simpleMasterPage);
}
private void createDataSets() throws SemanticException {
// type of the data set or extension ID
String dataSetType =3D =
"org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet";
dataSetHandle =3D elementFactory.newOdaDataSet(prodDataSet,
dataSetType);
dataSetHandle.setQueryText(query);
dataSetHandle.setDataSource(dataSourceName);
reportDesignHandle.getDataSets().add(dataSetHandle);
}
private void createDataSources() throws SemanticException {
String extensionID =3D =
"org.eclipse.birt.report.data.oda.jdbc";
String driverClassName =3D "com.mysql.jdbc.Driver";
String driverURL =3D =
"jdbc:mysql://sudha-k:3306/classicmodels";
String userName =3D "root";
String userPassword =3D "pramati";
customerDataSource =3D =
elementFactory.newOdaDataSource(dataSourceName,
extensionID);
customerDataSource.setProperty("odaDriverClass", =
driverClassName);
customerDataSource.setProperty("odaURL", driverURL);
customerDataSource.setProperty("odaUser", userName);
customerDataSource.setProperty("odaPassword", userPassword);
System.out.println("odaURL is "
+ customerDataSource.getProperty("odaURL"));
System.out.println("odaUser is "
+ customerDataSource.getProperty("odaUser"));
System.out.println("odaPassword is "
+ customerDataSource.getProperty("odaPassword"));
reportDesignHandle.getDataSources().add(customerDataSource);
}
private void createBody() throws IOException, SemanticException {
GridHandle grid =3D elementFactory.newGridItem("My Grid", 3, =
5);
grid.setDataSet(dataSetHandle);
grid.setWidth("100%");
reportDesignHandle.getBody().add(grid);
RowHandle row =3D (RowHandle) grid.getRows().get(0);
CellHandle cell =3D (CellHandle) row.getCells().get(0);
=20
cell =3D (CellHandle) row.getCells( ).get( 0 );
cell.setProperty( StyleHandle.TEXT_ALIGN_PROP,
DesignChoiceConstants.TEXT_ALIGN_CENTER );
cell.getContent().add( createPieChart() );
=20
}
private ExtendedItemHandle createPieChart() throws =
SemanticException {
ExtendedItemHandle eih =3D =
elementFactory.newExtendedItem(null, "Chart");//$NON-NLS-1$
try {
eih.setHeight("288pt");//$NON-NLS-1$
eih.setWidth("100%");//$NON-NLS-1$
eih.setProperty(ExtendedItemHandle.DATA_SET_PROP, =
prodDataSet);//$NON-NLS-1$
PropertyHandle computedSet =3D eih.getColumnBindings();
=20
cs1 =3D StructureFactory.createComputedColumn();
cs1.setName("ProductLine");
cs1.setExpression("dataSetRow[\"ProductLine\"]");
computedSet.addItem(cs1);
=20
cs2 =3D StructureFactory.createComputedColumn();
cs2.setName("quantityinstock");
cs2.setExpression("dataSetRow[\"quantityinstock\"]");
computedSet.addItem(cs2);
=20
cs3 =3D StructureFactory.createComputedColumn();
cs3.setName("buyprice1");//$NON-NLS-1$
cs3.setExpression("row[\"buyprice\"]");//$NON-NLS-1$
computedSet.addItem(cs3);
=20
} catch (SemanticException e) {
e.printStackTrace();
}
ChartWithoutAxes cwoaPie =3D ChartWithoutAxesImpl.create();
cwoaPie.setType("Pie Chart");//$NON-NLS-1$
cwoaPie.setSubType("Standard Pie Chart");//$NON-NLS-1$
cwoaPie.getTitle().setVisible(false);
=20
cwoaPie.getBlock().setBounds(BoundsImpl.create(0, 0, 252, =
288));
cwoaPie.getBlock().getOutline().setVisible(true);
cwoaPie.getBlock().setBackground(
GradientImpl.create(ColorDefinitionImpl.create(204, =
254, 204),
ColorDefinitionImpl.create(254, 226, 240), =
-35, false));
cwoaPie.getPlot().getClientArea().setBackground(
ColorDefinitionImpl.TRANSPARENT());
=
cwoaPie.getLegend().setBackground(ColorDefinitionImpl.TRANSP ARENT());
cwoaPie.getLegend().getClientArea().setBackground(
ColorDefinitionImpl.TRANSPARENT());
SampleData sd =3D DataFactory.eINSTANCE.createSampleData();
BaseSampleData sdBase =3D =
DataFactory.eINSTANCE.createBaseSampleData();
sdBase.setDataSetRepresentation("Category-A, =
Category-B");//$NON-NLS-1$
sd.getBaseSampleData().add(sdBase);
OrthogonalSampleData sdOrthogonal =3D DataFactory.eINSTANCE
.createOrthogonalSampleData();
sdOrthogonal.setDataSetRepresentation("4,12");//$NON-NLS-1$
sdOrthogonal.setSeriesDefinitionIndex(0);
sd.getOrthogonalSampleData().add(sdOrthogonal);
cwoaPie.setSampleData(sd);=20
Series seCategory =3D SeriesImpl.create( );
Query query =3D =
QueryImpl.create("row[\"ProductLine\"]");//$NON-NLS-1$ =20
seCategory.getDataDefinition().add( query );
SeriesDefinition series =3D SeriesDefinitionImpl.create( );
series.getSeries( ).add( seCategory );
cwoaPie.getSeriesDefinitions( ).add( series );
PieSeries ps =3D (PieSeries) PieSeriesImpl.create( );
Query query2 =3D QueryImpl.create( "row[\"quantityinstock\"]" =
);//$NON-NLS-1$
ps.getDataDefinition( ).add( query2 );
SeriesDefinition seGroup =3D SeriesDefinitionImpl.create( );
Query query1 =3D QueryImpl.create( "row[\"buyprice\"]" =
);//$NON-NLS-1$
seGroup.setQuery( query1 );
series.getSeriesPalette( ).update( -2 );
series.getSeriesDefinitions( ).add( seGroup );
seGroup.getSeries( ).add( ps );
DataPointComponent dpc =3D DataPointComponentImpl.create(
DataPointComponentType.ORTHOGONAL_VALUE_LITERAL,
=
JavaNumberFormatSpecifierImpl.create("###,###"));//$NON-NLS-1$
ps.getDataPoint().getComponents().clear();
ps.getDataPoint().getComponents().add(dpc);
ps.getLabel().setVisible(true);
ChartReportItemImpl crii;
try {
// Add ChartReportItemImpl to ExtendedItemHandle
crii =3D (ChartReportItemImpl) eih.getReportItem();
// Add chart instance to ChartReportItemImpl
crii.setProperty("chart.instance", cwoaPie);//$NON-NLS-1$
} catch (ExtendedElementException e) {
e.printStackTrace();
}
return eih;
}
}
and here is the stack trace , when i excute the report
There are errors evaluating script "row["ProductLine"]".=20
Error.ScriptEvaluationError ( 14 time(s) )detail : =
org.eclipse.birt.report.engine.api.EngineException: There are errors =
evaluating script "row["ProductLine"]".
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:572)
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:534)
at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.evaluat e(DteResultSe=
t.java:328)
at =
org.eclipse.birt.report.engine.extension.internal.RowSet.eva luate(RowSet.=
java:114)
at =
org.eclipse.birt.chart.reportitem.ChartReportItemGenerationI mpl.onRowSets=
(ChartReportItemGenerationImpl.java:166)
at =
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateCont=
ent(ExtendedItemExecutor.java:143)
at =
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(Exte=
ndedItemExecutor.java:89)
at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:63)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLay=
out(HTMLInlineStackingLM.java:94)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChi=
ldren(HTMLInlineStackingLM.java:138)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.jav=
a:30)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:68)
at =
org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTM=
LTableLM.java:74)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:139)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)
at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)
at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:187)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderRepor=
t(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandl=
er.__execute(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.e=
xecute(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.do=
Service(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.ser=
vice(Unknown Source)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known =
Source)
at =
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown =
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at =
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.ja=
va:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at =
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(Applicat=
ionFilterChain.java:247)
at =
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilte=
rChain.java:193)
at =
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve=
..java:256)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve=
..java:191)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.jav=
a:246)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422=
)
at =
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:=
180)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherVal=
ve.java:171)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorRe=
portValve.java:153)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.j=
ava:174)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
at =
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828=
)
at =
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processCo=
nnection(Http11Protocol.java:700)
at =
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584=
)
at =
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.=
java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.mozilla.javascript.EvaluatorException: =
org.eclipse.birt.data.engine.core.DataException: Invalid field name: =
ProductLine
at =
org.eclipse.birt.report.engine.data.dte.NativeRowObject.get( NativeRowObje=
ct.java:94)
at =
org.mozilla.javascript.ScriptableObject.getProperty(Scriptab leObject.java=
:1263)
at =
org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:130=
1)
at =
org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:128=
3)
at org.mozilla.javascript.gen.c131._c0(<inline>:1)
at org.mozilla.javascript.gen.c131.call(<inline>)
at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
at org.mozilla.javascript.gen.c131.call(<inline>)
at org.mozilla.javascript.gen.c131.exec(<inline>)
at =
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:565)
... 63 more
- There are errors evaluating script "row["quantityinstock"]".=20
Error.ScriptEvaluationError ( 14 time(s) )detail : =
org.eclipse.birt.report.engine.api.EngineException: There are errors =
evaluating script "row["quantityinstock"]".
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:572)
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:534)
at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.evaluat e(DteResultSe=
t.java:328)
at =
org.eclipse.birt.report.engine.extension.internal.RowSet.eva luate(RowSet.=
java:114)
at =
org.eclipse.birt.chart.reportitem.ChartReportItemGenerationI mpl.onRowSets=
(ChartReportItemGenerationImpl.java:166)
at =
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateCont=
ent(ExtendedItemExecutor.java:143)
at =
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(Exte=
ndedItemExecutor.java:89)
at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:63)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLay=
out(HTMLInlineStackingLM.java:94)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChi=
ldren(HTMLInlineStackingLM.java:138)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.jav=
a:30)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:68)
at =
org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTM=
LTableLM.java:74)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:139)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)
at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)
at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:187)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderRepor=
t(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandl=
er.__execute(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.e=
xecute(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.do=
Service(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.ser=
vice(Unknown Source)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known =
Source)
at =
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown =
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at =
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.ja=
va:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at =
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(Applicat=
ionFilterChain.java:247)
at =
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilte=
rChain.java:193)
at =
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve=
..java:256)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve=
..java:191)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.jav=
a:246)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422=
)
at =
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:=
180)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherVal=
ve.java:171)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorRe=
portValve.java:153)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.j=
ava:174)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
at =
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828=
)
at =
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processCo=
nnection(Http11Protocol.java:700)
at =
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584=
)
at =
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.=
java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.mozilla.javascript.EvaluatorException: =
org.eclipse.birt.data.engine.core.DataException: Invalid field name: =
quantityinstock
at =
org.eclipse.birt.report.engine.data.dte.NativeRowObject.get( NativeRowObje=
ct.java:94)
at =
org.mozilla.javascript.ScriptableObject.getProperty(Scriptab leObject.java=
:1263)
at =
org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:130=
1)
at =
org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:128=
3)
at org.mozilla.javascript.gen.c132._c0(<inline>:1)
at org.mozilla.javascript.gen.c132.call(<inline>)
at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
at org.mozilla.javascript.gen.c132.call(<inline>)
at org.mozilla.javascript.gen.c132.exec(<inline>)
at =
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
at =
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(Executi=
onContext.java:565)
... 63 more
- $NO-RB$ null=20
null ( 1 time(s) )detail : =
org.eclipse.birt.chart.exception.ChartException: $NO-RB$ null
at =
org.eclipse.birt.chart.reportitem.ChartReportItemPresentatio nImpl.onRowSe=
ts(ChartReportItemPresentationImpl.java:529)
at =
org.eclipse.birt.report.engine.presentation.LocalizedContent Visitor.proce=
ssExtendedContent(LocalizedContentVisitor.java:591)
at =
org.eclipse.birt.report.engine.presentation.LocalizedContent Visitor.visit=
Foreign(LocalizedContentVisitor.java:347)
at =
org.eclipse.birt.report.engine.content.impl.ForeignContent.a ccept(Foreign=
Content.java:52)
at =
org.eclipse.birt.report.engine.presentation.LocalizedContent Visitor.local=
ize(LocalizedContentVisitor.java:107)
at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:38)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:63)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLay=
out(HTMLInlineStackingLM.java:94)
at =
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChi=
ldren(HTMLInlineStackingLM.java:138)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.jav=
a:30)
at =
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChil=
dren(HTMLBlockStackingLM.java:68)
at =
org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTM=
LTableLM.java:74)
at =
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbst=
ractLM.java:156)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:139)
at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)
at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)
at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:187)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Un=
known Source)
at =
org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderRepor=
t(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandl=
er.__execute(Unknown Source)
at =
org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.e=
xecute(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.do=
Service(Unknown Source)
at =
org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.ser=
vice(Unknown Source)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known =
Source)
at =
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown =
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at =
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.ja=
va:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at =
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(Applicat=
ionFilterChain.java:247)
at =
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilte=
rChain.java:193)
at =
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve=
..java:256)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve=
..java:191)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.jav=
a:246)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422=
)
at =
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:=
180)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherVal=
ve.java:171)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorRe=
portValve.java:153)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:641)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.j=
ava:174)
at =
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.in=
vokeNext(StandardPipeline.java:643)
at =
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:48=
0)
at =
org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at =
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
at =
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828=
)
at =
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processCo=
nnection(Http11Protocol.java:700)
at =
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584=
)
at =
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.=
java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
at =
org.eclipse.birt.chart.internal.factory.DataProcessor.adjust EachDataSet(D=
ataProcessor.java:1469)
at =
org.eclipse.birt.chart.internal.factory.DataProcessor.adjust DataSet(DataP=
rocessor.java:1438)
at =
org.eclipse.birt.chart.internal.factory.DataProcessor.genera teRuntimeSeri=
es(DataProcessor.java:1168)
at =
org.eclipse.birt.chart.internal.factory.DataProcessor.genera teRuntimeSeri=
es(DataProcessor.java:1019)
at =
org.eclipse.birt.chart.factory.Generator.bindData(Generator. java:567)
at =
org.eclipse.birt.chart.reportitem.ChartReportItemPresentatio nImpl.onRowSe=
ts(ChartReportItemPresentationImpl.java:399)
... 61 more
=20
--=20
Regards
Lavanya PinnamaReddy
--=20
Regards
Lavanya PinnamaReddy
------=_NextPart_000_007B_01C6B7F7.A79B8470
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Resloved.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>problem was:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>case-sensitiveness of DB column name in =
the=20
expression.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>and also.. series and grouping =
..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>This thread helped me.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D" http://dev.eclipse.org/newslists/news.eclipse.birt/msg11336. html"=
> http://dev.eclipse.org/newslists/news.eclipse.birt/msg11336. html</A></FO=
NT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks David!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT><BR>--=20
<BR>Regards<BR>Lavanya PinnamaReddy</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Lavanya" <<A=20
href=3D"mailto:lavanya@pramati.com">lavanya@pramati.com</A>> wrote =
in message=20
<A=20
=
href=3D"news:eav5tk$jbl$1@utils.eclipse.org">news:eav5tk$jbl$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2> =20
<DIV><FONT face=3DArial size=3D2>I'm tring to create a pie chart at=20
runtime.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm getting script =
error.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>to my knowledge, this is due to =
improper=20
representaion of DB column in the program.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>but i'm not able to get proper=20
representaion.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Attached is the code.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>actually i don't require 'buyprice'=20
here.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>how do i create a slicesize=20
definition?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>how do i create category =
definiton?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>how do i add them to =
chart?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>give me some clue on =
this.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>package charts;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>import java.io.File;<BR>import=20
java.io.IOException;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>import=20
org.eclipse.birt.chart.model.ChartWithoutAxes;<BR>import=20
org.eclipse.birt.chart.model.attribute.DataPointComponent;<BR >import=20
=
org.eclipse.birt.chart.model.attribute.DataPointComponentTyp e; <BR>import =
org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;<BR>import=20
=
org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionI mpl; <BR>impor=
t=20
=
org.eclipse.birt.chart.model.attribute.impl.DataPointCompone ntImpl; <BR>im=
port=20
org.eclipse.birt.chart.model.attribute.impl.GradientImpl;<BR >import=20
=
org.eclipse.birt.chart.model.attribute.impl.JavaNumberFormat SpecifierImpl=
;<BR>import=20
org.eclipse.birt.chart.model.component.Series;<BR>import=20
org.eclipse.birt.chart.model.component.impl.SeriesImpl;<BR>import=20
org.eclipse.birt.chart.model.data.BaseSampleData;<BR>import=20
org.eclipse.birt.chart.model.data.DataFactory;<BR>import=20
org.eclipse.birt.chart.model.data.OrthogonalSampleData;<BR>import=20
org.eclipse.birt.chart.model.data.Query;<BR>import=20
org.eclipse.birt.chart.model.data.SampleData;<BR>import=20
org.eclipse.birt.chart.model.data.SeriesDefinition;<BR>import=20
org.eclipse.birt.chart.model.data.impl.QueryImpl;<BR>import=20
org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl; <BR>import =
org.eclipse.birt.chart.model.impl.ChartWithoutAxesImpl;<BR>import=20
org.eclipse.birt.chart.model.type.PieSeries;<BR>import=20
org.eclipse.birt.chart.model.type.impl.PieSeriesImpl;<BR>import=20
org.eclipse.birt.chart.reportitem.ChartReportItemImpl;<BR>import=20
org.eclipse.birt.core.framework.Platform;<BR>import=20
org.eclipse.birt.report.model.api.CellHandle;<BR>import=20
org.eclipse.birt.report.model.api.DataItemHandle;<BR>import=20
org.eclipse.birt.report.model.api.DesignConfig;<BR>import=20
org.eclipse.birt.report.model.api.DesignElementHandle;<BR>import=20
org.eclipse.birt.report.model.api.ElementFactory;<BR>import=20
org.eclipse.birt.report.model.api.ExtendedItemHandle;<BR>import=20
org.eclipse.birt.report.model.api.GridHandle;<BR>import=20
org.eclipse.birt.report.model.api.IDesignEngine;<BR>import=20
org.eclipse.birt.report.model.api.IDesignEngineFactory;<BR>import=20
org.eclipse.birt.report.model.api.LabelHandle;<BR>import=20
org.eclipse.birt.report.model.api.OdaDataSetHandle;<BR>import=20
org.eclipse.birt.report.model.api.OdaDataSourceHandle;<BR>import=20
org.eclipse.birt.report.model.api.PropertyHandle;<BR>import=20
org.eclipse.birt.report.model.api.ReportDesignHandle;<BR>import=20
org.eclipse.birt.report.model.api.RowHandle;<BR>import=20
org.eclipse.birt.report.model.api.SessionHandle;<BR>import=20
org.eclipse.birt.report.model.api.StructureFactory;<BR>import=20
org.eclipse.birt.report.model.api.StyleHandle;<BR>import=20
org.eclipse.birt.report.model.api.TableHandle;<BR>import=20
=
org.eclipse.birt.report.model.api.activity.SemanticException ; <BR>import=20
org.eclipse.birt.report.model.api.command.ContentException;<BR >import=20
org.eclipse.birt.report.model.api.command.NameException;<BR >import=20
=
org.eclipse.birt.report.model.api.elements.DesignChoiceConst ants; <BR>impo=
rt=20
=
org.eclipse.birt.report.model.api.elements.structures.Comput edColumn; <BR>=
import=20
=
org.eclipse.birt.report.model.api.extension.ExtendedElementE xception; </FO=
NT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>import =
com.ibm.icu.util.ULocale;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>/**<BR> * @author lavanya Aug 3, =
2006<BR> */<BR>public class TestPieChart {<BR> =
private=20
ReportDesignHandle reportDesignHandle =3D null;<BR> =
private=20
ElementFactory elementFactory =3D null;<BR> private=20
OdaDataSourceHandle customerDataSource =3D null;<BR> =
private=20
String dataSourceName =3D "cust-DataSource";<BR> =
private=20
String prodDataSet =3D "cust-DataSet";<BR> private =
String=20
query =3D "select productLine , quantityInStock , buyprice from =
products group=20
by productLine";<BR> <BR> =
ComputedColumn=20
cs1, cs2, cs3 =3D null;<BR> OdaDataSetHandle =
dataSetHandle =3D=20
null;<BR> DesignConfig config =3D null;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> public static void =
main(String[] args) {<BR> =
try=20
=
{<BR> =
new=20
=
TestPieChart().buildReport();<BR> &nbs=
p; }=20
catch (IOException e)=20
=
{<BR> =20
e.printStackTrace();<BR> } =
catch=20
(SemanticException e)=20
=
{<BR> =20
e.printStackTrace();<BR> =20
}<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> public void =
buildReport()=20
throws IOException, SemanticException=20
{<BR> =20
init();<BR> =20
createMasterPages();<BR> =20
createDataSources();<BR> =20
createDataSets();<BR> =20
createBody();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> String=20
outputPath =3D=20
"C:/test";//$NON-NLS-1$<BR> =
File=20
outputFolder =3D new=20
File(outputPath);<BR> if=20
(!outputFolder.exists() && !outputFolder.mkdir())=20
=
{<BR> =
throw=20
new IOException("Can not create the output=20
folder");//$NON-NLS-1$<BR> =20
}<BR> if (reportDesignHandle =
!=3D=20
null) =
{<BR> =20
System.out.println("reportDesignHandle is not=20
NULL");<BR> =20
}<BR> System.out.println("B4 =
saveAs() method...");<BR> =20
=
reportDesignHandle.saveAs("E:/workspace/BIRT/TEST/TestPieChart.rptdesign "=
);<BR> =20
System.out.println("after saveAs()=20
method...");<BR> =20
System.out.println("Finished");<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> private void =
init()=20
{<BR> config =3D new=20
DesignConfig();<BR> =20
=
config.setProperty("BIRT_HOME",<BR> &n=
bsp; &n bsp; =20
=
"C:/birt-runtime-2_1_0/birt-runtime-2_1_0/ReportEngine");<BR > =
=20
IDesignEngine engine =3D =
null;<BR> try=20
=
{<BR> =20
=
Platform.startup(config);<BR> &n=
bsp; =20
IDesignEngineFactory factory =3D (IDesignEngineFactory)=20
=
Platform<BR> &=
nbsp; & nbsp; =20
=
..createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ ENGINE_FACTORY=
);<BR> =
if (config =3D=3D null)=20
=
{<BR> &n=
bsp; =20
System.out.println("CONFIG IS=20
=
NULL");<BR> &n=
bsp;=20
=
}<BR> =
if=20
(factory =3D=3D null)=20
=
{<BR> &n=
bsp; =20
System.out.println("factory is =20
=
NULL");<BR> &n=
bsp;=20
=
}<BR> =
engine=20
=3D=20
=
factory.createDesignEngine(config);<BR> &nbs=
p; =20
SessionHandle sessionHandle =3D=20
=
engine<BR> &nb=
sp; &nb sp; =20
=
..newSessionHandle(ULocale.ENGLISH);<BR> &nbs=
p; =20
reportDesignHandle =3D=20
=
sessionHandle.createDesign();<BR> &nbs=
p; =20
elementFactory =3D=20
=
reportDesignHandle.getElementFactory();<BR> =
=20
} catch (Exception ex)=20
=
{<BR> =20
ex.printStackTrace();<BR> =20
}<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> private void=20
createMasterPages() throws ContentException, NameException=20
{<BR> DesignElementHandle=20
simpleMasterPage =3D=20
=
elementFactory<BR> &=
nbsp; =20
.newSimpleMasterPage("Master=20
Page");<BR> =20
=
reportDesignHandle.getMasterPages().add(simpleMasterPage);<BR >  =
; =20
}</FO
|
|
|
Goto Forum:
Current Time: Sat Aug 24 03:56:34 GMT 2024
Powered by FUDForum. Page generated in 0.03933 seconds
|