To display data labels above the HTML5 column/bar vizz in jasper design studio add the following advanced properties
PlotOptions > column > dataLabels
crop = false
enabled=true
overflow=justify
To have fixed intervals for y-axis add the below advanced property
yAxis > tickInterval=10
Sample output of column chart
JRXML ( Works in >= 7.9.0 pro only)
<?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 7.9.0.final using JasperReports Library version 6.16.0-48579d909b7943b64690c65c71e07e0b80981928 --> <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="HTML5ColumnGraphAdvancedProperties" pageWidth="800" pageHeight="842" columnWidth="760" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="89be97f5-686b-44fb-94cc-064df05eb383"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="foodmartVeeraTraining"/> <property name="ireport.jasperserver.url" value="http://localhost:8080/jasperserver-pro/"/> <property name="ireport.jasperserver.user" value="superuser"/> <property name="ireport.jasperserver.reportUnit" value="/JasperReports2021/Reports/HTML5ColumnGraphAdvancedProperties"/> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <property name="ireport.jasperserver.report.resource" value="/JasperReports2021/Reports/HTML5ColumnGraphAdvancedProperties_files/main_jrxml"/> <queryString language="SQL"> <![CDATA[select 'Category1' category, 22 barvalues union select 'Category2' , 72 union select 'Category3' , 22 union select 'Category4' , 38 union select 'Category5' , 61 union select 'Category6' , 81 union select 'Category7' , 78 union select 'Category8' , 50]]> </queryString> <field name="category" class="java.lang.String"> <property name="com.jaspersoft.studio.field.name" value="category"/> <property name="com.jaspersoft.studio.field.label" value="category"/> </field> <field name="barvalues" class="java.lang.Integer"> <property name="com.jaspersoft.studio.field.name" value="barvalues"/> <property name="com.jaspersoft.studio.field.label" value="barvalues"/> </field> <sortField name="category"/> <background> <band splitType="Stretch"/> </background> <summary> <band height="425" splitType="Stretch"> <componentElement> <reportElement x="0" y="78" width="760" height="347" uuid="b68859b7-bfb6-44bd-b385-e4770743827a"/> <hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="Column"> <hc:chartSetting name="default"> <hc:chartProperty name="title.text" value=""/> <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="colors_customSimpleMode" value="true"/> <hc:chartProperty name="colors"> <hc:propertyExpression><![CDATA[Arrays.asList("#019CDE","#434348","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#2b908f","#f45b5b","#91e8e1")]]></hc:propertyExpression> </hc:chartProperty> <hc:chartProperty name="plotOptions.column.dataLabels.enabled_customSimpleMode" value="true"/> <hc:chartProperty name="plotOptions.column.dataLabels.enabled"> <hc:propertyExpression><![CDATA[true]]></hc:propertyExpression> </hc:chartProperty> <hc:chartProperty name="yAxis.tickInterval_customSimpleMode" value="true"/> <hc:chartProperty name="yAxis.tickInterval"> <hc:propertyExpression><![CDATA[10]]></hc:propertyExpression> </hc:chartProperty> <hc:chartProperty name="plotOptions.column.dataLabels.crop_customSimpleMode" value="true"/> <hc:chartProperty name="plotOptions.column.dataLabels.crop"> <hc:propertyExpression><![CDATA[false]]></hc:propertyExpression> </hc:chartProperty> <hc:chartProperty name="plotOptions.column.dataLabels.overflow" value="none"/> <hc:chartProperty name="legend.enabled_customSimpleMode" value="true"/> <hc:chartProperty name="legend.enabled"> <hc:propertyExpression><![CDATA[false]]></hc:propertyExpression> </hc:chartProperty> </hc:chartSetting> <multiAxisData> <multiAxisDataset> <dataset resetType="Report"/> </multiAxisDataset> <dataAxis axis="Rows"> <axisLevel name="Level1"> <labelExpression><![CDATA["Level Label expression"]]></labelExpression> <axisLevelBucket order="None" class="java.lang.Comparable"> <bucketExpression><![CDATA[$F{category}]]></bucketExpression> </axisLevelBucket> </axisLevel> </dataAxis> <dataAxis axis="Columns"/> <multiAxisMeasure name="Measure1" class="java.lang.Number" calculation="Nothing"> <labelExpression><![CDATA["Percentage"]]></labelExpression> <valueExpression><![CDATA[$F{barvalues}]]></valueExpression> </multiAxisMeasure> </multiAxisData> <hc:series name="Measure1"/> </hc:chart> </componentElement> <textField> <reportElement mode="Opaque" x="0" y="0" width="760" height="70" forecolor="#FFFFFF" backcolor="#0071C0" uuid="57041ecf-98e9-44f9-a817-17eba3daf5cc"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="16" isBold="true"/> </textElement> <textFieldExpression><![CDATA["HTML5 Column Graph Advanced Properties in Jaspersoft Design Studio"]]></textFieldExpression> </textField> </band> </summary> </jasperReport>
I hope you found this helpful.
For Jaspersoft or QA Automation video tutorials refer this page.
No comments:
Post a Comment