setting gantt chart axis scale
hi, i have a gantt chart with a datetime axis along the bottom. When I set the origin to MIN, it always has the origin 1 time unit earlier than the minimum data point. This means I always have a blank day at the start, which i can't have.
I've tinkered with setting axis scales:
function afterDataSetFilled( series, dataSet, icsc )
{
chart=icsc.getChartInstance();
xAxis = chart.getBaseAxes()[0];
yAxis = chart.getOrthogonalAxes( xAxis, true )[0];
xAxis1=chart.getOrthogonalAxes(xAxis,true)[0];
xScale=xAxis1.getScale();
v=DateTimeDataElementImpl.Create("3/3/2000");
xScale.setMin(v);
}
but I get errors about DateTimeDataElementImpl not being defined. This all seems so difficult, please help!
thanks
dave
I've tinkered with setting axis scales:
function afterDataSetFilled( series, dataSet, icsc )
{
chart=icsc.getChartInstance();
xAxis = chart.getBaseAxes()[0];
yAxis = chart.getOrthogonalAxes( xAxis, true )[0];
xAxis1=chart.getOrthogonalAxes(xAxis,true)[0];
xScale=xAxis1.getScale();
v=DateTimeDataElementImpl.Create("3/3/2000");
xScale.setMin(v);
}
but I get errors about DateTimeDataElementImpl not being defined. This all seems so difficult, please help!
thanks
dave
0
Comments
-
ok to simplify the problem, can any show some code to set the axis origin of a chart datetime axis to the value of a report parameter?
thanks!0 -
Dave,
Try something like this:
function beforeGeneration( chart, icsc )
{
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage( Packages.org.eclipse.birt.chart.util);
xAxis = chart.getBaseAxes()[0];
yAxis = chart.getOrthogonalAxes( xAxis, true )[0];
xScale=xAxis.getScale();
xScale.setMin(DateTimeDataElementImpl.create(new CDateTime(2000,3,3,0,0)));
}Warning No formatter is installed for the format ipb0 -
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="100105" data-time="1336492032" data-date="08 May 2012 - 08:47 AM"><p>
Can you set up a simple example that shows your issue using the Classic Models, sample database and attach it in here for me to look at and test on? Thanks!<br /></p></blockquote>
I uploaded an example report here:<br />
<a class='bbc_url' href='http://www.birt-exchange.org/org/devshare/designing-birt-reports/1509-gantt-chart-auto-axis-scale-example/'>http://www.birt-exchange.org/org/devshare/designing-birt-reports/1509-gantt-chart-auto-axis-scale-example/</a>0 -
Try adding this code to your chart script:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage( Packages.org.eclipse.birt.chart.model.type.impl );
importPackage( Packages.org.eclipse.birt.chart.util);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
function afterDataSetFilled(series, dataSet, icsc)
{
ps = PluginSettings.instance( );
dsp = ps.getDataSetProcessor( series.getClass() );
//find min date
if (series.getSeriesIdentifier() == "Series 1"){
mmin = dsp.getMinimum( dataSet );
mmax = dsp.getMaximum( dataSet );
}
}
function beforeGeneration( chart, icsc )
{
var yAxis = chart.getAxes().get(0).getAssociatedAxes().get(0);
var yScale = yAxis.getScale();
yScale.setMin(DateTimeDataElementImpl.create(mmin));
yScale.setMax(DateTimeDataElementImpl.create(mmax));
yAxis.setScale(yScale);
}
</pre>Warning No formatter is installed for the format ipb0 -
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="100181" data-time="1336600659" data-date="09 May 2012 - 02:57 PM"><p>
Try adding this code to your chart script:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage( Packages.org.eclipse.birt.chart.model.type.impl );
importPackage( Packages.org.eclipse.birt.chart.util);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
function afterDataSetFilled(series, dataSet, icsc)
{
ps = PluginSettings.instance( );
dsp = ps.getDataSetProcessor( series.getClass() );
//find min date
if (series.getSeriesIdentifier() == "Series 1"){
mmin = dsp.getMinimum( dataSet );
mmax = dsp.getMaximum( dataSet );
}
}
function beforeGeneration( chart, icsc )
{
var yAxis = chart.getAxes().get(0).getAssociatedAxes().get(0);
var yScale = yAxis.getScale();
yScale.setMin(DateTimeDataElementImpl.create(mmin));
yScale.setMax(DateTimeDataElementImpl.create(mmax));
yAxis.setScale(yScale);
}
</pre></p></blockquote>
That works like a charm.<br />
Thank you very much!0 -
Hello,<br />
<br />
How is the value "mmin" defined for both functions? The value "mmin" is not known by my beforeGeneration function.<br />
<br />
How can I define it as a global value for both functions in the script?<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="100181" data-time="1336600659" data-date="09 May 2012 - 02:57 PM"><p>
Try adding this code to your chart script:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage( Packages.org.eclipse.birt.chart.model.type.impl );
importPackage( Packages.org.eclipse.birt.chart.util);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
function afterDataSetFilled(series, dataSet, icsc)
{
ps = PluginSettings.instance( );
dsp = ps.getDataSetProcessor( series.getClass() );
//find min date
if (series.getSeriesIdentifier() == "Series 1"){
mmin = dsp.getMinimum( dataSet );
mmax = dsp.getMaximum( dataSet );
}
}
function beforeGeneration( chart, icsc )
{
var yAxis = chart.getAxes().get(0).getAssociatedAxes().get(0);
var yScale = yAxis.getScale();
yScale.setMin(DateTimeDataElementImpl.create(mmin));
yScale.setMax(DateTimeDataElementImpl.create(mmax));
yAxis.setScale(yScale);
}
</pre></p></blockquote>Warning No formatter is installed for the format ipb0 -
It should work, as is, as long as your series is named "Series 1", which is the default. If you've change the series name, mmin will not get set, because the check for it being called "Series 1" will not be satisfied, and you'll get an error.Warning No formatter is installed for the format ipb0
-
Hello ,
I am trying to create same time of graph with custom columns on x axis trying to set date min and max and on y axis workitem count.markerLine.setValue(DateTimeDataElementImpl.create(new Date(y,m,d)));
this line of code gives me below error.
Cannot convert Invalid Date to java.lang.Long at line 34 of chart script: '
Can you please suggest what is wrong, I tried using CDateTime method too.and imported all packages also.
0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 107 General Questions
- 144 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 119 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management