Skip to Content
0
Jan 30, 2017 at 12:04 PM

Custom label in VixFrame scatter chat

59 Views

Hello Experts,

We are trying to bring in custom labels in the chart. Below is the actual code that we are using. Can you please let us know what is that we are missing? Please note that the "riskOfLoss" field is not a numeric field.

var oNewEmployee = [{
	defaultFullName: "Thanu Krishnan",
	userId: "001",
	position: "1",
	riskOfLoss: "G2",
	username: "AAAA",
	manager: "Marcus",
	matrixManager: "Niki"
}, {
	defaultFullName: "Paul",
	userId: "002",
	position: "2",
	riskOfLoss: "G1",
	username: "AAAA",
	manager: "Marcus",
	matrixManager: "Niki"
}, {
	defaultFullName: "Biju",
	userId: "003",
	position: "3",
	riskOfLoss: "G4",
	username: "AAAA",
	manager: "Marcus",
	matrixManager: "Niki"
}];

var oJSONModel = new sap.ui.model.json.JSONModel();
oJSONModel.setProperty("/employees", oNewEmployee);
this.getView().setModel(oJSONModel, "ppModel");

var oVizFrame = this.getView().byId("idcolumn");
var oPopOver = this.getView().byId("idPopOver");

var dataset = new sap.viz.ui5.data.FlattenedDataset({
	dimension: [{
		axis: 1,
		name: 'User',
		value: "{defaultFullName}"
	}],
	measures: [{
		group: 1,
		name: 'PotentialCat',
		value: '{riskOfLoss}'
	}, {
		group: 2,
		name: 'Level',
		value: '{position}'
	}],
	data: {
		path: "/employees"
	}
});

oVizFrame.setDataset(dataset);
oVizFrame.setModel(oJSONModel);
oVizFrame.setVizType('scatter');

var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
		'uid': "valueAxis",
		'type': "Measure",
		'values': ["Level"]
	}),
	feedValueAxis2 = new sap.viz.ui5.controls.common.feeds.FeedItem({
		'uid': "valueAxis2",
		'type': "Measure",
		'values': ["PotentialCat"]
	}),
	feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
		'uid': "categoryAxis",
		'type': "Dimension",
		'values': ["User"]
	}),
	feedColor = new sap.viz.ui5.controls.common.feeds.FeedItem({
		'uid': "color",
		'type': "Dimension",
		'values': ["User"]
	});

oVizFrame.addFeed(feedValueAxis);
oVizFrame.addFeed(feedValueAxis2);
oVizFrame.addFeed(feedCategoryAxis);
oVizFrame.addFeed(feedColor);

oVizFrame.setVizProperties({
	plotArea: {
		markerSize: 32,
		colorPalette: d3.scale.category20().range()
	}
});
oPopOver.connect(oVizFrame.getVizUid());