Jump to content

Column Chart with Stacking by Group


ktalarico

Recommended Posts

index(29).png.c376c14ae15f09992386c898053b3b4d.png

In the above chart, each column represents a factory.  Sometimes factories serve multiple brands.  For example, ADO can serve Brand A or Brand B.  I want each factory's column to be stacked by Brand.

I saw this post but it is not quite what I want:

http://community.jaspersoft.com/wiki/sample-html5-column-stacked-and-grouped-chart

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.0.1.final using JasperReports Library version 6.0.0  --><!-- 2016-11-01T12:18:39 --><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="Factory Output"              pageWidth="750"              pageHeight="550"              orientation="Landscape"              whenNoDataType="NoDataSection" columnWidth="750" leftMargin="0"              rightMargin="0" topMargin="0" bottomMargin="0"              uuid="062bc899-90c7-46f6-90f4-b74e6d88bb20">    <property name="ireport.zoom" value="1.0"/>    <property name="ireport.x" value="0"/>    <property name="ireport.y" value="108"/>    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="staging"/>    <property name="ireport.jasperserver.url" value="http://192.168.6.18:8080/valmarc-system/"/>     <property name="ireport.jasperserver.report.resource"              value="/organizations/Converse_Factories/organizations/Footwear/Dashboards/Dashboard_Resources/Dashboard___Factory_Output_Report_Test_files/Dashboard___Factory_Output_Report_Test_"/>     <property name="ireport.jasperserver.reportUnit"             value="/organizations/Converse_Factories/organizations/Footwear/Dashboards/Dashboard_Resources/Dashboard___Factory_Output_Report_Test"/>    <property name="com.jaspersoft.studio.unit." value="pixel"/>    <property name="ireport.jasperserver.user" value="superuser"/>    <style name="Title" fontName="Arial" fontSize="32" isBold="true" pdfFontName="Times-Bold"/>    <style name="Column header" mode="Opaque" forecolor="#FFFFFF"           backcolor="#517BB2" vAlign="Middle" fontName="Arial" fontSize="10"           isBold="true" isItalic="false">        <box leftPadding="2" rightPadding="2"/>    </style>    <style name="Detail" vAlign="Middle" fontName="Arial" fontSize="12">        <box leftPadding="2" rightPadding="2"/>    </style>    <style name="Row" mode="Transparent" vAlign="Middle" fontSize="12">        <conditionalStyle>            <conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>            <style mode="Opaque" backcolor="#CFD8E7"/>        </conditionalStyle>    </style>    <style name="Footer" forecolor="#000000" backcolor="#FFFFFF">        <box>            <pen lineColor="#CFD8E7"/>            <topPen lineWidth="2.0" lineColor="#CFD8E7"/>            <leftPen lineColor="#CFD8E7"/>            <bottomPen lineColor="#CFD8E7"/>            <rightPen lineColor="#CFD8E7"/>        </box>    </style>    <parameter name="FACTORY_CD" class="java.util.Collection"/>    <parameter name="FACTORY_CD_CSV" class="java.lang.String" isForPrompting="false">        <defaultValueExpression><![CDATA[com.valmarc.jasper.Utils.joinCSV($P{FACTORY_CD})]]></defaultValueExpression>    </parameter>    <parameter name="FACTORY_PO" class="java.lang.String" isForPrompting="false">        <defaultValueExpression><![CDATA[""]]></defaultValueExpression>    </parameter>    <parameter name="LoggedInUserAttribute_factory_cd" class="java.lang.String"/>    <parameter name="LoggedInUserAttribute_brand_id" class="java.lang.String"/>    <parameter name="YEAR_MONTH" class="java.util.Collection">        <parameterDescription><![CDATA[]]></parameterDescription>    </parameter>    <parameter name="YEAR_MONTH_CSV" class="java.lang.String">        <defaultValueExpression><![CDATA[com.valmarc.jasper.Utils.joinCSV($P{YEAR_MONTH})]]></defaultValueExpression>    </parameter>    <parameter name="style" class="java.lang.String">        <defaultValueExpression><![CDATA[""]]></defaultValueExpression>    </parameter>    <parameter name="GAC_END_DATE" class="java.util.Date" isForPrompting="false"/>    <parameter name="GAC_BEGIN_DATE" class="java.util.Date" isForPrompting="false"/>    <parameter name="BRAND_ID" class="java.util.Collection"/>    <parameter name="BRAND_ID_CSV" class="java.lang.String" isForPrompting="false">        <defaultValueExpression><![CDATA[com.valmarc.jasper.Utils.joinCSV($P{BRAND_ID})]]></defaultValueExpression>    </parameter>    <parameter name="COUNTRY_ID" class="java.util.Collection"/>    <parameter name="COUNTRY_ID_CSV" class="java.lang.String">        <defaultValueExpression>            <![CDATA[com.valmarc.jasper.Utils.joinCSV($P{COUNTRY_ID})]]>        </defaultValueExpression>    </parameter>    <parameter name="STYLE_DESC" class="java.lang.String">        <defaultValueExpression><![CDATA[""]]></defaultValueExpression>    </parameter>    <parameter name="YEAR_MONTH_ORIG" class="java.util.Collection">        <defaultValueExpression><![CDATA[""]]></defaultValueExpression>    </parameter>    <queryString language="plsql">        <![CDATA[{call rpt_ft_dashboard_output_chrt                  ($P{ORACLE_REF_CURSOR}, $P{LoggedInUserAttribute_factory_cd},                  $P{LoggedInUserAttribute_brand_id}, $P{FACTORY_CD_CSV},                  $P{BRAND_ID_CSV}, $P{YEAR_MONTH_CSV}, $P{style}, $P{STYLE_DESC},                  $P{FACTORY_PO}, $P{COUNTRY_ID_CSV}, $P{GAC_BEGIN_DATE},                  $P{GAC_END_DATE})}]]>    </queryString>    <field name="BRAND_NAME" class="java.lang.String">        <fieldDescription><![CDATA[]]></fieldDescription>    </field>    <field name="FACTORY_CD" class="java.lang.String">        <fieldDescription><![CDATA[]]></fieldDescription>    </field>    <field name="FACTORY_CD2" class="java.lang.String">        <fieldDescription><![CDATA[]]></fieldDescription>    </field>    <field name="SCAN_DT" class="java.lang.String">        <fieldDescription><![CDATA[]]></fieldDescription>    </field>    <field name="SCAN_COUNT" class="java.math.BigDecimal"/>    <title>        <band height="300" splitType="Stretch">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>            <componentElement>               <reportElement stretchType="RelativeToTallestObject"                             x="0" y="35" width="750" height="265"                             uuid="20129c3a-02dd-4684-b7ca-67539c5e009a">                    <property name="local_mesure_unitwidth" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.width" value="px"/>                    <property name="local_mesure_unitheight" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.height" value="px"/>              </reportElement>               <hc:chart xmlns:hc="http://jaspersoft.com/highcharts"                        xsi:schemaLocation="http://jaspersoft.com/highcharts                        http://jaspersoft.com/schema/highcharts.xsd" type="Column"                        evaluationTime="Report">                  <hc:chartSetting name="default">                      <hc:chartProperty name="chart.backgroundColor">                          <hc:propertyExpression><![CDATA["#000000"]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="chart.marginTop">                          <hc:propertyExpression><![CDATA[new Integer(50)]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="chart.spacingLeft">                          <hc:propertyExpression><![CDATA[new Integer(10)]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="chart.spacingRight">                          <hc:propertyExpression><![CDATA[new Integer(10)]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="chart.spacingTop">                          <hc:propertyExpression><![CDATA[new Integer(10)]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="colors">                          <hc:propertyExpression>                              <![CDATA[java.util.Arrays.asList("#C38790","#8CD847","#6D3AC6","#D3BE43","#CA4CC8","#73D78B","#6B6DD2","#DC6E36","#4F2D72","#5E853A","#C14787","#6DC8BA","#C03C48","#A6BFD7","#4C2938","#CAC190","#C590D1","#3D533C","#577BA5","#8A5B33")]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="credits.enabled" value="false"/>                      <hc:chartProperty name="credits.href" value=""/>                      <hc:chartProperty name="credits.text" value=""/>                      <hc:chartProperty name="legend.itemStyle.color">                          <hc:propertyExpression><![CDATA["#FFFFFF"]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="plotOptions.column.pointPadding" value="0"/>                      <hc:chartProperty name="plotOptions.series.connectNulls">                          <hc:propertyExpression><![CDATA[boolean.TRUE]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="plotOptions.series.dataLabels.color">                          <hc:propertyExpression><![CDATA["#FFFFFF"]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="plotOptions.series.dataLabels.enabled">                          <hc:propertyExpression><![CDATA[false]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="title.margin">                          <hc:propertyExpression><![CDATA[new Integer(0)]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="title.style.color" value=""#FFFFFF""/>                      <hc:chartProperty name="title.style.fontSize" value="20px"/>                      <hc:chartProperty name="title.text">                          <hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="title.y">                          <hc:propertyExpression><![CDATA[new Integer(0)]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="tooltip.shared">                          <hc:propertyExpression><![CDATA[boolean.FALSE]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="xAxis.labels.style.color">                          <hc:propertyExpression><![CDATA["#FFFFFF"]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="yAxis.gridLineColor" value=""#000000""/>                      <hc:chartProperty name="yAxis.labels.style.color">                          <hc:propertyExpression><![CDATA["#FFFFFF"]]></hc:propertyExpression>                      </hc:chartProperty>                      <hc:chartProperty name="yAxis.title.text">                          <hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>                      </hc:chartProperty>                  </hc:chartSetting>                  <multiAxisData>                      <multiAxisDataset/>                      <dataAxis axis="Rows">                          <axisLevel name="ScanDate">                              <labelExpression><![CDATA["Factory124Line"]]></labelExpression>                              <axisLevelBucket order="None" class="java.lang.Comparable">                                  <bucketExpression><![CDATA[$F{SCAN_DT}]]></bucketExpression>                              </axisLevelBucket>                          </axisLevel>                      </dataAxis>                      <dataAxis axis="Columns">                          <axisLevel name="Factory">                              <labelExpression><![CDATA[]]></labelExpression>                              <axisLevelBucket order="None" class="java.lang.String">                               <bucketExpression><![CDATA[$F{FACTORY_CD} + " | " + $F{FACTORY_CD2}]]></bucketExpression>                                  <bucketProperty name="Brand"><![CDATA[$F{BRAND_NAME}]]></bucketProperty>                              </axisLevelBucket>                          </axisLevel>                      </dataAxis>                      <multiAxisMeasure name="Scan Count" class="java.lang.Integer" calculation="Nothing">                            <labelExpression><![CDATA[""]]></labelExpression>                            <valueExpression><![CDATA[$F{SCAN_COUNT}]]></valueExpression>                      </multiAxisMeasure>                    </multiAxisData>                    <hc:series name="Scan Count">                        <hc:contributor name="SeriesProperty">                            <hc:contributorProperty name="name" valueType="Bucket" value="Factory"/>                            <hc:contributorProperty name="stack" valueType="Bucket" value="Factory.Brand"/>                        </hc:contributor>                    </hc:series>                </hc:chart>            </componentElement>            <staticText>               <reportElement mode="Opaque" x="0" y="0" width="750"                             height="35" forecolor="#FFFFFF" backcolor="#000000"                             uuid="5eddfe66-a221-4408-800e-5c18aa32d53e">                    <property name="local_mesure_unitwidth" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.width" value="px"/>                    <property name="local_mesure_unitheight" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.height" value="px"/>                </reportElement>                <textElement textAlignment="Center" verticalAlignment="Middle">                    <font fontName="Arial" size="12" pdfFontName="Times-Roman"/>                </textElement>                <text><![CDATA[Factory Scanning Activity By Month]]></text>            </staticText>        </band>    </title>    <noData>        <band height="300">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>            <frame>               <reportElement mode="Opaque" x="0" y="35" width="750"                             height="265" backcolor="#000000"                             uuid="a2fa4eea-8711-4c29-aaae-0371c11f3cc0"/>            </frame>            <staticText>              <reportElement mode="Opaque" x="0" y="0" width="750"                             height="35" forecolor="#FFFFFF" backcolor="#000000"                             uuid="76ee818d-2d49-4f8e-b8f4-1f6df4c01d41">                    <property name="local_mesure_unitwidth" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.width" value="px"/>                    <property name="local_mesure_unitheight" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.height" value="px"/>                </reportElement>                <textElement textAlignment="Center" verticalAlignment="Middle">                    <font fontName="Arial" size="12" pdfFontName="Times-Roman"/>                </textElement>                <text><![CDATA[Factory Scanning Activity By Month]]></text>            </staticText>        </band>    </noData></jasperReport>[/code]

index(29).png.ff6e511275615e2a85628d2dab213e9a.png

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Posted Images

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