An Oracle blog about BI Publisher

  • RTF
    August 25, 2008

Line Charts

Hot chart of the week this week is line charts - not just your single line oh no. Folks want multiple lines!
Its not that tough and with the new Template Builder for Word ( out its even easier - you should not have to dabble in the chart XML. For those of you on earlier versions of Publisher, you can use the latest builder. Just dont build any crosstabs with the crosstab interface. they will not work in your reports unless you have on the server side. As an aside we now have multiple measure support for the crosstabs!
If I assume I have the following data:

With the new Chart builder you can add the multiple measures to the line chart ...


... to get the desired result ...


For the hard core souls among you, here's the XML behind the multi line chart

<Graph graphType="LINE_VERT_ABS"><LegendArea visible="true" />
<LocalGridData colCount="{count(xdoxslt:group(.//SALE, 'YEAR'))}" rowCount="3">
<xsl:for-each-group select=".//SALE" group-by="YEAR" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:value-of select="current-group()/YEAR" />
<xsl:for-each-group select=".//SALE" group-by="YEAR" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:value-of select="sum(current-group()/SOFTWARE)" />
<xsl:for-each-group select=".//SALE" group-by="YEAR" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:value-of select="sum(current-group()/HARDWARE)" />
<xsl:for-each-group select=".//SALE" group-by="YEAR" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:value-of select="sum(current-group()/SERVICES)" />

Notice the multiple RowData entries, one for each line.

If you wanted to get even more fancy you can add marker shapes to the data points on your lines. We are not quite there with the chart builder interface yet but this is pretty simple, just add the following to your chart XML.
<Graph  markerDisplayed="true" >
<Series id="0" markerShape="MS_SQUARE"/>
<Series id="1" markerShape="MS_CIRCLE"/>

marker options are :

Some of you will find the following attribute for the Graph element 'markerShapeInLegend="true"'. This should do what it 'says on the tin!'

Sadly in earlier versions of te charting library there is a bug preventing this - seems to affect Applications flavors the most. There is a bug for this and we are looking at getting a new chart library patch out.

Join the discussion

Comments ( 2 )
  • guest Wednesday, December 21, 2011

    Your sample is of great help and easy to be understood. :)

    Please I just want to ask if is it possible to pass values from parameter or values from variable in the RTF to the graph an put it inside the <Cell></Cell> tag?

    sort of <Cell> (get variable or parameter) </Cell>

    Your help will greatly be appreciated?

  • Tim Wednesday, December 21, 2011

    As long as the parameter/variable is declared globally (use the @start command) Your chart code can then access it.

    I believe there is now a sample report that does this in 11g


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.