<commit_before>function convertToDate(timeStamp) {
		var ts = String(timeStamp);
		// Format: YYYY-MM-DD HH:MM:SS
		var string_split = ts.split(" ");
		var date_part = string_split[0].split("-");
		var time_part = string_split[1].split(":");
		return new Date(date_part[0], date_part[1], date_part[2], time_part[0], time_part[1], time_part[2]);
}

function drawLine(chartJSONData) {
		console.log("Drawing a chart with data:")
		console.log(chartJSONData);

		google.charts.load('current', {packages: ['corechart', 'line'], 'callback': function() {
		var data = new google.visualization.DataTable();

		convertedData = [];
		$.each(chartJSONData, function( index, value ) {
				convertedData.push([convertToDate(value[0]), value[1]]);
		});
		console.log(convertedData);

		data.addColumn('date', 'timestamps');
		data.addColumn('number', 'viewers');
		data.addRows(convertedData);
		data.sort([{column: 1}]);

		var options = {
			  hAxis: {
			     title: 'Time'
			  },
			  vAxis: {
			      title: 'Popularity'
			  }
		};

		var chart = new google.visualization.LineChart(document.getElementById('ED-average-viewers-graph'));

		chart.draw(data, options);
		}
		});
}

function drawCharts(streamerName) {
		console.log("Drawing charts");
		$.ajax({
        url: "/api/v1/streamer/" + streamerName,
        success: function(receivedData) {
            jsonData = JSON.parse(receivedData);
            drawLine(jsonData['ED']['viewers_average']);
			  }
    });
}
<commit_msg>Fix sorting and axes titles<commit_after>function convertToDate(timeStamp) {
		var ts = String(timeStamp);
		// Format: YYYY-MM-DD HH:MM:SS
		var string_split = ts.split(" ");
		var date_part = string_split[0].split("-");
		var time_part = string_split[1].split(":");
		return new Date(date_part[0], date_part[1], date_part[2], time_part[0], time_part[1], time_part[2]);
}

function drawLine(chartJSONData) {
		console.log("Drawing a chart with data:")
		console.log(chartJSONData);

		google.charts.load('current', {packages: ['corechart', 'line'], 'callback': function() {
		var data = new google.visualization.DataTable();

		convertedData = [];
		$.each(chartJSONData, function( index, value ) {
				convertedData.push([convertToDate(value[0]), value[1]]);
		});
		console.log(convertedData);

		data.addColumn('date', 'timestamps');
		data.addColumn('number', 'viewers');
		data.addRows(convertedData);
		data.sort([{column: 0}, {column: 1}]);

		var options = {
			  hAxis: {
			     title: 'Stream Times'
			  },
			  vAxis: {
			      title: 'Average Viewers'
			  }
		};

		var chart = new google.visualization.LineChart(document.getElementById('ED-average-viewers-graph'));

		chart.draw(data, options);
		}
		});
}

function drawCharts(streamerName) {
		console.log("Drawing charts");
		$.ajax({
        url: "/api/v1/streamer/" + streamerName,
        success: function(receivedData) {
            jsonData = JSON.parse(receivedData);
            drawLine(jsonData['ED']['viewers_average']);
			  }
    });
}

{'fraction_non_alphanumeric': 0.1725516322451699, 'fraction_numerical': 0.008327781479013991, 'mean_word_length': 3.8670988654781198, 'pattern_counts': {'":': 2, '<': 3, '<?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': '3188826', 'n_tokens_mistral': 1133, 'n_tokens_neox': 998, 'n_words': 178}