Jump to content

Problem with chart label..


vattembhaskar

Recommended Posts

Hi to all, while i am generating BAR chart the category axis lables are not in well form i.e they are not directly under the series ...slightly thay are beside to them...plz resolve this,how can i get label as correctly under the figure...

Thanx in advance,

Vijay..

Code:
<?xml version="1.0" encoding="UTF-8"  ?><!-- Created with iReport - A designer for JasperReports --><!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport		 name="BarChartsSubReport"		 columnCount="1"		 printOrder="Vertical"		 orientation="Portrait"		 pageWidth="595"		 pageHeight="842"		 columnWidth="535"		 columnSpacing="0"		 leftMargin="30"		 rightMargin="30"		 topMargin="20"		 bottomMargin="20"		 whenNoDataType="NoPages"		 isTitleNewPage="false"		 isSummaryNewPage="false">	<property name="ireport.scriptlethandling" value="0" />	<property name="ireport.encoding" value="UTF-8" />	<import value="java.util.*" />	<import value="net.sf.jasperreports.engine.*" />	<import value="net.sf.jasperreports.engine.data.*" />	<field name="accountsOpened" class="java.lang.Long">		<fieldDescription><![CDATA[accountsOpened]]></fieldDescription>	</field>	<field name="month" class="java.lang.String">		<fieldDescription><![CDATA[month]]></fieldDescription>	</field>		<background>			<band height="0"  isSplitAllowed="true" >			</band>		</background>		<title>			<band height="0"  isSplitAllowed="true" >			</band>		</title>		<pageHeader>			<band height="0"  isSplitAllowed="true" >			</band>		</pageHeader>		<columnHeader>			<band height="0"  isSplitAllowed="true" >			</band>		</columnHeader>		<detail>			<band height="0"  isSplitAllowed="true" >			</band>		</detail>		<columnFooter>			<band height="0"  isSplitAllowed="true" >			</band>		</columnFooter>		<pageFooter>			<band height="0"  isSplitAllowed="true" >			</band>		</pageFooter>		<summary>			<band height="411"  isSplitAllowed="true" >				<barChart>					<chart  hyperlinkTarget="Self" >					<reportElement						x="0"						y="97"						width="535"						height="253"						key="element-1"						positionType="Float"/>					<box></box>						<chartLegend textColor="#000000" backgroundColor="#FFFFFF" >					</chartLegend>					</chart>					<categoryDataset>						<dataset >						</dataset>						<categorySeries>							<seriesExpression><![CDATA[$F{month}]]></seriesExpression>							<categoryExpression><![CDATA[$F{month}]]></categoryExpression>							<valueExpression><![CDATA[$F{accountsOpened}]]></valueExpression>				<itemHyperlink >				</itemHyperlink>						</categorySeries>					</categoryDataset>					<barPlot isShowTickMarks="false" >						<plot labelRotation="100.0" />						<categoryAxisFormat>							<axisFormat tickLabelColor="#009999" >							</axisFormat>						</categoryAxisFormat>						<valueAxisFormat>							<axisFormat >							</axisFormat>						</valueAxisFormat>					</barPlot>				</barChart>				<staticText>					<reportElement						x="0"						y="50"						width="358"						height="30"						key="staticText-1"/>					<box></box>					<textElement>						<font pdfFontName="Helvetica-Bold" size="14" isBold="true" isUnderline="true"/>					</textElement>				<text><![CDATA[bar Charts:]]></text>				</staticText>			</band>		</summary></jasperReport>
Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

It depends on various factors. For example, the width of your chart and the number of labels in your category axis, 1 or 10. Also, i see a category axis label rotation as 100.  Change it to 0 to see if it works without label rotation.  you can also try to change the chart orientation and see if that helps.

 

Link to comment
Share on other sites

vattembhaskar,

 

It looks like you have made one of the most common mistakes. It should be easy to fix. Your series is $F{month} and your category is $F{month} as well. This doesn't make sense.

 

Change the series to "MySeries" and leave the category as $F{month}.

 

Try the reverse as well. Set the series as $F{month} and the category as "MyCategory". It should help to understand what's going on.

 

Please let us know if that solves it.

 

Regards,
Matt

Link to comment
Share on other sites

  • 7 months later...

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