andrqxa Posted February 18, 2016 Share Posted February 18, 2016 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 <pie3DChart> <chart theme="aegean"> <reportElement x="583" y="97" width="350" height="180" uuid="57f9d143-e18d-4f2d-a001-e4b09f76da72"/> <chartTitle/> <chartSubtitle/> <chartLegend/> </chart> <pieDataset> <pieSeries> <keyExpression><![CDATA["XX"]]></keyExpression> <valueExpression><![CDATA[$F{Call_TotalXX}]]></valueExpression> <labelExpression><![CDATA[$F{CallPCentXX}.toString()+"%"]]></labelExpression> </pieSeries> <pieSeries> <keyExpression><![CDATA["YY"]]></keyExpression> <valueExpression><![CDATA[$F{Call_TotalYY}]]></valueExpression> <labelExpression><![CDATA[$F{CallPCentYY}.toString()+"%"]]></labelExpression> </pieSeries> </pieDataset> <pie3DPlot> <plot/> <itemLabel color="#000000" backgroundColor="#FFFFFF"/> </pie3DPlot> How convert if to HTML5 Pie, if this type of chart has only 1 Mesure? Link to comment Share on other sites More sharing options...
lucianc Posted February 18, 2016 Share Posted February 18, 2016 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"/></subDataset> <hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="Pie">...<multiAxisData><multiAxisDataset><dataset><datasetRun subDataset="ChartDataset"><dataSourceExpression>new net.sf.jasperreports.engine.data.JRMapCollectionDataSource([[key: "a", value: 5], [key: "b", value: 10]])</dataSourceExpression></datasetRun></dataset></multiAxisDataset><dataAxis axis="Rows"><axisLevel name="Key"><labelExpression><![CDATA["Key"]]></labelExpression><axisLevelBucket class="java.lang.String"><bucketExpression><![CDATA[$F{key}]]></bucketExpression></axisLevelBucket></axisLevel></dataAxis><multiAxisMeasure name="Measure" class="java.lang.Integer" calculation="Nothing"><labelExpression><![CDATA["Measure"]]></labelExpression><valueExpression><![CDATA[$F{value}]]></valueExpression></multiAxisMeasure></multiAxisData> 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. Regards,Lucian Chirita Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now