Jump to content
JasperReports Library 7.0 is now available ×

How convert Pie3D to HTML5 Pie


Recommended Posts

Can somebody convert Pie chart to HTML5 one? How can you convert this type of chart if there are more than 1 series in pie?


i.e. I have Pie3D


<chart theme="aegean">

    <reportElement x="583" y="97" width="350" height="180" uuid="57f9d143-e18d-4f2d-a001-e4b09f76da72"/>



















    <itemLabel color="#000000" backgroundColor="#FFFFFF"/>






How convert if to HTML5 Pie, if this type of chart has only 1 Mesure?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

There is no direct way of feeding two values per record into a single series in HTML5 charts.  You can contact the Jaspersoft commercial support and file a feature request (or bug if you consider it so).

Depending on your exact use case, there might be some workarounds.

For instance, if you only need to feed two values (that is a single record) into the chart, you can create a subdataset and pass a data source with two records to it.  That is something like:

<subDataset name="ChartDataset">

<field name="key"/>

<field name="value" class="java.lang.Integer"/>


<hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="Pie">



<datasetRun subDataset="ChartDataset">

<dataSourceExpression>new net.sf.jasperreports.engine.data.JRMapCollectionDataSource([[key: "a", value: 5], [key: "b", value: 10]])</dataSourceExpression>




<dataAxis axis="Rows">

<axisLevel name="Key">


<axisLevelBucket class="java.lang.String">





<multiAxisMeasure name="Measure" class="java.lang.Integer" calculation="Nothing">





Note that the example uses Groovy expressions for the sake of list and map literals.
If you need to feed several records into a single chart, something similar can be achieved by collecting the value into a list.  That would be more tedious though.
Lucian Chirita
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...