Skip to Content
0
Jun 06, 2018 at 05:59 PM

VizFrame Stacked Column: How I do change the legend display name?

622 Views Last edit Jun 06, 2018 at 06:13 PM 2 rev

I want to change the text of the legend (red square).

For example I want that legend says "Residuos" instead of "crResiduos".

This is the view

getChartAcompaniamiento: function() {


		var oVIZFrame = new sap.viz.ui5.controls.VizFrame({
			vizType: "stacked_column",
			id: this.createId("chartAcompaniamiento"),
			width: "100%"
		});


		oVIZFrame.setVizProperties({
			dataLabel: {
				visible: true
			},
			tooltip: {
				visible: true
			},
			title: {
				text: "Acompañamiento"
			}
		});


		return oVIZFrame;
	}

This is the controller

getChartAcompaniamiento: function() {
			var oVizFrame = this.getView().byId("chartAcompaniamiento");


			var aAcompaniamientoData = [{
				"rol": "Llamadas",
				"referentes": "4",
				"reconocimiento": "7",
				"crResiduos": "3",
				"comSustentable": "7",
				"alumnosEnEco": "6",
				"accionPorElClima": "1"
			}, {
				"rol": "Visitas",
				"referentes": "8",
				"reconocimiento": "1",
				"crResiduos": "4",
				"comSustentable": "4",
				"alumnosEnEco": "1",
				"accionPorElClima": "3"
			}];


			var oModel = new sap.ui.model.json.JSONModel();


			oModel.setData({
				"items": aAcompaniamientoData
			});


			oVizFrame.setModel(oModel);
			var oDataset = new sap.viz.ui5.data.FlattenedDataset({
				dimensions: [{
					name: "rol",
					value: "{rol}"
				}],
				measures: [{
					name: "referentes",
					value: "{referentes}"
				}, {
					name: "reconocimiento",
					value: "{reconocimiento}"
				}, {
					name: "crResiduos",
					value: "{crResiduos}"
				}, {
					name: "comSustentable",
					value: "{comSustentable}"
				}, {
					name: "alumnosEnEco",
					value: "{alumnosEnEco}"
				}, {
					name: "accionPorElClima",
					value: "{accionPorElClima}"
				}],


				data: {
					path: "/items"
				}
			});
			oVizFrame.setDataset(oDataset);


			var oFeedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
					"uid": "valueAxis",
					"type": "Measure",
					"values": ["referentes"]
				}),
				oFeedValueAxis1 = new sap.viz.ui5.controls.common.feeds.FeedItem({
					"uid": "valueAxis",
					"type": "Measure",
					"values": ["reconocimiento"]
				}),
				oFeedValueAxis2 = new sap.viz.ui5.controls.common.feeds.FeedItem({
					"uid": "valueAxis",
					"type": "Measure",
					"values": ["crResiduos"]
				}),
				oFeedValueAxis3 = new sap.viz.ui5.controls.common.feeds.FeedItem({
					"uid": "valueAxis",
					"type": "Measure",
					"values": ["comSustentable"]
				}),
				oFeedValueAxis4 = new sap.viz.ui5.controls.common.feeds.FeedItem({
					"uid": "valueAxis",
					"type": "Measure",
					"values": ["alumnosEnEco"]
				}),
				oFeedValueAxis5 = new sap.viz.ui5.controls.common.feeds.FeedItem({
					"uid": "valueAxis",
					"type": "Measure",
					"values": ["accionPorElClima"]
				}),


				oFeedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
					"uid": "categoryAxis",
					"type": "Dimension",
					"values": ["rol"]
				});


			oVizFrame.addFeed(oFeedValueAxis);
			oVizFrame.addFeed(oFeedValueAxis1);
			oVizFrame.addFeed(oFeedValueAxis2);
			oVizFrame.addFeed(oFeedValueAxis3);
			oVizFrame.addFeed(oFeedValueAxis4);
			oVizFrame.addFeed(oFeedValueAxis5);


			oVizFrame.addFeed(oFeedCategoryAxis);
		}

Attachments

ff.png (19.1 kB)