Wednesday 25 October 2017

Tip : Pie chart tittle in middle of chart in Jasper reports high charts




<hc:chartProperty name="title.text" value="Chart Title in Center"/>
<hc:chartProperty name="title.verticalAlign" value="middle"/>
<hc:chartProperty name="title.floating_customSimpleMode" value="true"/>
<hc:chartProperty name="title.floating">






JRXML : Supports in 6.4 or later Pro

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1  -->
<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="Task_25_Oct_2017" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="62bf9297-750d-475a-94b8-bfd486dc5f00">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="foodmart"/>
<property name="ireport.jasperserver.url" value="http://localhost:8080/jasperserver-pro/"/>
<property name="ireport.jasperserver.user" value="superuser"/>
<property name="ireport.jasperserver.report.resource" value="/EarthlySystems/Task_25_Oct_2017_files/main_jrxml"/>
<property name="ireport.jasperserver.reportUnit" value="/EarthlySystems/Task_25_Oct_2017"/>
<subDataset name="Dataset1_Donut" uuid="b8746b75-d0d2-4837-9d6e-bf909eee2911">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="foodmart"/>
<queryString language="SQL">
<![CDATA[(SELECT 'Slice1' AS category, 15 AS value FROM customer limit 1)
UNION ALL
(SELECT 'Slice2' AS category,75 AS Value FROM customer limit 1)]]>
</queryString>
<field name="category" class="java.lang.String"/>
<field name="value" class="java.lang.Integer"/>
</subDataset>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
<title>
<band height="320" splitType="Stretch">
<componentElement>
<reportElement x="60" y="0" width="400" height="320" uuid="9c464bcb-b23c-47d8-9b02-b0413f44c203">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<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="title.text" value="Chart Title in Center"/>
<hc:chartProperty name="credits.enabled" value="false"/>
<hc:chartProperty name="credits.href" value=""/>
<hc:chartProperty name="credits.text" value=""/>
<hc:chartProperty name="yAxis.title.text" value=""/>
<hc:chartProperty name="chart.zoomType" value="xy"/>
<hc:chartProperty name="plotOptions.pie.showInLegend" value="false"/>
<hc:chartProperty name="legend.enabled_customSimpleMode" value="true"/>
<hc:chartProperty name="legend.enabled">
<hc:propertyExpression><![CDATA[false]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.pie.dataLabels.enabled">
<hc:propertyExpression><![CDATA[false]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.pie.innerSize" value="90%"/>
<hc:chartProperty name="plotOptions.pie.dataLabels.padding" value="0"/>
<hc:chartProperty name="title.verticalAlign" value="middle"/>
<hc:chartProperty name="title.floating_customSimpleMode" value="true"/>
<hc:chartProperty name="title.floating">
<hc:propertyExpression><![CDATA[true]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="title.style.fontSize" value="14px"/>
<hc:chartProperty name="title.style.color" value="#C8CACF"/>
</hc:chartSetting>
<multiAxisData>
<multiAxisDataset>
<dataset>
<datasetRun subDataset="Dataset1_Donut" uuid="50243b95-3f10-43db-8d71-f23638e513b4"/>
</dataset>
</multiAxisDataset>
<dataAxis axis="Rows">
<axisLevel name="Level1">
<labelExpression><![CDATA["Level Label expression"]]></labelExpression>
<axisLevelBucket class="java.lang.String">
<bucketExpression><![CDATA[$F{category}]]></bucketExpression>
</axisLevelBucket>
</axisLevel>
</dataAxis>
<dataAxis axis="Columns"/>
<multiAxisMeasure name="Measure1" class="java.lang.Number" calculation="Nothing">
<labelExpression><![CDATA["Category:"]]></labelExpression>
<valueExpression><![CDATA[$F{value}]]></valueExpression>
</multiAxisMeasure>
</multiAxisData>
<hc:series name="Measure1"/>
</hc:chart>
</componentElement>
</band>
</title>
</jasperReport>

No comments:

Post a Comment