Jump to content
Changes to the Jaspersoft community edition download ×

Problem defining the xaxis title for a line report


SmokeJag

Recommended Posts

I've created a line graph report that is speed vs time. The problem is that there are over 237 values returned by the query that get put into the graph, so when it tries to lable the x-axis it can't because there are too many values so it just places a truckload of little black squares. (see the attached pdf example) How can I get it to behave more like the vertical axis where the speed values are given every 25?

 

Thanks,

Nate

 

Here's the jrxml if it helps:

<?xml version="1.0" encoding="UTF-8"?>

<!-- Created using JasperAssistant (http://www.jasperassistant.com) -->

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport name="AssetSpeedvsTimeGraph" pageWidth="612" pageHeight="791" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">

<property name="ireport.scriptlethandling" value="0"/>

<property name="ireport.encoding" value="UTF-8"/>

<property name="com.jasperassistant.designer.Grid" value="true"/>

<property name="com.jasperassistant.designer.SnapToGrid" value="true"/>

<property name="com.jasperassistant.designer.GridWidth" value="5"/>

<property name="com.jasperassistant.designer.GridHeight" value="5"/>

<property name="com.jasperassistant.designer.Margins" value="true"/>

<property name="com.jasperassistant.designer.Rulers" value="true"/>

<property name="com.jasperassistant.designer.SnapToGuides" value="true"/>

<property name="com.jasperassistant.designer.DataSource" value="localhost"/>

<import value="java.util.*"/>

<import value="java.text.SimpleDateFormat"/>

<import value="net.sf.jasperreports.engine.*"/>

<import value="net.sf.jasperreports.engine.data.*"/>

<style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<style name="Arial_Bold" isDefault="false" fontName="Arial" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<style name="Arial_Italic" isDefault="false" fontName="Arial" fontSize="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<parameter name="orgId" class="java.lang.Long">

<parameterDescription><![CDATA[Organization Id]]></parameterDescription>

<defaultValueExpression><![CDATA[new Long(1)]]></defaultValueExpression>

</parameter>

<parameter name="username" class="java.lang.String">

<parameterDescription><![CDATA[username (email)]]></parameterDescription>

<defaultValueExpression><![CDATA["rhunter@trackmyworld.com"]]></defaultValueExpression>

</parameter>

<parameter name="startDate" class="java.util.Date">

<parameterDescription><![CDATA[The start date]]></parameterDescription>

<defaultValueExpression><![CDATA[new Date("03/09/2007")]]></defaultValueExpression>

</parameter>

<parameter name="endDate" class="java.util.Date">

<parameterDescription><![CDATA[The end date]]></parameterDescription>

<defaultValueExpression><![CDATA[new Date("03/11/2007")]]></defaultValueExpression>

</parameter>

<queryString>

<![CDATA[select asset.asset_id,

asset.asset_description as description,

asset.asset_name,

org.organization_name,

assetGroup.asset_group_name,

assetGroup.asset_group_description,

device.device_id,

device.device_name,

MM.make_model_make,

MM.make_model_model,

gps.gps_location_speed,

gps.gps_location_direction,

gps.gps_location_events_ts,

MMEvent.make_model_event_type_description

from cerberus.asset asset,

cerberus.device device left join

cerberus.gps_location gps on device.device_id = gps.gps_location_device_id,

cerberus.asset_device_current_association associate,

cerberus.asset_group assetGroup, cerberus.asset_group_assets AGXRef, cerberus.make_model MM,

cerberus.organization org,

cerberus.event event,

cerberus.make_model_event_type MMEvent

where asset.asset_id = associate.asset_device_current_association_asset_id and

device.device_id = associate.asset_device_current_association_device_id and

asset.asset_id = AGXRef.asset_group_assets_asset_id and

assetGroup.asset_group_id = AGXRef.asset_group_assets_asset_group_id and

device.device_make_model_id=MM.make_model_id and

date_trunc('day', gps.gps_location_events_ts) > $P{startDate} and

date_trunc('day', gps.gps_location_events_ts) < $P{endDate} and

org.organization_id = asset.asset_organization_id and

event.event_gps_location_id = gps.gps_location_id and

MMEvent.make_model_event_type_id = event.event_make_model_event_type_id

order by org.organization_id, asset.asset_name, gps.gps_location_events_ts

;]]>

</queryString>

<field name="asset_group_description" class="java.lang.String"/>

<field name="asset_group_name" class="java.lang.String"/>

<field name="asset_id" class="java.lang.Long"/>

<field name="asset_name" class="java.lang.String"/>

<field name="description" class="java.lang.String"/>

<field name="device_id" class="java.lang.Long"/>

<field name="device_name" class="java.lang.String"/>

<field name="gps_location_direction" class="java.lang.Double"/>

<field name="gps_location_events_ts" class="java.sql.Timestamp"/>

<field name="gps_location_speed" class="java.lang.Float"/>

<field name="make_model_event_type_description" class="java.lang.String"/>

<field name="make_model_make" class="java.lang.String"/>

<field name="make_model_model" class="java.lang.String"/>

<field name="organization_name" class="java.lang.String"/>

<variable name="Asset" class="java.lang.Integer" calculation="Count">

<variableExpression><![CDATA[boolean.TRUE]]></variableExpression>

</variable>

<variable name="uniqueAssets" class="java.lang.Long" calculation="DistinctCount">

<variableExpression><![CDATA[$F{asset_id}]]></variableExpression>

</variable>

<group name="Asset">

<groupExpression><![CDATA[$F{asset_name}]]></groupExpression>

<groupHeader>

<band height="230">

<staticText>

<reportElement mode="Opaque" x="0" y="0" width="100" height="16" backcolor="#B962B3"/>

<box border="Thin" topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="0"/>

<textElement textAlignment="Left" verticalAlignment="Middle"/>

<text><![CDATA[Asset]]></text>

</staticText>

<staticText>

<reportElement mode="Opaque" x="100" y="0" width="215" height="16" backcolor="#82CFFD"/>

<box border="Thin" topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="0"/>

<textElement textAlignment="Left" verticalAlignment="Middle"/>

<text><![CDATA[Description]]></text>

</staticText>

<staticText>

<reportElement mode="Opaque" x="314" y="0" width="171" height="16" backcolor="#82CFFD"/>

<box border="Thin" topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="0"/>

<textElement textAlignment="Left" verticalAlignment="Middle"/>

<text><![CDATA[Asset Group]]></text>

</staticText>

<staticText>

<reportElement mode="Opaque" x="484" y="0" width="88" height="16" backcolor="#82CFFD"/>

<box border="Thin" topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="0"/>

<textElement textAlignment="Left" verticalAlignment="Middle"/>

<text><![CDATA[Asset Id]]></text>

</staticText>

<textField evaluationTime="Auto" bookmarkLevel="1">

<reportElement style="Arial_Bold" mode="Opaque" x="484" y="16" width="88" height="16" backcolor="#FFFFFF"/>

<box border="1Point" topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="0"/>

<textElement verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String"><![CDATA[$F{asset_id}.toString()]]></textFieldExpression>

<anchorNameExpression><![CDATA[string.valueOf($F{organization_name})]]></anchorNameExpression>

</textField>

<textField evaluationTime="Auto" bookmarkLevel="1">

<reportElement style="Arial_Bold" mode="Opaque" x="314" y="16" width="171" height="16" backcolor="#FFFFFF"/>

<box border="Thin" topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="0"/>

<textElement verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String"><![CDATA[$F{asset_group_name}]]></textFieldExpression>

<anchorNameExpression><![CDATA[string.valueOf($F{organization_name})]]></anchorNameExpression>

</textField>

<textField evaluationTime="Auto" bookmarkLevel="1">

<reportElement style="Arial_Bold" mode="Opaque" x="100" y="16" width="215" height="16" backcolor="#FFFFFF"/>

<box border="Thin" topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="0"/>

<textElement verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String"><![CDATA[$F{description}]]></textFieldExpression>

<anchorNameExpression><![CDATA[string.valueOf($F{organization_name})]]></anchorNameExpression>

</textField>

<textField evaluationTime="Auto" bookmarkLevel="1">

<reportElement style="Arial_Bold" mode="Opaque" x="0" y="16" width="100" height="16" backcolor="#FFFFFF"/>

<box border="Thin" topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="0"/>

<textElement verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String"><![CDATA[$F{asset_name}]]></textFieldExpression>

<anchorNameExpression><![CDATA[string.valueOf($F{organization_name})]]></anchorNameExpression>

</textField>

<lineChart>

<chart isShowLegend="false" evaluationTime="Group" evaluationGroup="Asset">

<reportElement mode="Opaque" x="0" y="35" width="572" height="195" isPrintWhenDetailOverflows="true"/>

<chartTitle/>

<chartSubtitle color="#000000">

<subtitleExpression><![CDATA[$F{asset_name} + " Speed"]]></subtitleExpression>

</chartSubtitle>

</chart>

<categoryDataset>

<dataset resetType="Group" resetGroup="Asset" incrementType="Group" incrementGroup="ts"/>

<categorySeries>

<seriesExpression><![CDATA["Hello"]]></seriesExpression>

<categoryExpression><![CDATA[$F{gps_location_events_ts}]]></categoryExpression>

<valueExpression><![CDATA[$F{gps_location_speed}]]></valueExpression>

<labelExpression><![CDATA["Pig"]]></labelExpression>

</categorySeries>

</categoryDataset>

<linePlot isShowShapes="false">

<plot backcolor="#FFFFFF"/>

<categoryAxisLabelExpression><![CDATA["Time Frame"]]></categoryAxisLabelExpression>

<valueAxisLabelExpression><![CDATA["Speed"]]></valueAxisLabelExpression>

</linePlot>

</lineChart>

</band>

</groupHeader>

</group>

<group name="ts">

<groupExpression><![CDATA[$F{gps_location_events_ts}]]></groupExpression>

</group>

<title>

<band height="67">

<line>

<reportElement key="line" x="0" y="0" width="572" height="1" forecolor="#000000"/>

<graphicElement pen="1Point"/>

</line>

<staticText>

<reportElement x="0" y="0" width="572" height="25"/>

<textElement textAlignment="Center" verticalAlignment="Middle">

<font size="20"/>

</textElement>

<text><![CDATA[Asset Speed vs. Time]]></text>

</staticText>

<line>

<reportElement key="line" positionType="FixRelativeToBottom" x="0" y="39" width="572" height="1" forecolor="#000000"/>

<graphicElement pen="1Point"/>

</line>

<textField>

<reportElement style="Arial_Bold" mode="Opaque" x="0" y="52" width="572" height="15" forecolor="#FFFFFF" backcolor="#000000"/>

<textElement textAlignment="Center" verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String"><![CDATA["Time Frame: " + new SimpleDateFormat("MM/dd/yy").format($P{startDate}) + " - " + new SimpleDateFormat("MM/dd/yy").format($P{endDate})]]></textFieldExpression>

</textField>

</band>

</title>

<pageHeader>

<band height="15">

<printWhenExpression><![CDATA[new Boolean($V{PAGE_NUMBER}.intValue() > 1)]]></printWhenExpression>

<textField>

<reportElement style="Arial_Bold" mode="Opaque" x="0" y="0" width="572" height="15" forecolor="#FFFFFF" backcolor="#000000"/>

<textElement textAlignment="Center" verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String"><![CDATA["Time Frame: " + new SimpleDateFormat("MM/dd/yy").format($P{startDate}) + " - " + new SimpleDateFormat("MM/dd/yy").format($P{endDate})]]></textFieldExpression>

</textField>

</band>

</pageHeader>

<pageFooter>

<band height="20">

<line>

<reportElement x="0" y="0" width="572" height="1"/>

<graphicElement/>

</line>

<textField>

<reportElement x="200" y="0" width="80" height="15"/>

<textElement textAlignment="Right"/>

<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>

</textField>

<textField evaluationTime="Report">

<reportElement x="280" y="0" width="75" height="15"/>

<textElement/>

<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>

</textField>

</band>

</pageFooter>

<lastPageFooter>

<band height="40">

<textField bookmarkLevel="1">

<reportElement style="Arial_Bold" x="0" y="0" width="286" height="15"/>

<textElement textAlignment="Left" verticalAlignment="Middle"/>

<textFieldExpression class="java.lang.String"><![CDATA["Total Assets: " + String.valueOf($V{uniqueAssets})]]></textFieldExpression>

<anchorNameExpression><![CDATA["Summary"]]></anchorNameExpression>

</textField>

<line>

<reportElement x="0" y="19" width="572" height="1"/>

<graphicElement/>

</line>

<textField>

<reportElement x="250" y="20" width="69" height="15"/>

<textElement textAlignment="Right"/>

<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>

</textField>

<textField pattern="M/d/yy h:mm:ss a">

<reportElement x="427" y="20" width="145" height="15"/>

<textElement textAlignment="Right" verticalAlignment="Middle"/>

<textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>

</textField>

<textField>

<reportElement style="Arial_Normal" x="0" y="20" width="200" height="15"/>

<textElement verticalAlignment="Middle">

<font isItalic="true"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$P{username}]]></textFieldExpression>

</textField>

</band>

</lastPageFooter>

</jasperReport> [file name=asset_speed_direction_graph.pdf size=19123]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/asset_speed_direction_graph.pdf[/file]

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...