Parse xml file with rails REXML? - ruby-on-rails

How can i parse this xml file ?
<resultset>
−<row>
<field name="Table Name">table_1</field>
<field name="Quant of Rows">2</field>
<field name="Total Size Mb">0.02</field>
</row>
−<row>
<field name="Table Name">table_2</field>
<field name="Quant of Rows">1</field>
<field name="Total Size Mb">0.02</field>
</row>
</resultset>
I am using REXML.

table_data = []
xml = File.read('file1.xml')
doc, posts = REXML::Document.new(xml), []
doc.elements.each('resultset/row') do |table_row|
table_data << {:table_name => table_row.elements[1].text,
:record_count => table_row.elements[2].text,
:size_in_mb => table_row.elements[3].text
}
end

Related

How to stop xmlslurper to add "<?xml version="1.0" encoding="UTF-8"?>" automatically

getting that extra node "" while writing a node in XML with xmlsluper.
Got the thread response to use xmlparser.
But we do have a constraint to use xmlxlurper, how can we fix it (or remove it) with xmlslurper ?
Our groovy code snippet
def xmlFromFile = new File(xxx.xml)
def envelopeNode = new XmlSlurper( false, false ).parseText(xmlFromFile.getText())
def newNode = new XmlSlurper().parseText(SomeStringWithProperXMLChildNode)
envelopeNode.rows.appendNode(newNode)
XmlUtil xmlUtil = new XmlUtil()
xmlUtil.serialize(envelopeNode, new FileWriter(xmlFromFile))
How I can remove ""
Or can stop serialize/XmlSlurper from adding that extra encoding info.
XML Snippet :
<SomeThing xmlns="http://xmlns.oracle.com/something" name="something">
<description />
<columns>
<column name="name" />
<column name="Type" />
<column name="Identifier" />
</columns>
<rows>
<row>
<cell>111</cell>
<cell>222</cell>
<cell>333</cell>
</row>
<row>
<cell>444</cell>
<cell>555</cell>
<cell>666</cell>
</row>
</rows>
</SomeThing>
Thanks

service unavailable error in openfire message archive management

I am using monitoring plugin 1.6.0 with openfire 4.2.0.
Following is the screenshot of archive settings on openfire admin Console.
also following is the screenshot of plugins I am using with this.
My Issue
as you can see the plugin is installed.
but when I am trying to fetch chat history with following code : I am getting service unavailable response.
func fetchChatHistoryFromServer(completionHandler completion: #escaping FetchChatHistoryCompletionHandler) {
let iq = DDXMLElement(name: "iq")
iq.addAttribute(withName: "type", stringValue: "set")
iq.addAttribute(withName: "id", stringValue: UserManager.shared.activeUser.jid)
let query = DDXMLElement(name: "query")
query.setXmlns("urn:xmpp:mam:2")
query.addAttribute(withName: "queryid", stringValue: XMPPManager.shared.xmppStream.generateUUID)
let x = DDXMLElement(name: "x")
x.setXmlns("jabber:x:data")
x.addAttribute(withName: "type", stringValue: "submit")
let field = DDXMLElement(name: "field")
field.addAttribute(withName: "var", stringValue: "FORM_TYPE")
field.addAttribute(withName: "type", stringValue: "hidden")
let fieldValue = DDXMLElement(name: "value", stringValue: "urn:xmpp:mam:2")
field.addChild(fieldValue)
x.addChild(field)
query.addChild(x)
iq.addChild(query)
//let xmppResultSet = XMPPResultSet(max: 2000)
Logger.log(iq)
didFetchChatHistoryCompletionBlock = completion
xmppMessageArchivingManagement?.retrieveMessageArchive(withFields: [iq], with: nil)
}
OutPut Log :-
<iq type="set" id="dev60#dev.myapp.com">
<query xmlns="urn:xmpp:mam:2" queryid="20B07616-12BC-41BB-9DE6-F0F6A74951A5">
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE" type="hidden">
<value>urn:xmpp:mam:2</value>
</field>
</x>
</query>
</iq>
Response :--
<iq xmlns="jabber:client" type="error" id="7BED0303-46E3-40D4-BE47-543BB7810F66" to="dev60#dev.myapp.com/a3lb3jaw9g">
<query xmlns="urn:xmpp:mam:2" queryid="80D6D753-B2BF-4626-84B5-C216D4B94996">
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE" type="hidden">
<value>urn:xmpp:mam:2</value>
</field>
<iq type="set" id="dev60#dev.myapp.com">
<query xmlns="urn:xmpp:mam:2" queryid="20B07616-12BC-41BB-9DE6-F0F6A74951A5">
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE" type="hidden">
<value>urn:xmpp:mam:2</value>
</field>
</x>
</query>
</iq>
</x>
</query>
<error code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></service-unavailable>
</error>
openfire do not support urn:xmpp:mam:2 you have to use urn:xmpp:mam:1 instead.
you have to change it in XMPPMessageArchiveManagemnt class.
just go to XMPPMessageArchiveManagement class .in line of 20 it said
/** 'urn:xmpp:mam:2' */ extern NSString *const XMLNS_XMPP_MAM;.
just hold command and click on XMLNS_XMPP_MAM after that change urn:xmpp:mam:2 to urn:xmpp:mam:1

