Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Chart colors override script
Migrateduser
Hi, I've been working lately on styling reports and i've ran in the wall with overriding original palette. Here is the deal, I want my charts to use color1 to color2 gradient. I was succesful using script I've found here for doing such thing:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
piecnt = 0;
startColor = null;
endColor = null;
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );
function afterDataSetFilled(series, dataSet, icsc)
{
importPackage( Packages.java.io );
importPackage( Packages.org.eclipse.birt.chart.model.type.impl );
if( series.getClass() == PieSeriesImpl ){
if( series.getSeriesIdentifier() == "Total distribution by customer [linemon not included]" ){
var list = dataSet.getValues();
piecnt = list.length;
}
}
startColor = ColorDefinitionImpl.WHITE();
endColor = ColorDefinitionImpl.BLUE();
//startColor = ColorDefinitionImpl.GREY();
//endColor = ColorDefinitionImpl.BLACK();
}
function buildPalette( sliceNumber )
{
var sr = startColor.getRed();
var sg = startColor.getGreen();
var sb = startColor.getBlue();
var er = endColor.getRed();
var eg = endColor.getGreen();
var eb = endColor.getBlue();
var nr = ((er-sr)/piecnt)*sliceNumber + sr;
var ng = ((eg-sg)/piecnt)*sliceNumber + sg;
var nb = ((eb-sb)/piecnt)*sliceNumber + sb;
var nc = ColorDefinitionImpl.create( nr, ng, nb );
return nc;
}
function beforeGeneration( chart, icsc )
{
sd = chart.getSeriesDefinitions( ).get( 0 );
sd.getSeriesPalette( ).getEntries( ).clear( );
for ( i = 1; i <= piecnt; i++ )
{
sd.getSeriesPalette().getEntries().add( buildPalette(i) );
}
}
</pre>
<br />
And my question is: Is it possible to do same thing for bar and stack bar charts? I am curently use BIRT4.2 on tomcat6.
Find more posts tagged with
Comments
There are no comments yet