Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Get Dataset value to fill Y-serie
Get Dataset value to fill Y-serie [message #726073] Fri, 16 September 2011 10:00 Go to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
Hello,

I try to fill Y-series of a Gantt chart using datasource and dataset placed in a report design programmatically.

I created a report design programmatically, placing datasource and dataset extracted from an xml file.

EngineConfig reportConfig = new EngineConfig( );
DesignConfig designConfig = new DesignConfig( );

IDesignEngineFactory iDesignEngineFactory = (IDesignEngineFactory) Platform.createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);
					
IDesignEngine designEngine = iDesignEngineFactory.createDesignEngine(designConfig);
SessionHandle session = designEngine.newSessionHandle(ULocale.FRENCH);
ReportDesignHandle designHandle = session.createDesign();
ElementFactory elementFactory = designHandle.getElementFactory();
DesignElementHandle elementHandle = elementFactory.newSimpleMasterPage("Page Master");
		
try {
  designHandle.getMasterPages().add(elementHandle);
} catch (ContentException e) {
  e.printStackTrace();
} catch (NameException e) {
  e.printStackTrace();
}
		
DesignElementHandle datasource=designHandle.getDataSources().get(0);
		
OdaDataSourceHandle dataSourceHandle = elementFactory.newOdaDataSource("DataSource", "org.eclipse.birt.report.data.oda.xml");
try {
  dataSourceHandle.setProperty("FILELIST", "myxml.xml");
  dataSourceHandle.setProperty("SCHEMAFILELIST","myxsd.xsd");
  dataSourceHandle.setProperty("ENCODINGLIST","UTF-8");
} catch (SemanticException e1) {
  e1.printStackTrace();
}
try {
  designHandle.getDataSources( ).add(dataSourceHandle);
} catch (ContentException e) {
  e.printStackTrace();
} catch (NameException e) {
  e.printStackTrace();
}
		
OdaDataSetHandle datasetHandle = elementFactory.newOdaDataSet( "DataSet","org.eclipse.birt.report.data.oda.xml.dataSet" );
try {
  datasetHandle.setDataSource( "DataSource" );
} catch (SemanticException e) {
  e.printStackTrace();
}
		
try {
  datasetHandle.setQueryText("table0#-TNAME-#table0#:#[/Reservation]#:#{startDate;DATE;/@startDate},{endDate;DATE;/@endDate},{name;STRING;/owns/@name},{firstname;STRING;/owns/@firstname}#:#");
} catch (SemanticException e) {
  e.printStackTrace();
}

try {
  designHandle.getDataSets().add(datasetHandle );
} catch (ContentException e) {
  e.printStackTrace();
} catch (NameException e) {
  e.printStackTrace();
}



Then, I have a chart created programmatically.
I would like to get dataset data to add them in the chart series as dataset.

// Y-Series
GanttSeries yserie = (GanttSeries) GanttSeriesImpl.create();
yserie.setDataSet(????);

SeriesDefinition sdY = SeriesDefinitionImpl.create();
sdY.getSeriesPalette( ).shift(0);		
yAxisPrimary.getSeriesDefinitions( ).add(sdY);		
sdY.getSeries().add(yserie);


I would like to fill a GanttSerie like this but using data placed in the xml file:
GanttDataSet phase1 = GanttDataSetImpl.create( new GanttEntry[]{
  new GanttEntry( new CDateTime( 2009, 1, 1), new CDateTime( 2009, 1,15),"Name" )
} );



How can I retrieve data ? do you know a tutorial that explains this ?

Thanks in advance,

Val

[Updated on: Fri, 16 September 2011 10:02]

Report message to a moderator

