cancel
Showing results for 
Search instead for 
Did you mean: 

Use of Date in UI5 Column chart

Former Member
0 Kudos

Hi,

I am currently doing a UI5 project with SAP gateway as the service provider. As per the documentation, for the axis definition, the value can be "any". However, on providing the same date some from Gateway Service ie EDM.DateTime, it fails to show any value.

Here is the code

              var oDataset = new sap.viz.ui5.data.FlattenedDataset({

                     dimensions : [ {

                           axis : 1,

                           name : 'DATE',

                           value : "{Date}" }

Even tried 

value : { path: 'Date', type: new sap.ui.model.type.Date() }

Still it shows "no value" for the X Axis.

Has anyone come across any such issue?

Thanks,

Jayant

Accepted Solutions (1)

Accepted Solutions (1)

former_member182048
Active Contributor
0 Kudos

Hi Kumar & co

Datajs converts EDM.datetime to a javascript Date object.

eg today = 'Thu Apr 25 2013 14:06:55 GMT+1000 (AUS Eastern Standard Time)'

To make the date object user friendly you use a formatter function.

value :  {

     path: "bestBefore",

     formatter: function(fValue) {

           jQuery.sap.require("sap.ui.core.format.DateFormat");

           var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern: "yyyy-MM-dd"});

           return oDateFormat.format(new Date(fValue));

     }

}

using that formatter today = '2013-04-25', use whatever pattern is required.

hth

John P

Answers (2)

Answers (2)

RenaldWittwer
Contributor
0 Kudos

Hi Kumar,

did you solve the problem? I am fighting with the same question.

I try to create a chart with a timeline on one axis.

Thanks!

Best regards

Renald

Former Member
0 Kudos

Hey!

I have the same problem and a solution would be great!

Best regards,

Manu

konstantin_anikeev
Active Contributor
0 Kudos

Hi Kumar,

how is you Model looks like?

Is it possible, that you have "Date" or "date" or even "DATE"...

Best Regards

Konstantin

Former Member
0 Kudos

Hi Konstantin,

I am dure the Model is OK. The Property is 'Date'.It works fine with the table as can be seen in the initial post.

I could see one of your posts showing a graph with Dates. If that graph is using a Gatewqy service, then it could be a good check.

Look at the "Dumps" graph.

Thanks,

Jayant

konstantin_anikeev
Active Contributor
0 Kudos

Hi Kumar,

unfortunatelly not your case.

I convert dates on server side and send strings...

Best Regards

Konstantin