how to locate the new added field in Openerp when two of parent view's fields are repetitive?

I'm new to Openerp v 7.0,when I was trying to add one field in my inherited view, it didn't work. I found in parent view ,there were two fields has the same name , does this reason cause the problem?
here is the parent view code:
<page string="Contacts" attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}" autofocus="autofocus">
<field name="child_ids" mode="kanban" context="{'default_parent_id': active_id, 'default_street': street, 'default_street2': street2, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_supplier': supplier}">
<kanban>
<field name="color"/>
<field name="name"/>
<field name="title"/>
<field name="email"/>
<field name="parent_id"/>
<field name="is_company"/>
<field name="function"/>
<field name="phone"/>
<field name="street"/>
<field name="street2"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="mobile"/>
<field name="fax"/>
<field name="state_id"/>
<field name="has_image"/>
<templates>
<t t-name="kanban-box">
<t t-set="color" t-value="kanban_color(record.color.raw_value)"/>
<div t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '')" style="position: relative">
<a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
<div class="oe_module_vignette">
<a type="open">
<t t-if="record.has_image.raw_value === true">
<img t-att-src="kanban_image('res.partner', 'image', record.id.value, {'preview_image': 'image_small'})" class="oe_avatar oe_kanban_avatar_smallbox"/>
</t>
<t t-if="record.image and record.image.raw_value !== false">
<img t-att-src="'data:image/png;base64,'+record.image.raw_value" class="oe_avatar oe_kanban_avatar_smallbox"/>
</t>
<t t-if="record.has_image.raw_value === false and (!record.image or record.image.raw_value === false)">
<t t-if="record.is_company.raw_value === true">
<img t-att-src='_s + "/base/static/src/img/company_image.png"' class="oe_kanban_image oe_kanban_avatar_smallbox"/>
</t>
<t t-if="record.is_company.raw_value === false">
<img t-att-src='_s + "/base/static/src/img/avatar.png"' class="oe_kanban_image oe_kanban_avatar_smallbox"/>
</t>
</t>
</a>
<div class="oe_module_desc">
<div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_color_border">
<table class="oe_kanban_table">
<tr>
<td class="oe_kanban_title1" align="left" valign="middle">
<h4><a type="open"><field name="name"/></a></h4>
<i><div t-if="record.function.raw_value">
<field name="function"/></div></i>
<div><a t-if="record.email.raw_value" title="Mail" t-att-href="'mailto:'+record.email.value">
<field name="email"/>
</a></div>
<div t-if="record.phone.raw_value">Phone: <field name="phone"/></div>
<div t-if="record.mobile.raw_value">Mobile: <field name="mobile"/></div>
<div t-if="record.fax.raw_value">Fax: <field name="fax"/></div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
<form string="Contact" version="7.0">
<sheet>
<field name="image" widget='image' class="oe_avatar oe_left" options='{"preview_image": "image_medium"}'/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name" style="width: 70%%"/></h1>
<field name="category_id" widget="many2many_tags" placeholder="Tags..." style="width: 70%%"/>
</div>
<group>
<field name="function" placeholder="e.g. Sales Director"/>
<field name="email"/>
<field name="phone"/>
<field name="mobile"/>
</group>
<div>
<field name="use_parent_address"/><label for="use_parent_address"/>
</div>
<group>
<label for="type"/>
<div name="div_type">
<field class="oe_inline" name="type"/>
</div>
<label for="street" string="Address" attrs="{'invisible': [('use_parent_address','=', True)]}"/>
<div attrs="{'invisible': [('use_parent_address','=', True)]}" name="div_address">
<field name="street" placeholder="Street..."/>
<field name="street2"/>
<div class="address_format">
<field name="city" placeholder="City" style="width: 40%%"/>
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}' on_change="onchange_state(state_id)"/>
<field name="zip" placeholder="ZIP" style="width: 20%%"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}'/>
</div>
</group>
<field name="supplier" invisible="True"/> <-------------- 1st one
</sheet>
</form>
</field>
</page>
<page string="Sales & Purchases">
<group>
<group>
<field name="user_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group>
<field name="customer"/>
<field name="supplier"/><-----------------2nd one
</group>
<group>
<field name="ref"/>
<field name="lang"/>
<field name="date"/>
</group>
<group>
<field name="active"/>
</group>
</group>
</page>
……
there are two fields like in above code. what I wanted to do was added a new field name "product_categ_id" after the field. but it didn't work. here are my codes
<openerp>
<data>
<record model="ir.ui.view" id="rainsoft_partner_form_view">
<field name="name">rainsoft_partner.rainsoft_partner</field>
<field name="type">form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="title" position="after">
<field name="QQ" placeholder="input your QQ number here."/>
<!--<field name="product_categ_id"/>-->
</field>
<field name="supplier" position="after"> <-------------it doesn't work
<field name="product_categ_id"/>
</field>
<field name="date" position="replace">
<field name="date" string="合同开始日期"/>
</field>
<field name="date" position="after">
<field name="contract_end_date" string="合同结束日期" />
</field>
</field>
</record>
<record model="ir.ui.view" id="rainsoft_partner_tree_view">
<field name="name">rainsoft_partner.rainsoft_partner</field>
<field name="type">tree</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<field name="name" position="before" >
<field name="ref" string="No"/>
</field>
</field>
</record>
</data>
but when I replace " name='supplier' " by " name='customer' " it works, I guess coz the "customer" only show once in the code.
Anyone here has the resolution? Thanks a lot.
I've found the solution:
using the xpath instead of the way using field name positioning.
here is my new code:
<openerp>
<data>
<record id="res_partner_view_supplier_product_categ" model="ir.ui.view">
<field name="name">res.partner.view.supplier.product_categ</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="40"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page[#string='Sales & Purchases']/group/group/field[#name='supplier']" position="after">
<field name="product_categ_id" attrs="{'invisible': [('supplier', '=', False)]}"/>
</xpath>
</field>
</record>
</data>

Limit on clientdataset columns and size

Is there a limit on the number of columns a client dataset can have and also is the limit on the size of the columns?
We have an app that loads the client dataset from an xml file (it is not a file on disk but an xml block in memory which is loaded) and we found that if we set the width on one of the columns to over a 1000, then we would get some obscure access violation (sometimes the application would just hang).
JD.
Ps. As far I can recall we are still using the client dataset which came with delphi 2006.
Okay, some code:
We have an xml block of data that is in this format:
string xmlDataSet=
<METADATA>
<FIELDS>
<FIELD attrname="f:CNAME" fieldtype="string" width="50"/>
<FIELD attrname="f:CTITL" fieldtype="string" width="500"/>
<FIELD attrname="f:ID" fieldtype="string" width="250"/>
<FIELD attrname="f:CREDT" fieldtype="string" width="250"/>
<FIELD attrname="f:HEADT" fieldtype="string" width="500"/>
<FIELD attrname="f:BODYT" fieldtype="string" width="500"/>
<FIELD attrname="f:DATE1" fieldtype="string" width="500"/>
<FIELD attrname="f:TIME1" fieldtype="string" width="500"/>
<FIELD attrname="f:DATE2" fieldtype="string" width="500"/>
<FIELD attrname="f:TIME2" fieldtype="string" width="500"/>
<FIELD attrname="f:IMG_1" fieldtype="string" width="500"/>
<FIELD attrname="f:IMG_2" fieldtype="string" width="500"/>
<FIELD attrname="f:IMG_3" fieldtype="string" width="500"/>
<FIELD attrname="f:VID_1" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_A" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_B" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_C" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_D" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_E" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_F" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_G" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_H" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_I" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_J" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_K" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_L" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_M" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_N" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_O" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_P" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_Q" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_R" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_S" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_T" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_U" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_V" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_W" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_X" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_Y" fieldtype="string" width="500"/>
<FIELD attrname="f:FLD_Z" fieldtype="string" width="500"/>
</FIELDS>
</METADATA>
<ROWDATA>
<ROW f:DATE2="" f:TIME2="" f:IMG_2="" f:IMG_3="" f:VID_1="" f:FLD_A="" f:FLD_B="" f:FLD_C="" f:FLD_D="" f:FLD_E="" f:FLD_F="" f:FLD_G="" f:FLD_H="" f:FLD_I="" f:FLD_J="" f:FLD_K="" f:FLD_L="" f:FLD_M="" f:FLD_N="" f:FLD_O="" f:FLD_P="" f:FLD_Q="" f:FLD_R="" f:FLD_S="" f:FLD_T="" f:FLD_U="" f:FLD_V="" f:FLD_W="" f:FLD_X="" f:FLD_Y="" f:FLD_Z="" f:CNAME="YahooNewsTopStories" f:CTITL="Yahoo! News: Top Stories" f:ID="ap/20100119/cb_haiti_earthquake" f:HEADT="Haiti chaos hampers aid delivery; death toll rises (AP)" f:BODYT="AP - Relief workers say pockets of violence in Haiti's devastated capital are hindering a slow increase in much-needed aid delivery, and some residents have banded together to protect the few possessions they have left." f:IMG_1="http://d.yimg.com/a/p/ap/20100118/capt.cb4c93423c284ca985dd02fd38d283e4.haiti_earthquake_xgb107.jpg?x=130&y=82&q=85&sig=gRxfiZPe6KlqoVNPtadFzQ--" flab:DATE1="Publication Date" f:CREDT="(AP)" f:TIME1="13:03:59" f:DATE1="mardi 19 janvier 2010"/>
<ROW f:DATE2="" f:TIME2="" f:IMG_2="" f:IMG_3="" f:VID_1="" f:FLD_A="" f:FLD_B="" f:FLD_C="" f:FLD_D="" f:FLD_E="" f:FLD_F="" f:FLD_G="" f:FLD_H="" f:FLD_I="" f:FLD_J="" f:FLD_K="" f:FLD_L="" f:FLD_M="" f:FLD_N="" f:FLD_O="" f:FLD_P="" f:FLD_Q="" f:FLD_R="" f:FLD_S="" f:FLD_T="" f:FLD_U="" f:FLD_V="" f:FLD_W="" f:FLD_X="" f:FLD_Y="" f:FLD_Z="" f:CNAME="YahooNewsTopStories" f:CTITL="Yahoo! News: Top Stories" f:ID="ap/20100119/us_marriage_economics" f:HEADT="Report: More men get economic boost from marriage (AP)" f:BODYT="AP - Historically, marriage was the surest route to financial security for women. Nowadays it's men who are increasingly getting the biggest economic boost from tying the knot, according to a new analysis of census data." f:IMG_1="" flab:DATE1="Publication Date" f:CREDT="" f:TIME1="13:03:59" f:DATE1="mardi 19 janvier 2010"/> etc...LOTS MORE ROWS.
With this xml block in memory, we load as follows:
FClientDataSet := TClientDataSet.Create(nil);
TransformedXSLTStream := TStringStream.Create(xmlDataSet); (from above)
ClientDataSet.LoadFromStream(TransformedXSLTStream);
TransformedXSLTStream.Free;
ClientDataSet.First;
Now if I set width above to 1000, then I get an Access violation (read addresss xxx etc) on the LoadStream.
My guess would be that it is memory related or a hard coded limit. If you trace the component you should be able to find the exception rather easily. I would start with loadstream. Also you might try it with test data that you know is clean. I have had situations while parsing XML and other similar formats where the data had "invalid" characters which would cause the application to crash. Ansi/unicode did it for me too in of all things a simple text file.

How can I change granularity in highcharts?

Is it possible to change granularity on graphics? I have such schedule:
How can I change granularity? That data would be displayed not on days but on months. For example: Sep, Oct, Dec etc.
Code report:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2016-01-31T20:54:38 -->
<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="Blank_A4_Landscape" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a0a85c1c-ef3e-4a4d-bca5-2569e695b407">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="ireport.jasperserver.report.resource" value="/public/Blank_A4_Landscape_files/main_jrxml"/>
<property name="ireport.jasperserver.reportUnit" value="/public/Blank_A4_Landscape"/>
<subDataset name="Dataset1" uuid="7d75e5f3-311c-4d74-8f4f-13af8f33cc78">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
<queryString>
<![CDATA[SELECT top 100 * FROM Orders --WHERE "ORDERS"."SHIPPEDDATE" > NOW() - INTERVAL 30 DAY;]]>
</queryString>
<field name="ORDERID" class="java.lang.Integer"/>
<field name="CUSTOMERID" class="java.lang.String"/>
<field name="EMPLOYEEID" class="java.lang.Integer"/>
<field name="ORDERDATE" class="java.sql.Timestamp"/>
<field name="REQUIREDDATE" class="java.sql.Timestamp"/>
<field name="SHIPPEDDATE" class="java.sql.Timestamp"/>
<field name="SHIPVIA" class="java.lang.Integer"/>
<field name="FREIGHT" class="java.math.BigDecimal"/>
<field name="SHIPNAME" class="java.lang.String"/>
<field name="SHIPADDRESS" class="java.lang.String"/>
<field name="SHIPCITY" class="java.lang.String"/>
<field name="SHIPREGION" class="java.lang.String"/>
<field name="SHIPPOSTALCODE" class="java.lang.String"/>
<field name="SHIPCOUNTRY" class="java.lang.String"/>
</subDataset>
<queryString>
<![CDATA[Select * From Orders]]>
</queryString>
<field name="ORDERID" class="java.lang.Integer"/>
<field name="CUSTOMERID" class="java.lang.String"/>
<field name="EMPLOYEEID" class="java.lang.Integer"/>
<field name="ORDERDATE" class="java.sql.Timestamp"/>
<field name="REQUIREDDATE" class="java.sql.Timestamp"/>
<field name="SHIPPEDDATE" class="java.sql.Timestamp"/>
<field name="SHIPVIA" class="java.lang.Integer"/>
<field name="FREIGHT" class="java.math.BigDecimal"/>
<field name="SHIPNAME" class="java.lang.String"/>
<field name="SHIPADDRESS" class="java.lang.String"/>
<field name="SHIPCITY" class="java.lang.String"/>
<field name="SHIPREGION" class="java.lang.String"/>
<field name="SHIPPOSTALCODE" class="java.lang.String"/>
<field name="SHIPCOUNTRY" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="533" splitType="Stretch">
<componentElement>
<reportElement x="0" y="80" width="791" height="295" uuid="d836a1b4-c816-4f45-b0f8-0c3ac80a37a0"/>
<hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="StackedColumn">
<hc:chartSetting name="default">
<hc:chartProperty name="chart.zoomType">
<hc:propertyExpression><![CDATA["xy"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.enabled">
<hc:propertyExpression><![CDATA[false]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.href">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.pie.showInLegend" value="true"/>
<hc:chartProperty name="title.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="yAxis.title.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="chart.backgroundColor">
<hc:propertyExpression><![CDATA[new java.awt.Color(-16777216)]]></hc:propertyExpression>
</hc:chartProperty>
</hc:chartSetting>
<multiAxisData>
<multiAxisDataset>
<dataset>
<datasetRun subDataset="Dataset1" uuid="a05e665b-8ead-41d2-a6e8-3ebad99d8c4d"/>
</dataset>
</multiAxisDataset>
<dataAxis axis="Rows">
<axisLevel name="Level1">
<labelExpression><![CDATA["Level Label expression"]]></labelExpression>
<axisLevelBucket class="java.lang.String">
<bucketExpression><![CDATA[$F{SHIPPEDDATE}]]></bucketExpression>
</axisLevelBucket>
</axisLevel>
</dataAxis>
<dataAxis axis="Columns"/>
<multiAxisMeasure name="Measure1" class="java.lang.Integer" calculation="DistinctCount">
<labelExpression><![CDATA["Total Orders"]]></labelExpression>
<valueExpression><![CDATA[$F{ORDERID}]]></valueExpression>
</multiAxisMeasure>
</multiAxisData>
<hc:series name="Measure1"/>
</hc:chart>
</componentElement>
</band>
</title>
</jasperReport>
Change your query to group and count data on month
Example (mysql syntax)
SELECT DATE_FORMAT(SHIPPEDDATE,'%y %M') as LABEL, COUNT(ORDERID) AS CNT_ORDERID
FROM Orders
GROUP BY YEAR(SHIPPEDDATE), MONTH(SHIPPEDDATE)
ORDER BY SHIPPEDDATE
Note: this will change your fields in Dataset1 (just 2, LABEL and CNT_ORDERID) and bucketExpression, valueExpression will point to the new fields.

Resources