Jasper Report: Pie chart without dataLabels

0

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>

Has somebody found a way of doing this ?

Thanks,

Detlef

detlef.brendle's picture
Joined: Sep 5 2015 - 12:27pm
Last seen: 1 year 2 months ago

1 Answer:

1

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>

Regards,

Lucian

lucianc's picture
7347
Joined: Jul 17 2006 - 1:10am
Last seen: 1 month 3 weeks ago
Feedback