cancel
Showing results for 
Search instead for 
Did you mean: 

Select SAPUI5 VizFrame Chart Datapoints From Controller Code

Former Member
0 Kudos

I am trying to pre-select a set of data-points in a vizframe column chart once its rendered. I am trying out the fireSelectData method to specify a set of datapoints to be selected. Below is the controller code:

onRender365DaysChartData: function (oEvent) {


  //get the reference to the vizframe
  var oVizFrameYearly = this.getView().byId("idVizFrame365DaysChart");


  var oDataSelect = [{
    data: {
      Month: "Oct 16",
      Day: 13,
      Value: 441
    }
  }];


  oVizFrameYearly.fireSelectData(oDataSelect);


},
onSelect365DaysChartData: function (oEvent) {


  var viz365ChartDataPreviousSelectionModel = new sap.ui.model.json.JSONModel(oEvent.getParameter('data'));


  sap.ui.getCore().setModel(viz365ChartDataPreviousSelectionModel, "viz365ChartDataPreviousSelectionModel");


}

The fireSelectData method is triggering the selectData event of the chart, however oEvent.getParameter('data') in the selectData event handler is returning null. Also the data-points are not styled as selected on the web page.

I am not sure if I am going in the right direction. Is there a way in which we can achieve this manual selection of data-points?

Thanks for any sort of help in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member196805
Contributor

My understanding is that selectData/deselectData is aimed for data point selection performed after chart rendering complete. Try use vizSelection event if you wish to do selection during the initialization:

oVizFrame.attachRenderComplete(function(){
  oVizFrame.vizSelection([
    {data:{Month: "Oct 16", Day: 13, Value: 441}}
  ])
})