Skip to Content

XML Fragment: Problem with formatter for BarChart [Float required]

Hi UI5 experts,

I'm struggling now for a long time building an UI5 app with bar charts. The formatter assignment in the XML fragment crashes (UI5 application hangs). The chrome debugger shows "string existing, float required".

I searched now for a long time SCN and Stackoverflow.

My project has following structure.

App -> controller

App -> view

App -> util -> formatter.js

UI5 Worklist -> jump to detail -> "Object.js" is the view controller for view "Object.view.xml".


sap.ui.define([ "ns/controller/BaseController", "sap/ui/model/json/JSONModel", "sap/ui/core/routing/History", "ns/util/formatter" ],

function ( BaseController, JSONModel, History, formatter ) { "use strict"; return BaseController.extend("vjtf.controller.Object",{

formatter: formatter,


My XML view embedds the XML fragment as follows:


<core:Fragment id="Time" fragmentName="ns.view.Time" type="XML" /> </content>



sap.ui.define([], function() { "use strict"; return {

getFloat: function(sValue) {

var oNumberFormat = sap.ui.core.format.NumberFormat.getFloatInstance({ maxFractionDigits: 2, groupingEnabled: true, groupingSeparator: ",", decimalSeparator: "." }); return oNumberFormat.parse(sValue); },


In the fragment i want to use the BarChart:
TimeSecMin = String with e.g. "34.00", contains data because label to BarChart is showing value !

<BulletMicroChartData value="{path: 'TimeSecMin', formatter : '.formatter.getFloat'}" color="Error"/>

!!! --- !!!

Indipending from which UI5 control I use, InteractiveBarChart, Bullet, what else, my formatter is not working or not called correctly. I think my dependency formulation is correct.

!!! --- !!!

All SCN entries describe the above way to use a formatter in an XML fragment.

My fragment is not instanciated programmatically ! So I'm not able to deliver "this" as the controller object into the XML fragment, where I want to use the formatter.

1.) Does anybody see a problem in my code approach?
2.) Does anybody has a reference code for an XML fragment - not instanciated by program - only embed into / called from the main view as I did - using a Chart with float variable?

Thanks in advance
Klaus Wegener

Add comment
10|10000 characters needed characters exceeded

0 Answers