<commit_before>Curiosity.directive('barchart', function($rootScope){
	// Runs during compile
	return {
		restrict :'A',
		
		scope: {
			datax :"=",
			datay :"=",
			pathx: "=",
			pathy: "=",
		},		
		
		link: function($scope, elem, iAttrs) {
			if (typeof ($scope.datay) === "undefined") {
				$scope.datay = $scope.datax
			} 			

			var data = builtAllSeries($scope.datax, $scope.pathx, $scope.datay, $scope.pathy); 
			var w = $(elem).width()
			var h = w*2/3
			console.log('elem.load',w,h)
			var chart = nv.models.multiBarChart()
							.width(w)
							.height(h)
							.margin({top:20,right:30,bottom:50,left:30})

			nv.utils.windowResize(chart.update)

			d3.select(elem[0])
				.append('svg')
				.attr('width',w)
				.attr('height',h)
				.style('width',w)
				.style('height',h)
				.attr('class','barchart')
				.datum(data)
				.call(chart)			

			function getData(dataSet, path, num) {
				var i = 0;
				while (i < path.length) {		
					if (typeof dataSet[path[i]] === "undefined")
						return (null);
					dataSet = dataSet[path[i]];
					i++;
				}
				if (num) {
					return (parseFloat(dataSet)); 
				}
				return (dataSet);
			}

			function builtSerie(datax, pathx, datay, pathy) {
				var res = {};<commit_msg>update charts<commit_after>Curiosity.directive('barchart', function($rootScope){
	// Runs during compile
	return {
		restrict :'A',
		
		scope: {
			datax :"=",
			datay :"=",
			pathx: "=",
			pathy: "=",
		},		
		
		link: function($scope, elem, iAttrs) {
			if (typeof ($scope.datay) === "undefined") {
				$scope.datay = $scope.datax
			} 			

			var data = builtAllSeries($scope.datax, $scope.pathx, $scope.datay, $scope.pathy); 
			var w = $(elem).width()
			var h = w*2/3
			console.log('elem.load',w,h)
			var chart = nv.models.multiBarChart()
							.width(w)
							.height(h)
							.margin({top:20,right:30,bottom:50,left:30})

			nv.utils.windowResize(chart.update)
			
			$rootScope.$on("QueryLaunched", function() {
				data = builtAllSeries($scope.datax, $scope.pathx, $scope.datay, $scope.pathy);
			
			});

			d3.select(elem[0])
				.append('svg')
				.attr('width',w)
				.attr('height',h)
				.style('width',w)
				.style('height',h)
				.attr('class','barchart')
				.datum(data)
				.call(chart)			

			function getData(dataSet, path, num) {
				var i = 0;
				while (i < path.length) {		
					if (typeof dataSet[path[i]] === "undefined")
						return (null);
					dataSet = dataSet[path[i]];
					i++;
				}
				if (num) {
					return (parseFloat(dataSet)); 
				}
				return (dataSet);
			}

			function builtSerie(datax, pathx, datay, pathy) {
				var res = {};
{'fraction_non_alphanumeric': 0.19040365575019041, 'fraction_numerical': 0.009900990099009901, 'mean_word_length': 2.6947960618846696, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3503080', 'n_tokens_mistral': 1299, 'n_tokens_neox': 993, 'n_words': 176}