Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8150

How to make UI5 Bar Chart treat string like "20140402" as Date type

$
0
0

Hi Experts:

      I want to create a Bar chart with the X axis is Date type. The data from my model is like "20140321" and the Bar will treat this data as INT on X axis. How can I make the Bar to display my data as Date? The following is my code:

==================================================

Header 1
var oData = { "quarter_info": [{"start_ags":"20140321", "end_ags":"20140603", "start_it":"20140402", "end_it":"20140702"}] };
var oModel = sap.ui.model.json.JSONModel();
oModel.setData(oData);
var oDataset = new sap.viz.ui5.data.FlattenedDataset("chartDataset",{
dimensions : [
{
axis : 1, // must be one for the x-axis, 2 for y-axis
name : 'AGS and IT',
}
],
measures : [
{
name : 'AGS',
value : "{start_ags}" 
},
{
name : 'IT',
value : '{end_ags}'
}
],
data : {
path : "/quarter_info",
type: new sap.ui.model.type.Date({source:{pattern:"yyyyMMdd"}, pattern:"yyyy-MM-dd"})
}
});

 

 

    // create a Bar chart 
var oBarChart = new sap.viz.ui5.Bar({
width : "80%",
height : "400px",
dataset : oDataset
});

 

 

oBarChart.setModel(oModel);
oBarChart.placeAt("content");
==================================================

Viewing all articles
Browse latest Browse all 8150

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>