cancel
Showing results for 
Search instead for 
Did you mean: 

Specify intervals in Charts (vizFrame)

Former Member
0 Kudos

Hello everybody!

I am developing a Scatter graphic with the vizFrame framework. The x-axis represents an integer value and the y-axis... well it doesn't matter. i want that the x-axis starts in 0 and the interval grows from 1 to 1 (or other number, 5 or 10) BUT I don't want that reals numbers appears. I tried to do a lot of things but I could not make it. Here is the code:

sap.ui.jsview("views.Scatter", {
	
	createContent : function(oController) {

	       var data =[{"country": "United States", "population":"36.72","revenue":2,"profit":"23.98"}];


		var oModel = new sap.ui.model.json.JSONModel();
		oModel.setData({
			businessData : data
		});
		
		sap.ui.getCore().setModel(oModel, "oModel");
		var mainScatterChart = new sap.viz.ui5.controls.VizFrame({
				vizType : "scatter",
				width : "100%",
				height : "400px"
			});
			
		var dataset = new sap.viz.ui5.data.FlattenedDataset({
			dimensions : [ {
				name : "ctr",
				value : "{country}"
			} ],
	
			measures : [ {
				name : "rev",
				value : "{revenue}"
			}, {
				name : "prof",
				value : "{profit}"
			}],
	
			data : {
				path : "oModel>/businessData",
			}
		});


		var feedValueAxis1 = new sap.viz.ui5.controls.common.feeds.FeedItem({
			'uid' : "valueAxis",
			'type' : "Measure",
			'values' : ["rev"]
		});
		var feedValueAxis2 = new sap.viz.ui5.controls.common.feeds.FeedItem({
			'uid' : "valueAxis2",
			'type' : "Measure",
			'values': ["prof"]
		});	
		var feedColor = new sap.viz.ui5.controls.common.feeds.FeedItem(	{
			'uid' : "color",
			'type' : "Dimension",
			'values' : ["ctr"]
		});
		
		
		mainScatterChart.setVizProperties({
			plotArea : {
				dataLabel : {
					visible : true
				},
				drawingEffect: "glossy"
				//adjustScale: true //it doesn't work neither because the real numbers still appears
                                //primaryScale:{fixedRange: true, minValue: 0 }, it doesn't work neither I think it belongs to a previous version
			},
			valueAxis : {
				title : {
					visible : true
				}				
			},
			categoryAxis : {
				title : {
					visible : true
				}
			},
			title : {
				visible : true,
				text : 'Test Scatter'
			}			
		});
		
		
		mainScatterChart.setDataset(dataset);
		mainScatterChart.addFeed(feedValueAxis1);
		mainScatterChart.addFeed(feedValueAxis2);
		mainScatterChart.addFeed(feedColor);
		mainScatterChart.setVizScales([{
		     	'feed' : 'color', 
		     	'palette': ['#ff0000', '#000066', '#ffff00', '#f0ff00', '#f00f00', '#0fff00']
			},{
				'feed' : 'shape', 
				'palette': ["diamond"]
			}]);
		return mainScatterChart;
	}
});

The result of this code:

I also read that you can add "valueAxis" into the vizScale Property (vizFrame Scatter Scales)... but, which are the values admitted to type? is theis propertie related with what I want? The documentation says: "defaultValue":"linear", and nothing more...

mainScatterChart.setVizScales([{
		     	'feed' : 'color', 
		     	'palette': ['#ff0000', '#000066', '#ffff00', '#f0ff00', '#f00f00', '#0fff00']
			},{
				'feed' : 'shape', 
				'palette': ["cross"]
			},{
			feed: "valueAxis",
			min: 0,
			max: null,
                        type: ????
		}

Thanks in advance for your time 🙂

Marcos.

Accepted Solutions (0)

Answers (0)