Wednesday 14 June 2017

High Charts (HTML-5) Horizontal Bar Chart (Column Chart) advanced properties in jasper reports

Horizontal Bar Chart advanced properties

plotOptions.series.dataLabels.align = right
plotOptions.series.dataLabels.color=white
series.dataLabels.enabled=true
series.dataLabels.format={point.y:.1f}%
tooltip.valueDecimals=new Integer(2)
tooltip.valueSuffix=%



Sample output

Sample JRXML (Supported version : 6.2 Pro or later)
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  -->
<!-- 2017-06-14T01:55:03 -->
<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="Bar Chart" pageWidth="1000" pageHeight="842" columnWidth="960" leftMargin="20" rightMargin="20" topMargin="50" bottomMargin="20" uuid="9078ded8-657e-41b9-8a90-552bcd773149">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="sumtotal_anjan"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="ireport.jasperserver.url" value="http://localhost:8081/jasperserver-pro/"/>
<property name="ireport.jasperserver.user" value="superuser"/>
<property name="ireport.jasperserver.report.resource" value="/Work/Bar_Chart_for_blog_files/main_jrxml"/>
<property name="ireport.jasperserver.reportUnit" value="/Work/Bar_Chart_for_blog"/>
<queryString>
<![CDATA[SELECT productDescription, buyprice FROM classicmodels.products limit 10]]>
</queryString>
<field name="productDescription" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="buyprice" class="java.math.BigDecimal">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="542">
<componentElement>
<reportElement x="0" y="0" width="960" height="542" uuid="40b3d848-171b-4e69-97f5-4f1d8868a7c3"/>
<hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="Bar">
<hc:chartSetting name="default">
<hc:chartProperty name="chart.zoomType">
<hc:propertyExpression><![CDATA["xy"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="colors">
<hc:propertyExpression><![CDATA[java.util.Arrays.asList("#FF0000","#434348","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#2b908f","#f45b5b","#91e8e1")]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.enabled">
<hc:propertyExpression><![CDATA[false]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.href">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.dataLabels.align" value="right"/>
<hc:chartProperty name="plotOptions.series.dataLabels.color" value="#FFFFFF"/>
<hc:chartProperty name="series.dataLabels.enabled" value="true"/>
<hc:chartProperty name="series.dataLabels.format" value="{point.y:.1f}%"/>
<hc:chartProperty name="title.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.useHTML">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.valueDecimals">
<hc:propertyExpression><![CDATA[new Integer(2)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.valuePrefix">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.valueSuffix">
<hc:propertyExpression><![CDATA["%"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.scrollbar.enabled" value="true"/>
<hc:chartProperty name="yAxis.title.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
</hc:chartSetting>
<multiAxisData>
<multiAxisDataset/>
<dataAxis axis="Rows">
<axisLevel name="Level1">
<labelExpression><![CDATA["Level Label expression"]]></labelExpression>
<axisLevelBucket class="java.lang.String">
<bucketExpression><![CDATA[$F{productDescription}]]></bucketExpression>
</axisLevelBucket>
</axisLevel>
</dataAxis>
<dataAxis axis="Columns"/>
<multiAxisMeasure name="Measure1" class="java.lang.Double" calculation="Nothing">
<labelExpression><![CDATA["Description"]]></labelExpression>
<valueExpression><![CDATA[$F{buyprice}]]></valueExpression>
</multiAxisMeasure>
</multiAxisData>
<hc:series name="Measure1"/>
</hc:chart>
</componentElement>
</band>
</summary>
</jasperReport>

No comments:

Post a Comment