How to set up burst filling in an area chart via the BIRT Chart API?

I'm trying to create a gradient fill for a series on an area chart that I create via the BIRT Chart API, but the BIRT Integration and Extension book and Interwebs seem curiously silent on how to make it work. Whatever I do, I always seem to getting a flat color from the default palette. I've tried using SeriesDefinition.getSeriesPalette (). Update (Gradient) and even create my own gradient fill palette and set it to SeriesDefinition, to no avail. I also noticed that if I don't shift () on the palette, even if it is offset (0), which the Javadocs statement will do nothing, I get a NullPointerException when trying to create a chart:

Caused by: java.lang.NullPointerException
at org.eclipse.birt.chart.render.Area.renderDataPoints(Area.java:521)
at org.eclipse.birt.chart.render.Line.renderSeries(Line.java:570)
at org.eclipse.birt.chart.render.AxesRenderer.renderPlot(AxesRenderer.java:2181)
at org.eclipse.birt.chart.render.AxesRenderer.render(AxesRenderer.java:314)
at org.eclipse.birt.chart.factory.Generator.render(Generator.java:1368)
... 108 more

      

Here is the last (non-working) code I tried:

Gradient gradient = FillUtil.createDefaultGradient(BirtReportBuilder.COLOR_WHITE);
gradient.setStartColor(ColorDefinitionImpl.WHITE());
gradient.setEndColor(ColorDefinitionImpl.create(76, 116, 131));
gradient.setDirection(90);
SeriesDefinition sdY = SeriesDefinitionImpl.create();
sdY.getQuery().setDefinition("\"Quantity\"");
Palette pal = PaletteImpl.create(gradient);
pal.shift(0);
sdY.setSeriesPalette(pal);
sdY.getSeries().add(as1);
yAxisPrimary.getSeriesDefinitions().add(sdY);

      

So what's the magic spell to get the BIRT API to use my Gradient as the fill area?

0


source to share


1 answer


This code works for me, I get ugly color series ...

sdY.getSeriesPalette().update(GradientImpl.create(ColorDefinitionImpl.create(255,255,255), ColorDefinitionImpl.create(200,0,0,150), 90, false));

      



Hope this helps you; p

+1


source







All Articles