Skip to Content
-1
Jun 04, 2019 at 06:24 AM

How can i add click event for Column chart in javascript view

60 Views

Hello bloggers,

I can try to add Click event in my column chart on javascript view....i can face some error issue...how can i solve this issue...Please support me..Here i describe my coding....

onSelectZone : function(evt) {
var that = this;
that.zone = evt.getParameters().data['0'].data["Zzone"];

var State = that.TestOmodel
+ "KPISet?$filter=FsYear eq '" + that.oFsYear
+ "' and MonthFrom eq '" + that.oMonthKey
+ "' and MonthTo eq  '" + that.oMonthTo
+ "' and Usrid eq  ' ' and Division eq  '"
+ that.oSelectDiv + "' and Loc eq  '"
+ that.RadioLocation + "' and Prd eq  '"
+ that.RadioProduction
+ "' and MatGrp eq  ' ' and Zone eq  '"
+ that.zone
+ "' and State eq  ' ' and Soffc eq  ' '";
OData
.read(
State,
function(oResponse) {
var oModel = new sap.ui.model.json.JSONModel(
oResponse);
that.oView.setModel(oModel,
"StateModel");
that.getView().byId("State")
.setEnabled(true);
that.getView().byId("GoZzone")
.setVisible(true);
that.getView().byId("BackButt")
.setVisible(false);
if (that.Pop === undefined) {
that.Pop = new sap.viz.ui5.controls.Popover(
"idPop1");
that.oViz = new sap.viz.ui5.controls.VizFrame(
"idFrame1");
var oDataset = new sap.viz.ui5.data.FlattenedDataset(
{

dimensions : [ {
name : 'Area',
value : "{StateModel>Area}"
} ],
measures : [
{
name : 'Achievement',
value : "{StateModel>Achievement}"
},
{
name : 'Target',
value : "{StateModel>Target}"
} ],
data : {
path : "StateModel>/results",
}

});
var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem(
{
'uid' : "primaryValues",
'type' : "Measure",
'values' : [ "Achievement" ]
}), feedValueAxis1 = new sap.viz.ui5.controls.common.feeds.FeedItem(
{
'uid' : "primaryValues",
'type' : "Measure",
'values' : [ "Target" ]
}), feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem(
{
'uid' : "axisLabels",
'type' : "Dimension",
'values' : [ "Area" ],
});
that.oViz.setDataset(oDataset);
that.oViz.setModel(oModel);
if (sap.ui.Device.system.desktop) {
that.oViz
.setVizProperties({
interaction : {
behaviorType : null,
uiConfig:"{applicationSet:'fiori'}",
height:'100%',
width:"100%",
selectability : {
mode : 'None'
}
}
});
}
that.oViz
.setVizProperties({
title : {
visible : false,
text : [ "{localModel>Zzone}" ]
},
valueAxis : {
label : {
formatString : null,
visible : true
},
title : {
visible : true
}
},
general : {
background : {
drawingEffect : 'normal',
color : '#ffffff'
}
}, 
tooltip : {
visible : false
},
legend : {
visible : false
}
});
that.oViz.removeAllFeeds();
that.oViz
.addFeed(feedValueAxis);
that.oViz
.addFeed(feedValueAxis1);
that.oViz
.addFeed(feedCategoryAxis);
that.oViz.setVizType("column");
that.oViz.setWidth("1440px");
that.oViz.setHeight("564px");
that.Pop.connect(that.oViz
.getVizUid());
that.getView().byId(
"idVizFrame")
.setVisible(false);
that.getView().byId(
"settingsPanel")
.addContent(that.oViz);

} else {
that.oViz
.getModel("StateModel")
.updateBindings();
that.getView().byId(
"idVizFrame")
.setVisible(false);
that.oViz.setVisible(true);
}
console.log(oModel);
}, function(err) {
});
},