Jump to content
JasperReports Library 7.0 is now available ×

Bar Chart Axis Crosses


mpcalias

Recommended Posts

I am drafting a report which I have in excel and have a question regarding a bar chart and the "axis crosses".

In the database I have a result and a min and a max (this goes from -20 to 30).  When I plot the chart I want the chart to start at the min value rather than 0 - so basically filling the chart from the left hand side.   I've looked at the chart options but can not see anything which gives anything similar in Jasper.

Is this possible? 

download_3_0.png.880c1ec0ab84037978fe3d68019875dc.png

download_3_0.png.54610d41602ebce2ad70fbbbdac4583c.png

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Thanks for your reply - but I am having a problem working out where to put this!( I am new to Jasper :) )  I have created a simple chart (see below) - any help would be appreicated :)  In this case the result is -10 and so the result should go from -20 to -10

download_4_0.png.9af560bf6c7ac5ec5f7ccf9f4855403a.png

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 --><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="88" pageWidth="595" pageHeight="842" columnWidth="555"              leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"              uuid="470229fb-8e0e-41bd-b611-7340eb6a0416">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="ExcelSheet"/>    <queryString><![CDATA[]]</queryString>    <field name="Name" class="java.lang.String"/>    <field name="Result" class="java.math.BigDecimal"/>    <field name="High" class="java.math.BigDecimal"/>    <field name="Low" class="java.math.BigDecimal"/>    <background><band splitType="Stretch"/></background>    <detail>        <band height="318" splitType="Stretch">            <textField>                <reportElement x="140" y="20" width="100" height="30"                               uuid="e4530796-6112-46a3-8794-cee148dc7663">                    <property name="com.jaspersoft.studio.spreadsheet.connectionID"                              value="5d178f2a-78fc-4d0a-b8f9-6e852005e7c0"/>                </reportElement>                <textFieldExpression><![CDATA[$F{Result}]]></textFieldExpression>           </textField>           <textField>               <reportElement x="43" y="20" width="100" height="30"                              uuid="6db7a9ec-c700-4e04-bb7e-6a08dd457046">                   <property name="com.jaspersoft.studio.spreadsheet.connectionID"                             value="3a32933a-e24e-4ea4-ad1f-9aac07178e22"/>               </reportElement>               <textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>           </textField>           <textField>               <reportElement x="240" y="20" width="100" height="30"                              uuid="e36361d0-b428-4725-99fb-3be9ea735ecc">                   <property name="com.jaspersoft.studio.spreadsheet.connectionID"                             value="1a25ea91-6b53-4727-bb70-80e3509ecbe7"/>               </reportElement>               <textFieldExpression><![CDATA[$F{High}]]></textFieldExpression>           </textField>           <textField>               <reportElement x="340" y="20" width="100" height="30"                              uuid="11d4a03f-1a06-46ad-ba06-ee8af1b4a31a">                   <property name="com.jaspersoft.studio.spreadsheet.connectionID"                             value="35997dfe-6e05-4cc0-a138-e73e69ade330"/>               </reportElement>               <textFieldExpression><![CDATA[$F{Low}]]></textFieldExpression>           </textField>           <barChart>               <chart evaluationTime="Report">                   <reportElement x="110" y="80" width="350" height="120"                                  uuid="efa8a585-6b16-4625-8110-74669c4de20c"/>                   <chartTitle/>                   <chartSubtitle/>                   <chartLegend/>               </chart>               <categoryDataset>                   <categorySeries>                       <seriesExpression><![CDATA["SERIES 1"]]></seriesExpression>                       <categoryExpression><![CDATA[$F{Name}]]></categoryExpression>                       <valueExpression><![CDATA[$F{Result}]]></valueExpression>                   </categorySeries>               </categoryDataset>               <barPlot>                   <plot orientation="Horizontal"/>                   <itemLabel/>                   <categoryAxisFormat>                       <axisFormat labelColor="#000000" tickLabelColor="#000000"                                   axisLineColor="#000000"/>                   </categoryAxisFormat>                   <valueAxisFormat>                       <axisFormat labelColor="#000000" tickLabelColor="#000000"                                   axisLineColor="#000000"/>                   </valueAxisFormat>                   <rangeAxisMinValueExpression>                       <![CDATA[$F{Low}]]>                   </rangeAxisMinValueExpression>                   <rangeAxisMaxValueExpression>                       <![CDATA[$F{High}]]>                   </rangeAxisMaxValueExpression>               </barPlot>           </barChart>       </band>   </detail></jasperReport>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...