Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Making dynamic bar chart series stack?
Making dynamic bar chart series stack? [message #1175310] Thu, 07 November 2013 17:19 Go to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
I had a line chart for which I used a script to dynamically create a number of series.

I wanted to convert this chart to a bar chart and additionally make it a stacked bar chart.

The conversion went fine except that I can't get my dynamically added series to stack!
If I add the series via the GUI then no problem. So I'm guessing that there is a simple tweak to my script that will do the trick but so far it has eluded me. My current script is as follows:

function TargetAppliedChart(numThreads) {

cht = reportContext.getDesignHandle().findElement("ThroughputChart2");
mychart = cht.getReportItem().getProperty("chart.instance");

// Get the x axis and the first y axis
xAxis = mychart.getAxes().get(0);
yAxis1 = xAxis.getAssociatedAxes().get(0);



if (params["hasTargetStats"].value) {
for (i=1; i <= numThreads; i++) {
var sdNew = yAxis1.getSeriesDefinitions().get(0).copyInstance();
var ls = sdNew.getSeries().get(0);

var identifier = "Applied Operations";
if (numThreads > 1) {
identifier += " - Apply Thread: " + i;
}
ls.setSeriesIdentifier(identifier);

// Create the query
var qry = QueryImpl.create("if (row['MIRROR_TOTAL_RATE'] != null && row['APPLYTHREAD'] == " + i + ")\n row['MIRROR_TOTAL_RATE'];" );
ls.getDataDefinition().remove(0);
ls.getDataDefinition().add(qry);
shiftValue = i <= 2 ? i-1 : i;
sdNew.getSeriesPalette().shift(shiftValue);
sdNew.getSeries().remove(0);
sdNew.getSeries().add(ls);

//Add the new series definition to the first y axis
yAxis1.getSeriesDefinitions().add(sdNew);
}
// Remove the dummy placeholder series
yAxis1.getSeriesDefinitions().remove(0);
}


return 0;
}

Thanks in advance...
Mike
Re: Making dynamic bar chart series stack? [message #1197182 is a reply to message #1175310] Tue, 19 November 2013 19:58 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Have you tried mySeries.setStacked(true);?

Michael

Developer Evangelist, Silanis
Re: Making dynamic bar chart series stack? [message #1198731 is a reply to message #1197182] Wed, 20 November 2013 13:31 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Yes I tried that but it had no effect.
Re: Making dynamic bar chart series stack? [message #1201354 is a reply to message #1198731] Thu, 21 November 2013 18:00 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Could you attach a simple example showing everything you've done that I can run (sample database or a flat file or something)? Thanks.

Michael

Developer Evangelist, Silanis
Previous Topic:BIRT Viewer Gets Disabled after rendering contents from datasets
Next Topic:Automate report print without manual intervention
Goto Forum:
  


Current Time: Tue Mar 19 03:19:00 GMT 2024

Powered by FUDForum. Page generated in 0.02555 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top