<?xml version="1.0" encoding="UTF-8"?>
<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="LineChartReport" columnCount="2" pageWidth="595" pageHeight="842" columnWidth="270" columnSpacing="15" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30">
	<style name="Sans_Normal" isDefault="true" fontName="DejaVu Sans" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<style name="Sans_Bold" isDefault="false" fontName="DejaVu Sans" fontSize="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<style name="Sans_Italic" isDefault="false" fontName="DejaVu Sans" fontSize="8" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
	<style name="Serif_Normal" isDefault="false" fontName="DejaVu Serif" fontSize="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<style name="Serif_Bold" isDefault="false" fontName="DejaVu Serif" fontSize="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<parameter name="ReportTitle" class="java.lang.String"/>
	<parameter name="MaxOrderID" class="java.lang.Integer"/>
	<queryString>
		<![CDATA[SELECT * FROM Orders WHERE OrderID <= $P{MaxOrderID} ORDER BY ShipCountry]]>
	</queryString>
	<field name="ShippedDate" class="java.sql.Timestamp"/>
	<field name="ShipCountry" class="java.lang.String"/>
	<field name="RequiredDate" class="java.sql.Timestamp"/>
	<field name="CustomerID" class="java.lang.String"/>
	<field name="OrderID" class="java.lang.Integer"/>
	<field name="ShipName" class="java.lang.String"/>
	<field name="ShipVia" class="java.lang.Integer"/>
	<field name="ShipPostalCode" class="java.lang.String"/>
	<field name="OrderDate" class="java.sql.Timestamp"/>
	<field name="ShipCity" class="java.lang.String"/>
	<field name="ShipAddress" class="java.lang.String"/>
	<field name="EmployeeID" class="java.lang.Integer"/>
	<field name="ShipRegion" class="java.lang.String"/>
	<field name="Freight" class="java.lang.Double"/>
	<variable name="FirstLetter" class="java.lang.String" resetType="None">
		<variableExpression><![CDATA[$F{ShipCountry}.substring(0, 1).toUpperCase()]]></variableExpression>
	</variable>
	<variable name="FirstLetterCount" class="java.lang.Integer" resetType="Group" resetGroup="ChartGroup" incrementType="Group" incrementGroup="FirstLetterGroup" calculation="Count">
		<variableExpression><![CDATA[Boolean.TRUE]]></variableExpression>
	</variable>
	<variable name="FirstLetterMin" class="java.lang.String" resetType="Group" resetGroup="ChartGroup" calculation="Lowest">
		<variableExpression><![CDATA[$V{FirstLetter}]]></variableExpression>
	</variable>
	<variable name="FirstLetterMax" class="java.lang.String" resetType="Group" resetGroup="ChartGroup" calculation="Highest">
		<variableExpression><![CDATA[$V{FirstLetter}]]></variableExpression>
	</variable>
	<variable name="FreightSumChartGroup" class="java.lang.Double" resetType="Group" resetGroup="ChartGroup" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="FreightSumCountryGroup" class="java.lang.Double" resetType="Group" resetGroup="CountryGroup" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="FreightSumColumn" class="java.lang.Double" resetType="Column" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="FreightSumPage" class="java.lang.Double" resetType="Page" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="FreightSumReport" class="java.lang.Double" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="DateHighestCountryGroup" class="java.sql.Timestamp" resetType="Group" resetGroup="CountryGroup" calculation="Highest">
		<variableExpression><![CDATA[$F{OrderDate}]]></variableExpression>
	</variable>
	<variable name="RegionCountCountryGroup" class="java.lang.Integer" resetType="Group" resetGroup="CountryGroup" calculation="Count">
		<variableExpression><![CDATA[$F{ShipRegion}]]></variableExpression>
	</variable>
	<group name="ChartGroup" isStartNewColumn="true" minHeightToStartNewPage="200">
		<groupExpression><![CDATA[Integer.valueOf(($V{FirstLetterCount}.intValue() - 1) / 3)]]></groupExpression>
		<groupHeader>
			<band height="250">
				<rectangle>
					<reportElement x="0" y="14" width="270" height="11" forecolor="#FFDDDD" backcolor="#FFDDDD"/>
				</rectangle>
				<staticText>
					<reportElement style="Sans_Italic" mode="Opaque" x="0" y="14" width="130" height="11" forecolor="#FF0000" backcolor="#FFDDDD"/>
					<textElement>
						<font isUnderline="true"/>
					</textElement>
					<text><![CDATA[Countries Starting With Letter :]]></text>
				</staticText>
				<textField evaluationTime="Group" evaluationGroup="ChartGroup">
					<reportElement style="Sans_Bold" mode="Opaque" x="130" y="14" width="20" height="11" forecolor="#FF0000" backcolor="#FFDDDD"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.String"><![CDATA[$V{FirstLetterMin}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Italic" mode="Opaque" x="150" y="14" width="20" height="11" forecolor="#FF0000" backcolor="#FFDDDD"/>
					<textElement textAlignment="Center">
						<font isUnderline="true"/>
					</textElement>
					<text><![CDATA[to]]></text>
				</staticText>
				<textField evaluationTime="Group" evaluationGroup="ChartGroup">
					<reportElement style="Sans_Bold" mode="Opaque" x="170" y="14" width="20" height="11" forecolor="#FF0000" backcolor="#FFDDDD"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$V{FirstLetterMax}]]></textFieldExpression>
				</textField>
				<lineChart>
					<chart evaluationTime="Group" evaluationGroup="ChartGroup">
						<reportElement positionType="Float" x="0" y="50" width="270" height="175"/>
						<chartTitle/>
						<chartSubtitle/>
						<chartLegend/>
					</chart>
					<categoryDataset>
						<dataset resetType="Group" resetGroup="ChartGroup" incrementType="Group" incrementGroup="CountryGroup"/>
						<categorySeries>
							<seriesExpression><![CDATA["Double Freight"]]></seriesExpression>
							<categoryExpression><![CDATA[$F{ShipCountry}]]></categoryExpression>
							<valueExpression><![CDATA[new Double($V{FreightSumCountryGroup}.doubleValue() * 2d)]]></valueExpression>
							<labelExpression><![CDATA[]]></labelExpression>
						</categorySeries>
						<categorySeries>
							<seriesExpression><![CDATA["Normal Freight"]]></seriesExpression>
							<categoryExpression><![CDATA[$F{ShipCountry}]]></categoryExpression>
							<valueExpression><![CDATA[$V{FreightSumCountryGroup}]]></valueExpression>
							<labelExpression><![CDATA[]]></labelExpression>
						</categorySeries>
						<categorySeries>
							<seriesExpression><![CDATA["Half Freight"]]></seriesExpression>
							<categoryExpression><![CDATA[$F{ShipCountry}]]></categoryExpression>
							<valueExpression><![CDATA[new Double($V{FreightSumCountryGroup}.doubleValue() / 2d)]]></valueExpression>
							<labelExpression><![CDATA[]]></labelExpression>
						</categorySeries>
						<categorySeries>
							<seriesExpression><![CDATA["Double Freight"]]></seriesExpression>
							<categoryExpression><![CDATA[$F{ShipCountry}]]></categoryExpression>
							<valueExpression><![CDATA[new Double($V{FreightSumCountryGroup}.doubleValue() * 2d)]]></valueExpression>
							<labelExpression><![CDATA[]]></labelExpression>
						</categorySeries>
					</categoryDataset>
					<linePlot isShowLines="true" isShowShapes="false">
						<plot>
							<seriesColor seriesOrder="0" color="#FF00FF"/>
							<seriesColor seriesOrder="1" color="#FFFF00"/>
							<seriesColor seriesOrder="2" color="#00FFFF"/>
						</plot>
						<categoryAxisFormat>
							<axisFormat>
								<labelFont/>
								<tickLabelFont/>
							</axisFormat>
						</categoryAxisFormat>
						<valueAxisFormat>
							<axisFormat>
								<labelFont/>
								<tickLabelFont/>
							</axisFormat>
						</valueAxisFormat>
					</linePlot>
				</lineChart>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="25">
				<line>
					<reportElement x="0" y="0" width="270" height="1" forecolor="#FF0000"/>
				</line>
				<staticText>
					<reportElement style="Sans_Bold" x="0" y="1" width="45" height="11" forecolor="#FF0000"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Count :]]></text>
				</staticText>
				<textField>
					<reportElement style="Sans_Bold" x="45" y="1" width="25" height="11" forecolor="#FF0000"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ChartGroup_COUNT}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" x="70" y="1" width="140" height="11" forecolor="#FF0000"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Total :]]></text>
				</staticText>
				<textField pattern="0.00">
					<reportElement style="Sans_Bold" x="210" y="1" width="60" height="11" forecolor="#FF0000"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{FreightSumChartGroup}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<group name="FirstLetterGroup">
		<groupExpression><![CDATA[$V{FirstLetter}]]></groupExpression>
	</group>
	<group name="CountryGroup">
		<groupExpression><![CDATA[$F{ShipCountry}]]></groupExpression>
		<groupHeader>
			<band height="15">
				<line>
					<reportElement x="0" y="14" width="270" height="1"/>
				</line>
				<textField>
					<reportElement style="Sans_Bold" x="10" y="2" width="150" height="11"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{ShipCountry}]]></textFieldExpression>
				</textField>
				<textField evaluationTime="Group" evaluationGroup="CountryGroup" pattern="EEE, MMM d, yyyy">
					<reportElement style="Sans_Bold" x="170" y="2" width="100" height="11"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.sql.Timestamp"><![CDATA[$V{DateHighestCountryGroup}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="15">
				<rectangle>
					<reportElement x="0" y="0" width="270" height="11" forecolor="#C0C0C0" backcolor="#C0C0C0"/>
				</rectangle>
				<staticText>
					<reportElement style="Sans_Bold" mode="Opaque" x="0" y="0" width="45" height="11" backcolor="#C0C0C0"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Count :]]></text>
				</staticText>
				<textField>
					<reportElement style="Sans_Bold" mode="Opaque" x="45" y="0" width="25" height="11" backcolor="#C0C0C0"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{CountryGroup_COUNT}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" mode="Opaque" x="70" y="0" width="140" height="11" backcolor="#C0C0C0"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Total :]]></text>
				</staticText>
				<textField pattern="0.00">
					<reportElement style="Sans_Bold" mode="Opaque" x="210" y="0" width="60" height="11" backcolor="#C0C0C0"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{FreightSumCountryGroup}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<title>
		<band height="50">
			<elementGroup/>
			<staticText>
				<reportElement style="Serif_Bold" x="0" y="0" width="555" height="35"/>
				<box>
					<topPen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Center">
					<font size="22"/>
				</textElement>
				<text><![CDATA[Line Chart Report]]></text>
			</staticText>
		</band>
	</title>
	<columnHeader>
		<band height="11">
			<rectangle>
				<reportElement x="0" y="0" width="270" height="11" backcolor="#333333"/>
			</rectangle>
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="0" y="0" width="40" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement textAlignment="Center"/>
				<text><![CDATA[Order]]></text>
			</staticText>
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="40" y="0" width="145" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement textAlignment="Center"/>
				<text><![CDATA[Name, City]]></text>
			</staticText>
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="185" y="0" width="50" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement/>
				<text><![CDATA[Date]]></text>
			</staticText>
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="235" y="0" width="35" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement textAlignment="Right"/>
				<text><![CDATA[Freight]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="13">
			<textField>
				<reportElement x="1" y="0" width="35" height="11"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$F{OrderID}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="40" y="0" width="110" height="11"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ShipName} + ", " + $F{ShipCity}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="155" y="0" width="25" height="11"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ShipRegion}]]></textFieldExpression>
			</textField>
			<textField pattern="dd/MM/yyyy">
				<reportElement x="185" y="0" width="50" height="11"/>
				<textElement/>
				<textFieldExpression class="java.sql.Timestamp"><![CDATA[$F{OrderDate}]]></textFieldExpression>
			</textField>
			<textField pattern="0.00">
				<reportElement x="235" y="0" width="35" height="11"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{Freight}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement positionType="Float" x="0" y="12" width="270" height="1" forecolor="#808080"/>
				<graphicElement>
					<pen lineWidth="0.5"/>
				</graphicElement>
			</line>
		</band>
	</detail>
	<columnFooter>
		<band height="11">
			<rectangle>
				<reportElement x="0" y="0" width="270" height="11" backcolor="#333333"/>
			</rectangle>
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="0" y="0" width="45" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement textAlignment="Right"/>
				<text><![CDATA[Count :]]></text>
			</staticText>
			<textField>
				<reportElement style="Sans_Bold" mode="Opaque" x="45" y="0" width="25" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="70" y="0" width="140" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement textAlignment="Right"/>
				<text><![CDATA[Total :]]></text>
			</staticText>
			<textField pattern="0.00">
				<reportElement style="Sans_Bold" mode="Opaque" x="210" y="0" width="60" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{FreightSumColumn}]]></textFieldExpression>
			</textField>
		</band>
	</columnFooter>
	<pageFooter>
		<band height="30">
			<rectangle>
				<reportElement mode="Transparent" x="0" y="5" width="555" height="25"/>
			</rectangle>
			<staticText>
				<reportElement x="5" y="10" width="50" height="20"/>
				<textElement textAlignment="Right">
					<font size="14"/>
				</textElement>
				<text><![CDATA[Count :]]></text>
			</staticText>
			<textField>
				<reportElement x="55" y="10" width="45" height="20"/>
				<textElement textAlignment="Right">
					<font size="14"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_COUNT}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="430" y="10" width="50" height="20"/>
				<textElement textAlignment="Right">
					<font size="14"/>
				</textElement>
				<text><![CDATA[Total :]]></text>
			</staticText>
			<textField pattern="0.00">
				<reportElement x="480" y="10" width="70" height="20"/>
				<textElement textAlignment="Right">
					<font size="14"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{FreightSumPage}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="200" y="10" width="75" height="20"/>
				<textElement textAlignment="Right">
					<font size="14"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="275" y="10" width="5" height="20"/>
				<textElement textAlignment="Center">
					<font size="14"/>
				</textElement>
				<text><![CDATA[/]]></text>
			</staticText>
			<textField evaluationTime="Report">
				<reportElement x="280" y="10" width="75" height="20"/>
				<textElement>
					<font size="14"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
</jasperReport>
