cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to update date range of i5Chart

Former Member
0 Kudos

Hi,

See the following code. Anyone have an idea why the i5Chart is not updating?

//================================================

//selDate contains the timestamp of a selected data point

var sDate=document.SMXbar.dateAdd(selDate, "MM/dd/yyyy HH:mm:ss", "", -3600);

var eDate=document.SMXbar.dateAdd(selDate, "MM/dd/yyyy HH:mm:ss", "", 3600)

//This iChart Applet works fine

  1. document.PITagiChart.getQueryObject().setStartDate(sDate);
  2. document.PITagiChart.getQueryObject().setEndDate(eDate);
  3. document.PITagiChart.updateChart(true);

//This i5Chart does not update; no errors are thrown

//The alert() contents return valid data

var qObj=PITagi5Chart.getQueryObject();

alert(qObj.getStartDate() + " to " + qObj.getEndDate());

  1. qObj.setStartDate(sDate);
  2. qObj.setEndDate(eDate);

alert(qObj.getStartDate() + " to " + qObj.getEndDate());

//alert(qObj.isTimeBasedQuery());

PITagi5Chart.update(true); //Nothing happens here

//==============================================

A couple of additional comments..

V15 SP3 Patch 7.  NW 7.4. Java 6 u45.  IE11.

The i5Chart’s time control bar contains blanks for the dates and NaN:NaN:NaN for the times.  Saw mention of this in earlier threads – supposed to have been fixed in v14?

If I manually set the date & times, I can manipulate the chart range using the control slider and buttons. 

Thanks in advance for any direction...

Paul

Accepted Solutions (0)

Answers (1)

Answers (1)

saivellanki
Active Contributor
0 Kudos

Hi Paul,

I guess after you do PITagi5Chart..update(true); you have to use draw method to reflect changes on your chart.

Try this -


PITagi5Chart.update(true);

PITagi5Chart.draw("div1"); //you have to change to chart div id that you're using already

Regards,

Sai Vellanki.

Former Member
0 Kudos

Thanks for your response, Sai.

That didn't work.  Other ideas?

The initial data set loads fine and I am able to manipulate using the time control bar.

Private_Member_14935
Active Participant
0 Kudos

Hi Paul,

As far as I understand the query, you have a chart and want to update it based on a user input Start and End Date on some action (button click).

function applyDates() {

     var qObj=PITagi5Chart.getQueryObject();

       qObj.setStartDate(sDate);

     qObj.setEndDate(eDate);

     PITagi5Chart.update(true);

}

The above code should refresh the chart with data for the applied date range. I believe this is what you are also trying and I don't see reasons for the code to not work.

Can you please post the code snippet or scenario you are trying.. may be your html page, so that we can have a further look and get back with solutions.

Also please do mention the SAP UI5 version.

Thanks and Best Regards,

Ria

Former Member
0 Kudos

Just realized that I'm not able to update the date ranges via code only if the start and end dates are set within the chart template. If I clear the dates within the template, the code works fine.

Sounds like a bug.. 

UI5 version 1.22.2.