Jump to content
We've recently updated our Privacy Statement, available here ×

Jasper Report: Pie chart without dataLabels


detlef.brendle
Go to solution Solved by lucianc,

Recommended Posts

Hi,

I would like to render a highcharts pie chart without dataLabels.

By checking the highcharts docu, there is a parameter called "plotOptions.pie.dataLabels.enabled". But set this value to false does not hide the dataLabels.

My jrxml file looks like this:

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="pie-test" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="f8eee606-dcf6-402d-a6c7-0a3af300e599">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="local proanalytics"/>    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>    <queryString>        <![CDATA[select sum(anzahl) as views, medium_id as mediumid from materializedviews.ccpush_overall_views            where h3_id=1000858  GROUP BY medium_id order by medium_id desc]]>    </queryString>    <field name="views" class="java.math.BigDecimal"/>    <field name="mediumid" class="java.lang.Long"/>    <background>        <band splitType="Stretch"/>    </background>    <pageHeader>        <band height="433">            <componentElement>                <reportElement x="70" y="50" width="400" height="284" uuid="d1403cc6-6670-4422-b32c-03c1079022a8"/>                <hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="Pie">                    <hc:chartSetting name="default">                        <hc:chartProperty name="plotOptions.pie.dataLabels.enabled" value="false"/>                    </hc:chartSetting>                    <multiAxisData>                        <multiAxisDataset/>                        <dataAxis axis="Rows">                            <axisLevel name="Level1">                                <labelExpression><![CDATA["Level Label expression"]]></labelExpression>                                <axisLevelBucket order="None" class="java.lang.Comparable">                                    <bucketExpression><![CDATA[$F{mediumid}]]></bucketExpression>                                </axisLevelBucket>                            </axisLevel>                        </dataAxis>                        <dataAxis axis="Columns"/>                        <multiAxisMeasure name="Measure1" class="java.lang.Number" calculation="Nothing">                            <labelExpression><![CDATA["!MEASURE LABEL!"]]></labelExpression>                            <valueExpression><![CDATA[$F{views}]]></valueExpression>                        </multiAxisMeasure>                    </multiAxisData>                    <hc:series name="Measure1"/>                </hc:chart>            </componentElement>        </band>    </pageHeader></jasperReport>[/code]

Has somebody found a way of doing this ?

 

Thanks,

Detlef

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

Boolean chart property values should be provided as expressions.  Values set using the static attribute are passed as strings (and probably converted to booleans using JavaScript rules).

                        <hc:chartProperty name="plotOptions.pie.dataLabels.enabled">                            <hc:propertyExpression>false</hc:propertyExpression>                        </hc:chartProperty>[/code]

Regards,

Lucian

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...