BIRT_retrieving Data (from Data sets) in scripted Chart

Khaled228
edited February 11, 2022 in Analytics #1

Hello everyone,
I'm using BIRT All-in-one Version working on a report where i created a chart using script. I added a chart through Chart-builder( any charts type), and then went to the script button and in the beforeGeneration() i coded the chart and changed it's type to Bar chart

When you open my attached report, you'll see on the Layout a scatter chart, but when you view the report it displays a bar chart which i programmed in the script window.

Here i'm using s scripted data source.

but If you look into the script, you'll see that I've added custom Data per Hand like (A,B,C.....) and numbers like (244,250.....)

Now the question is : How can I a retrieve the data from my Data set ,that i created into the Chart-script. ????

Please see the following picture for better Understanding. Also the example is attached with this post.

Looking forward for some help and thanks in Advance

Khaled

Comments

  • Hi Khaled,

    I don't know of a way to get the Data Set values in beforeGeneration. However, this works:

    function afterDataSetFilled( series, dataSet, icsc )
    {
      importPackage(Packages.java.util);  
      var list = Arrays.toString(series.getDataSet().getValues());
    }
    

    The event triggers for both the X-axis and the Y-axis. Each time it returns an array of data for the Data Set column assigned to the axis.

    Warning No formatter is installed for the format ipb
  • One thing I forgot to mention is that if there are two completely different charts, it is probably easier to create two chart elements and use visibility rules to determine which one to display.

    Warning No formatter is installed for the format ipb