Hi Everyone,
Please look the following link, Which shown a Highchart with a vertical line is plotted on X axis.
We are trying to do the same (adding vertical line in a line chart) in a JRXML based chart. I have added the following a property to show the vertical line as mentioned in the above link,
<hc:chartProperty name="xAxis.plotLines.value">
<hc:propertyExpression><![CDATA[$F{PERIOD_END}]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.plotLines.width">
<hc:propertyExpression><![CDATA[2]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.plotLines.color">
<hc:propertyExpression><![CDATA["#FF0000"]]></hc:propertyExpression>
</hc:chartProperty>
Here the "$F{PERIOD_END}" is a Date field only.
But, When I add this property into the jrxml, the report was not worked. The entire JRXML file content as follows,
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1 -->
<!-- 2017-02-10T15:05:34 -->
<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="CumulativeElementPerformance_LockheedAeronautics" pageWidth="1040" pageHeight="600" whenNoDataType="AllSectionsNoDetail" columnWidth="1000" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true" whenResourceMissingType="Empty" uuid="ece8adba-64f5-439d-b3f8-a0050ef02f4b">
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.jasperreports.highcharts.function.properties.allowed" value="true"/>
<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"/>
<parameter name="PROJECT_NAME" class="java.lang.String"/>
<parameter name="CATEGORIES" class="java.lang.String"/>
<parameter name="ELEMENTS" class="java.lang.String"/>
<queryString language="SQL">
<![CDATA[SELECT
PERIOD_END "PERIOD_END",
PV_CUM_TTL_COST "BCWS",
EV_CUM_TTL_COST "BCWP",
AC_CUM_TTL_COST "ACWP",
ETC_STD_TTL_COST "ETC",
EAC_STD_TTL_COST "LRE",
ETC_STD_TTL_COST "ETC_AFTER_TIMENOW"
FROM
AV_EV_SUMMARY
WHERE
PROJ_ID = $P{PROJECT_NAME} AND
TYPE = (SELECT TYPE FROM AV_CATEGORY WHERE CATEGORY = $P{CATEGORIES}) AND
ELEMENT = $P{ELEMENTS} AND
TRIM(CSACT) IS NULL
ORDER BY
PERIOD_END]]>
</queryString>
<field name="PERIOD_END" class="java.util.Date"/>
<field name="BCWS" class="java.lang.Double"/>
<field name="BCWP" class="java.lang.Double"/>
<field name="ACWP" class="java.lang.Double"/>
<field name="ETC" class="java.lang.Double"/>
<field name="LRE" class="java.lang.Double"/>
<field name="ETC_AFTER_TIMENOW" class="java.lang.Double"/>
<pageHeader>
<band height="50">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="1000" height="30" forecolor="#315F85" uuid="4f649a45-77cc-4b1d-b2c9-3d2f25cfd086"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="18" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Cumulative Element Performance"]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<summary>
<band height="500" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="1000" height="500" uuid="064ccd5e-96f5-4033-977c-774111663ffc">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="TimeSeriesSpline">
<hc:chartSetting name="default">
<hc:chartProperty name="chart.plotBorderColor">
<hc:propertyExpression><![CDATA["#F0FFF0"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="chart.plotBorderWidth">
<hc:propertyExpression><![CDATA[new Integer(1)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="chart.plotShadow">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="chart.shadow">
<hc:propertyExpression><![CDATA[Boolean.FALSE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="chart.showAxes">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="chart.zoomType">
<hc:propertyExpression><![CDATA["xy"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="colors">
<hc:propertyExpression><![CDATA[java.util.Arrays.asList("#D070D0","#D0A020","#F08080","#A47D7C","#20B0A0","#708890","#FFA070","#0000E0","#A0B0E0","#80D0F0")]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.enabled">
<hc:propertyExpression><![CDATA[false]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.align">
<hc:propertyExpression><![CDATA["center"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.backgroundColor">
<hc:propertyExpression><![CDATA[new java.awt.Color(-1)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.borderColor">
<hc:propertyExpression><![CDATA["#708890"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.borderRadius">
<hc:propertyExpression><![CDATA[new Integer(5)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.borderWidth">
<hc:propertyExpression><![CDATA[0.5]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.enabled">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.floating">
<hc:propertyExpression><![CDATA[Boolean.FALSE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.itemHoverStyle.color">
<hc:propertyExpression><![CDATA["#FF0000"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.itemMarginBottom">
<hc:propertyExpression><![CDATA[new Integer(5)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.itemMarginTop">
<hc:propertyExpression><![CDATA[new Integer(5)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.layout">
<hc:propertyExpression><![CDATA["horizontal"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.lineHeight">
<hc:propertyExpression><![CDATA[new Integer(20)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.margin">
<hc:propertyExpression><![CDATA[new Integer(15)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.padding">
<hc:propertyExpression><![CDATA[new Integer(8)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.rtl">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.verticalAlign">
<hc:propertyExpression><![CDATA["bottom"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="legend.y">
<hc:propertyExpression><![CDATA[new Integer(0)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.allowPointSelect">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.lineWidth">
<hc:propertyExpression><![CDATA[new Integer(1)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.marker.states.hover.radiusPlus">
<hc:propertyExpression><![CDATA[new Integer(2)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.selected">
<hc:propertyExpression><![CDATA[Boolean.FALSE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.shadow">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.states.hover.enabled">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.states.hover.lineWidth">
<hc:propertyExpression><![CDATA[new Integer(5)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="title.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.shared">
<hc:propertyExpression><![CDATA[Boolean.FALSE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.useHTML">
<hc:propertyExpression><![CDATA[Boolean.FALSE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.labels.rotation">
<hc:propertyExpression><![CDATA[new Integer(270)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.labels.step">
<hc:propertyExpression><![CDATA[new Integer(1)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.opposite" value="true"/>
<hc:chartProperty name="xAxis.plotLines.value">
<hc:propertyExpression><![CDATA[$F{PERIOD_END}]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.plotLines.width">
<hc:propertyExpression><![CDATA[2]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.plotLines.color">
<hc:propertyExpression><![CDATA["#FF0000"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="yAxis.alternateGridColor">
<hc:propertyExpression><![CDATA["#F0F7FF"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="yAxis.gridLineColor">
<hc:propertyExpression><![CDATA["#708090"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="yAxis.gridLineDashStyle">
<hc:propertyExpression><![CDATA["longdash"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="yAxis.min">
<hc:propertyExpression><![CDATA[new Integer(0)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="yAxis.title.text">
<hc:propertyExpression><![CDATA["Dollars in Millions"]]></hc:propertyExpression>
</hc:chartProperty>
</hc:chartSetting>
<multiAxisData>
<multiAxisDataset/>
<dataAxis axis="Rows">
<axisLevel name="Level1">
<labelExpression><![CDATA["Level Label expression"]]></labelExpression>
<axisLevelBucket class="java.util.Date">
<bucketExpression><![CDATA[$F{PERIOD_END}]]></bucketExpression>
</axisLevelBucket>
</axisLevel>
</dataAxis>
<dataAxis axis="Columns"/>
<multiAxisMeasure name="Measure1" class="java.lang.Double" calculation="Nothing">
<labelExpression><![CDATA["BCWS"]]></labelExpression>
<valueExpression><![CDATA[$F{BCWS}]]></valueExpression>
</multiAxisMeasure>
<multiAxisMeasure name="Measure2" class="java.lang.Double" calculation="Nothing">
<labelExpression><![CDATA["BCWP"]]></labelExpression>
<valueExpression><![CDATA[$F{BCWP}]]></valueExpression>
</multiAxisMeasure>
<multiAxisMeasure name="Measure3" class="java.lang.Double" calculation="Nothing">
<labelExpression><![CDATA["ACWP"]]></labelExpression>
<valueExpression><![CDATA[$F{ACWP}]]></valueExpression>
</multiAxisMeasure>
<multiAxisMeasure name="Measure4" class="java.lang.Double" calculation="Nothing">
<labelExpression><![CDATA["ETC"]]></labelExpression>
<valueExpression><![CDATA[$F{ETC}]]></valueExpression>
</multiAxisMeasure>
<multiAxisMeasure name="Measure5" class="java.lang.Double" calculation="Nothing">
<labelExpression><![CDATA["LRE"]]></labelExpression>
<valueExpression><![CDATA[$F{LRE}]]></valueExpression>
</multiAxisMeasure>
</multiAxisData>
<hc:series name="Measure1"/>
<hc:series name="Measure2"/>
<hc:series name="Measure3"/>
<hc:series name="Measure4"/>
<hc:series name="Measure5"/>
</hc:chart>
</componentElement>
</band>
</summary>
</jasperReport>
0 Answers:
No answers yet
Hi All Experts,
Does anyone know the answer to the above question? I know this post is long due, but I am also in the midst of doing the same requirement to my XY Line Chart, i.e. to display vertical line based on certain value in csv dataset.
Appreciate if anyone can help on this.
Thank you.