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>

Thursday 12 October 2017

Tip : configure the "names" of the labels and "percentages"of pie highchart(HTML-5) in jaspersoft studio 6.4 pro.

Hi,

Over a period of time, the product(jaspersoft) has improved by leaps and bounds .Though it had gained developer(s) attention, one may feel ambiguous in finding a particular property in highcharts advanced properties. So far, I found there are no cut corners instead to spend some good amount of time and the article is the outcome of latter.

Today, I have come across the titled task of this post and thought to put in this bank. You will see how to configure the "name(s)" of the label and "percentage(s)"of highcharts(HTML-5) in jaspersoft studio 6.4 pro.

The below property, you need to set in Advanced properties of HTML-5 pie chart and the following images will help you out where exactly you need to configure it.

plotOptions.pie.dataLabels.format = "{point.name} {point.percentage:.0f}%" 


Click on images to get the best sight of content highlighted. 


1) 


2)
3)

 4)

5)

Until the next tip.!

- Sadakar Pochampalli