ChartNew.js
function reverseData(data) {
		data.labels = data.labels.reverse();
		for (var i = 0; i < data.datasets.length; i++) {
			for (var key in data.datasets[i]) {
				if (Array.isArray(data.datasets[i][key])) {
					data.datasets[i][key] = data.datasets[i][key].reverse();
				}
			}
		}
		return data;
	}
function reverseData(data) {
		data.labels = data.labels.reverse();
		for (var i = 0; i < data.datasets.length; i++) {
			for (var key in data.datasets[i]) {
				if (Array.isArray(data.datasets[i][key])) {
					data.datasets[i][key] = data.datasets[i][key].reverse();
				}
			}
		}
		return data;
	}
function reverseData ( data ) { data . labels = data . labels . reverse ( ) ; for ( var i = 0 ; i < data . datasets . length ; i ++ ) { for ( var key in data . datasets [ i ] ) { if ( Array . isArray ( data . datasets [ i ] [ key ] ) ) { data . datasets [ i ] [ key ] = data . datasets [ i ] [ key ] . reverse ( ) ; } } } return data ; }
Reverse the data structure for horizontal charts
- reverse labels and every array inside datasets
@param {object} data datasets and labels for the chart
@return return the reversed data
Reverse the data structure for horizontal charts - reverse labels and every array inside datasets