Re: Get Dataset value to fill Y-serie [message #726139 is a reply to message #726073] Fri, 16 September 2011 12:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Here is a simple example that builds a report containing a dataset and a
chart. Note that you have to create binding columns on the chart report
item.

import java.io.IOException;

import org.eclipse.birt.chart.model.Chart;
import org.eclipse.birt.chart.model.ChartWithAxes;
import org.eclipse.birt.chart.model.attribute.AxisType;
import org.eclipse.birt.chart.model.attribute.IntersectionType;
import org.eclipse.birt.chart.model.attribute.LegendItemType;
import org.eclipse.birt.chart.model.attribute.Palette;
import org.eclipse.birt.chart.model.attribute.TickStyle;
import org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionImpl;
import org.eclipse.birt.chart.model.attribute.impl.PaletteImpl;
import org.eclipse.birt.chart.model.component.Axis;
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.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.ChartWithAxesImpl;
import org.eclipse.birt.chart.model.layout.Legend;
import org.eclipse.birt.chart.model.layout.Plot;
import org.eclipse.birt.chart.model.type.LineSeries;
import org.eclipse.birt.chart.model.type.impl.LineSeriesImpl;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.ElementFactory;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
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.SessionHandle;
import org.eclipse.birt.report.model.api.SimpleMasterPageHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
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.structures.PropertyBinding;

import com.ibm.icu.util.ULocale;


public class SimpleChart

{

private ReportDesignHandle reportDesignHandle = null;

private ElementFactory elementFactory = null;

private OdaDataSourceHandle odaDataSourceHandle = null;

private String dataSourceName = "datasource";

private String dataSetName = "maindataset";
private SessionHandle sessionHandle =null;

org.eclipse.birt.report.model.api.elements.structures.ComputedColumn
cs1, cs2 = null;

public static void main(String args[])

{
try {

new SimpleChart().createReport();

} catch (Exception e) {

e.printStackTrace();

}

}


public void createReport() throws SemanticException, IOException

{
System.out.println("Start");
init();

createMasterPages();

buildDataSource();
buildDataSet();
createBody();


reportDesignHandle.saveAs("output/desample/simplechart.rptdesign");
reportDesignHandle.close( );
Platform.shutdown();
System.out.println("Finished");

}


private void init(){


DesignConfig config = new DesignConfig( );

config.setBIRTHome("C:/birt/birt-runtime-2_6_1/birt-runtime-2_6_1/ReportEngine");
IDesignEngine engine = null;

try {

Platform.startup(config);

IDesignEngineFactory factory = (IDesignEngineFactory) Platform


..createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);

engine = factory.createDesignEngine(config);

} catch (Exception ex) {

ex.printStackTrace();

}


// we need a handle of session of design engine

sessionHandle = engine.newSessionHandle(ULocale.ENGLISH);
reportDesignHandle = sessionHandle.createDesign();
elementFactory = reportDesignHandle.getElementFactory();

}


private void createMasterPages() throws ContentException, NameException

{

SimpleMasterPageHandle simpleMasterPage =
elementFactory.newSimpleMasterPage("Master Page");

reportDesignHandle.getMasterPages().add(simpleMasterPage);

}

void buildDataSource( ) throws SemanticException
{

OdaDataSourceHandle dsHandle = elementFactory.newOdaDataSource(
"Data Source", "org.eclipse.birt.report.data.oda.jdbc" );
dsHandle.setProperty( "odaDriverClass",
"org.eclipse.birt.report.data.oda.sampledb.Driver" );
dsHandle.setProperty( "odaURL", "jdbc:classicmodels:sampledb" );
dsHandle.setProperty( "odaUser", "ClassicModels" );
dsHandle.setProperty( "odaPassword", "" );

PropertyBinding pb = new PropertyBinding();

reportDesignHandle.getDataSources( ).add( dsHandle );

}

void buildDataSet( ) throws SemanticException
{

OdaDataSetHandle dsHandle = elementFactory.newOdaDataSet( dataSetName,
"org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" );
dsHandle.setDataSource( "Data Source" );
String qry = "Select PRODUCTCODE, QUANTITYORDERED from orderdetails
where ordernumber = 10104";

dsHandle.setQueryText( qry );
reportDesignHandle.getDataSets( ).add( dsHandle );

PropertyHandle handle = dsHandle.getPropertyHandle(
DataSetHandle.RESULT_SET_PROP );

}

private void createBody() throws SemanticException

{
ExtendedItemHandle extendedItemHandle =
elementFactory.newExtendedItem("Simple Chart", "Chart");
extendedItemHandle.setWidth("700px");
extendedItemHandle.setHeight("500px");

extendedItemHandle.setProperty(ExtendedItemHandle.DATA_SET_PROP,
dataSetName);
extendedItemHandle.setProperty("outputFormat","PNG");



Chart c = createChart();

extendedItemHandle.getReportItem().setProperty(
"chart.instance", c );

reportDesignHandle.getBody().add(extendedItemHandle);


//PropertyHandle computedSet = extendedItemHandle.getColumnBindings( );
//computedSet.clearValue();

cs1 = StructureFactory.createComputedColumn( );
cs1.setName( "PRODUCTCODE" );
cs1.setExpression( "dataSetRow[\"PRODUCTCODE\"]");
cs1.setDataType( "string" );
cs1.setAggregateOn(null);


cs2 = StructureFactory.createComputedColumn( );
cs2.setName( "QUANTITYORDERED" );
cs2.setExpression( "dataSetRow[\"QUANTITYORDERED\"]");
cs2.setDataType( "integer" );

extendedItemHandle.addColumnBinding(cs1, true);
extendedItemHandle.addColumnBinding(cs2, true);


}

private Chart createChart() {

ChartWithAxes cwaLine = ChartWithAxesImpl.create();
cwaLine.setType( "Line Chart" ); //$NON-NLS-1$
cwaLine.setSubType( "Overlay" ); //$NON-NLS-1$
cwaLine.getBlock().getBounds().setWidth(600);
cwaLine.getBlock().getBounds().setHeight(400);


// Plot
cwaLine.getBlock().setBackground( ColorDefinitionImpl.WHITE() );
Plot p = cwaLine.getPlot();
p.getClientArea().setBackground( ColorDefinitionImpl.create(
255, 255,
225 ) );

// Title
cwaLine.getTitle().getLabel().getCaption().setValue("Overlay
test Line Chart" );
cwaLine.getTitle().setVisible(true);

// Legend
cwaLine.getLegend().setVisible( true );
Legend lg = cwaLine.getLegend();
lg.setItemType(LegendItemType.CATEGORIES_LITERAL);

// X-Axis
Axis xAxisPrimary = cwaLine.getPrimaryBaseAxes()[0];
xAxisPrimary.setType( AxisType.TEXT_LITERAL );
xAxisPrimary.getMajorGrid().setTickStyle(
TickStyle.BELOW_LITERAL );
xAxisPrimary.getOrigin().setType( IntersectionType.MIN_LITERAL );

// Y-Axis
Axis yAxisPrimary = cwaLine.getPrimaryOrthogonalAxis(
xAxisPrimary );
yAxisPrimary.setType(AxisType.LINEAR_LITERAL);
yAxisPrimary.getMajorGrid().setTickStyle(
TickStyle.RIGHT_LITERAL );
yAxisPrimary.getLabel().getCaption().setValue("TEST");
yAxisPrimary.getLabel().setVisible(true);

SampleData sd = DataFactory.eINSTANCE.createSampleData( );
BaseSampleData sdBase = DataFactory.eINSTANCE.createBaseSampleData( );
sdBase.setDataSetRepresentation( "Category-A, Category-B" );//$NON-NLS-1$
sd.getBaseSampleData( ).add( sdBase );


OrthogonalSampleData sdOrthogonal =
DataFactory.eINSTANCE.createOrthogonalSampleData( );
sdOrthogonal.setDataSetRepresentation( "4,12" );//$NON-NLS-1$
sdOrthogonal.setSeriesDefinitionIndex( 0 );
sd.getOrthogonalSampleData( ).add( sdOrthogonal );

cwaLine.setSampleData( sd );

// X-Series



Series seCategory = SeriesImpl.create( );
// seCategory.setDataSet( categoryValues );

// Set category expression.
seCategory.getDataDefinition( )
.add( QueryImpl.create( "row[\"PRODUCTCODE\"]" ) );

SeriesDefinition sdX = SeriesDefinitionImpl.create( );
Palette palx = PaletteImpl.create(10, false);
//sdY.getSeriesPalette( ).shift(1);
sdX.setSeriesPalette(palx);


//sdX.getSeriesPalette( ).shift( 1 );
//sdX.setSorting(SortOption.ASCENDING_LITERAL);
// Set default grouping.
//SeriesGrouping grouping = sdX.getGrouping( );
//grouping.getAggregateExpression();
//grouping.setEnabled( false );
//grouping.setGroupType( DataType.TEXT_LITERAL );
//grouping.setGroupingUnit( GroupingUnitType.STRING_PREFIX_LITERAL );
//grouping.setGroupingInterval( 1 );
//grouping.setAggregateExpression( "Sum" ); // Set Count aggregation.
//$NON-NLS-1$

xAxisPrimary.getSeriesDefinitions( ).add( sdX );
sdX.getSeries( ).add( seCategory );
// Y-Series
LineSeries bs1 = (LineSeries) LineSeriesImpl.create( );

bs1.getDataDefinition( ).add( QueryImpl.create(
"row[\"QUANTITYORDERED\"]" ) );
bs1.getLabel( ).setVisible( true );


SeriesDefinition sdY = SeriesDefinitionImpl.create( );
//Palette pal = PaletteImpl.create(10, false);
//sdY.getSeriesPalette( ).shift(1);
//sdY.setSeriesPalette(pal);

sdY.getGrouping().setEnabled(false);
yAxisPrimary.getSeriesDefinitions( ).add( sdY );

sdY.getSeries( ).add( bs1 );


return cwaLine;
}
}

Jason


On 9/16/2011 10:00 AM, val.dupin wrote:
> Hello,
>
> I try to fill Y-series of a Gantt chart using datasource and dataset
> placed in a report design programmatically.
>
> I created a report design programmatically, placing datasource and
> dataset extracted from an xml file.
>
> EngineConfig reportConfig = new EngineConfig( );
> DesignConfig designConfig = new DesignConfig( );
>
> IDesignEngineFactory iDesignEngineFactory = (IDesignEngineFactory)
> Platform.createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);
>
>
> IDesignEngine designEngine =
> iDesignEngineFactory.createDesignEngine(designConfig);
> SessionHandle session = designEngine.newSessionHandle(ULocale.FRENCH);
> ReportDesignHandle designHandle = session.createDesign();
> ElementFactory elementFactory = designHandle.getElementFactory();
> DesignElementHandle elementHandle =
> elementFactory.newSimpleMasterPage("Page Master");
>
> try {
> designHandle.getMasterPages().add(elementHandle);
> } catch (ContentException e) {
> e.printStackTrace();
> } catch (NameException e) {
> e.printStackTrace();
> }
>
> DesignElementHandle datasource=designHandle.getDataSources().get(0);
>
> OdaDataSourceHandle dataSourceHandle =
> elementFactory.newOdaDataSource("DataSource",
> "org.eclipse.birt.report.data.oda.xml");
> try {
> dataSourceHandle.setProperty("FILELIST", "myxml.xml");
> dataSourceHandle.setProperty("SCHEMAFILELIST","myxsd.xsd");
> dataSourceHandle.setProperty("ENCODINGLIST","UTF-8");
> } catch (SemanticException e1) {
> e1.printStackTrace();
> }
> try {
> designHandle.getDataSources( ).add(dataSourceHandle);
> } catch (ContentException e) {
> e.printStackTrace();
> } catch (NameException e) {
> e.printStackTrace();
> }
>
> OdaDataSetHandle datasetHandle = elementFactory.newOdaDataSet(
> "DataSet","org.eclipse.birt.report.data.oda.xml.dataSet" );
> try {
> datasetHandle.setDataSource( "DataSource" );
> } catch (SemanticException e) {
> e.printStackTrace();
> }
>
> try {
> datasetHandle.setQueryText("table0#-TNAME-#table0#:#[/Reservation]#:#{startDate;DATE;/@startDate},{endDate;DATE;/@endDate},{name;STRING;/owns/@name},{firstname;STRING;/owns/@firstname}#:#");
>
> } catch (SemanticException e) {
> e.printStackTrace();
> }
>
> try {
> designHandle.getDataSets().add(datasetHandle );
> } catch (ContentException e) {
> e.printStackTrace();
> } catch (NameException e) {
> e.printStackTrace();
> }
>
>
> Then, I have a chart created programmatically.
> I would like to get dataset data to add them in the chart series as
> dataset.
>
> // Y-Series
> GanttSeries yserie = (GanttSeries) GanttSeriesImpl.create();
> yserie.setDataSet(????);
>
> SeriesDefinition sdY = SeriesDefinitionImpl.create();
> sdY.getSeriesPalette( ).shift(0);
> yAxisPrimary.getSeriesDefinitions( ).add(sdY);
> sdY.getSeries().add(yserie);
>
> I would like to fill a GanttSerie like this:
> GanttDataSet phase1 = GanttDataSetImpl.create( new GanttEntry[]{
> new GanttEntry( new CDateTime( 2009, 1, 1), new CDateTime( 2009,
> 1,15),"Name" )
> } );
>
>
> How can I retrieve data ? do you know a tutorial that explain this ?
>
> Thanks in advance,
>
> Val
>
>
Re: Get Dataset value to fill Y-serie [message #727167 is a reply to message #726139] Tue, 20 September 2011 10:49 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
Hi Jason,

Thanks a lot. When I try to run my RCP application, I have a problem with the line:
ExtendedItemHandle extendedItemHandle = elementFactory.newExtendedItem("Simple Chart", "Chart");

extendedItemHandle is null.

What is "Chart" ? the class javadoc doesn't help me to understand what is expected !

Is there a plugin to add to my project ?

My report is create dynamically and hasn't element.

Val

Re: Get Dataset value to fill Y-serie [message #727192 is a reply to message #727167] Tue, 20 September 2011 11:05 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Did you add the chart plugins to your project? The "Chart" is the
extension point that implements the chart report item eg
org.eclipse.birt.chart.reportitem_version. You will also need the other
chart plugins.

Jason

On 9/20/2011 10:49 AM, val.dupin wrote:
> Hi Jason,
>
> Thanks a lot. When I try to run my RCP application, I have a problem
> with the line:
> ExtendedItemHandle extendedItemHandle =
> elementFactory.newExtendedItem("Simple Chart", "Chart");
> extendedItemHandle is null.
>
> What is "Chart" ? the class javadoc doesn't help me to understand what
> is expected !
>
> Is there a plugin to add to my project ?
>
> My report is create dynamically and hasn't element.
>
> Val
>
>
Re: Get Dataset value to fill Y-serie [message #728053 is a reply to message #727192] Thu, 22 September 2011 09:10 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
Thanks Jason it's OK, extendedItemHandle is filled !

But, I have another question:
How can I fill a GanttSerie with extracted data (and date) ?

As you advise, I create ComputedColumn for each field I would use to create Gantt series:

ExtendedItemHandle extendedItemHandle =elementFactory_.newExtendedItem("Gantt Chart", "Chart");		
extendedItemHandle.setProperty(ExtendedItemHandle.DATA_SET_PROP, m_datasetName);
extendedItemHandle.setProperty("outputFormat", "SVG");
		
		
ComputedColumn cs1 = StructureFactory.createComputedColumn();
cs1.setName("name");
cs1.setExpression("dataSetRow[\"name\"]");
cs1.setDataType("string");
		
ComputedColumn cs2 = StructureFactory.createComputedColumn();
cs2.setName("firstname");
cs2.setExpression("dataSetRow[\"firstname\"]");
cs2.setDataType("string");
		
ComputedColumn cs3 = StructureFactory.createComputedColumn();
cs3.setName("startDate");
cs3.setExpression("dataSetRow[\"startDate\"]");
cs3.setDataType("date-time");
		
ComputedColumn cs4 = StructureFactory.createComputedColumn();
cs4.setName("endDate");
cs4.setExpression("dataSetRow[\"endDate\"]");
cs4.setDataType("date-time");
		
extendedItemHandle.addColumnBinding(cs1, true);
extendedItemHandle.addColumnBinding(cs2, true);
extendedItemHandle.addColumnBinding(cs3, true);
extendedItemHandle.addColumnBinding(cs4, true);


Then I define a GanttSeries, and I try to fill it with extracted data from "row", like this:

// Y-Series
GanttSeries taskPhase1 = (GanttSeries) GanttSeriesImpl.create();		

taskPhase1.getDataDefinition().add(QueryImpl.create("row[\"startDate\"]"));		
taskPhase1.getDataDefinition().add(QueryImpl.create("row[\"endDate\"]"));
taskPhase1.getDataDefinition().add(QueryImpl.create("row[\"name\"]"));

SeriesDefinition sdY = SeriesDefinitionImpl.create();
sdY.getSeriesPalette( ).shift(0);				
yAxisPrimary.getSeriesDefinitions( ).add(sdY);		
sdY.getSeries().add(taskPhase1); 


My chart is displayed but there is no horizontal bar inside.
I would like to know details about how to fill a GanttSerie with row data and how to convert query to CDateTime.
Could you explain me ?

Thanks in advance.

Val

[Updated on: Thu, 22 September 2011 09:11]

Report message to a moderator

Re: Get Dataset value to fill Y-serie [message #728204 is a reply to message #728053] Thu, 22 September 2011 13:51 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Take a look at this example:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1420-java-example-of-createing-a-report-with-a-gantt-chart/

Jason

On 9/22/2011 9:10 AM, val.dupin wrote:
> Thanks Jason it's OK, extendedItemHandle is fill !
>
> But, I have another question:
> How can I fill a GanttSerie with extracted date ?
>
> As you advise, I create ComputedColumn for each field I would use to
> create Gantt series:
>
> ExtendedItemHandle extendedItemHandle
> =elementFactory_.newExtendedItem("Gantt Chart", "Chart");
> extendedItemHandle.setProperty(ExtendedItemHandle.DATA_SET_PROP,
> m_datasetName);
> extendedItemHandle.setProperty("outputFormat", "SVG");
>
>
> ComputedColumn cs1 = StructureFactory.createComputedColumn();
> cs1.setName("name");
> cs1.setExpression("dataSetRow[\"name\"]");
> cs1.setDataType("string");
>
> ComputedColumn cs2 = StructureFactory.createComputedColumn();
> cs2.setName("firstname");
> cs2.setExpression("dataSetRow[\"firstname\"]");
> cs2.setDataType("string");
>
> ComputedColumn cs3 = StructureFactory.createComputedColumn();
> cs3.setName("startDate");
> cs3.setExpression("dataSetRow[\"startDate\"]");
> cs3.setDataType("date-time");
>
> ComputedColumn cs4 = StructureFactory.createComputedColumn();
> cs4.setName("endDate");
> cs4.setExpression("dataSetRow[\"endDate\"]");
> cs4.setDataType("date-time");
>
> extendedItemHandle.addColumnBinding(cs1, true);
> extendedItemHandle.addColumnBinding(cs2, true);
> extendedItemHandle.addColumnBinding(cs3, true);
> extendedItemHandle.addColumnBinding(cs4, true);
>
> Then I define a GanttSeries, and I try to fill it with extracted data
> from "row", like this:
>
> // Y-Series
> GanttSeries taskPhase1 = (GanttSeries) GanttSeriesImpl.create();
>
> taskPhase1.getDataDefinition().add(QueryImpl.create("row[\"startDate\"]"));
> taskPhase1.getDataDefinition().add(QueryImpl.create("row[\"endDate\"]"));
> taskPhase1.getDataDefinition().add(QueryImpl.create("row[\"name\"]"));
>
> SeriesDefinition sdY = SeriesDefinitionImpl.create();
> sdY.getSeriesPalette( ).shift(0);
> yAxisPrimary.getSeriesDefinitions( ).add(sdY);
> sdY.getSeries().add(taskPhase1);
>
> My chart is displayed but there is no horizontal bar inside.
> I would like to know details about how to fill a GanttSerie with row
> data and how to convert query to CDateTime.
> Could you explain me ?
>
> Thanks in advance.
>
> Val
>
Previous Topic:How to get input from user?
Next Topic:Default Workspace Directory
Goto Forum:
  


Current Time: Fri Aug 22 17:55:42 EDT 2014

Powered by FUDForum. Page generated in 0.01788 seconds