<commit_before>//
// garden.js
// <NAME>
//
// Draws garden charts
//
// 


//-------------------------------------------------------------------------------
// Draws garden data 
//-------------------------------------------------------------------------------
function displayGarden() {

	// Highlights correct navbar location
	$('li').removeClass('active');
	$('#garden').parent().addClass('active');

	$('#sidebar').hide();
	// $('#sidebar').animate({width: 'toggle'});
	$('#main').removeClass('col-sm-10').addClass('col-sm-12');

	// Clear chart area
	$('#graph-container').empty();
	$('#graph-container').css('overflowY', 'hidden');

    // Set up chart screen sections
    $('<div class="row"><div id="chart-section" style="margin: 1vh; padding-right: 1.2vh;"></div></div>').appendTo('#graph-container');

    getFileData('garden_data/gardening_web.json', 'json', drawGardenChart, []);

}


//-------------------------------------------------------------------------------
// Draw garden search bar
//-------------------------------------------------------------------------------
function minimumSearchBar(garden_data) {


	// Prepare date list
   	var year_list = [];
    for (var note in garden_data.notes) {
    	var year = new Date(Number(garden_data.notes[note]['created'])).getFullYear().toString();
    	if ($.inArray(year, year_list) == -1) {
     		year_list.push(year);
    	}
    }

	var search_data = {
		"plant": 	Object.keys(garden_data.plant_tags),
		"location": Object.keys(garden_data.location_tags), 
		"year": 	year_list,
		"alive": 	"unchecked",
		"watering": "unchecked"
	}


    var sorted_data = sortGardenData(garden_data, search_data);

    getFileData('garden_data/state_tags.json', 'json', drawGardenChart, [sorted_data, garden_data]);


}

//-------------------------------------------------------------------------------
// Draw charts
//-------------------------------------------------------------------------------
function drawGardenChart(notes_to_display) {


	// Colors based on google's material design palette
	// https://material.google.com/style/color.html#color-color-palette
	var colors = {
		"light_purple": "#E1BEE7", 
		"purple": "#C1A5E1", 
		"red": "#EF5350", 
		"lgreen": "#C5E1A5",
		"green": "#7CB342",
		"yellow": "#FFF176",
		"brown": "#CE8544",
		"orange": "#FFB74D",
		"darker_blue": "#95CAFD",
		"dark_blue": "#BDDEFE",
		"blue": "#E5F2FF",
		"grey": "#E0E0E0",
		"teal": "#009688",
		"lime": "#CDDC39",
		"ldeep_orange": "#FFAB91",
		"deep_orange": "#FF5722",
		"blue_grey": "#607D8B",
		"cyan": "#00BCD4",
		"pink": "#E91E63",
		"lpink": "#F48FB1",
		"indigo": "#3F51B5",
		"amber": "#FFC107"

	}

	var location_colors = {
		"1c5facd7-7bbd-4b97-8af2-a46a522e2ba7": "cyan", 
		"5fad5a58-d839-4da7-a23b-eec95fae4ad4": "lime", 
		"326b7a7c-4298-4e08-9330-199a4b9ddff3": "indigo",
		"21305133-7020-4c0c-8a4e-a4b11b37eb4f": "deep_orange",
		"52c6eaac-26b4-4479-827f-6df0bd728226": "pink",
		"f03fa0eb-a5ec-4ab0-b87d-6eedffd10d92": "purple",
		"89e011c2-8a63-4a5c-be18-f8fe6b5e5e19": "blue_grey",
		"0fd778c4-b5ee-4c5a-849f-776dbd99dc21": "teal",
		"ff340368-9f93-432e-8495-9dc9f2269212": "amber"
	}


	console.time("sort_data");

	var HTMLtable = '<div class="table-responsive"><table id="diary" class="table table-condensed" cellspacing="0">';
	HTMLtable += '<thead><tr bgcolor="#E0E0E0"><th colspan="4" style="text-align:right">Month</th><th style="text-align:center" ';
	HTMLtable += ['colspan="5">Jan','colspan="3">Feb','colspan="5">Mar','colspan="4">Apr','colspan="4">May','colspan="4">Jun','colspan="5">Jul','colspan="5">Aug','colspan="4">Sep','colspan="5">Oct','colspan="4">Nov','colspan="5">Dec'].join('</th><th style="text-align:center" ');
	HTMLtable += '</th></tr>';
	HTMLtable += '<tr bgcolor="#E0E0E0"><th colspan="4" style="text-align:right">Week Number</th>%week_no%</tr>';
	HTMLtable += '<tr bgcolor="#E0E0E0"><th>Plant Name</th><th>No.</th><th>Location</th><th>Year</th>%avg_temps%</tr></thead>';
	HTMLtable += '<tbody id="plant-table">%plants%</tbody></table></div>';

	var HTML_cell 			= '<td %cell_colour% %border% nowrap>%cell_contents%</td>'
	var HTML_cell_content 	= '<div style="cursor:pointer" data-toggle="popover" data-trigger="focus" data-placement="bottom" data-html="true" title="<b>%popover_title%</b>" data-content="<dl>%popover_body%</dl>">%symbol%</div>';
	var HTML_loc_popover 	= '<a href="#" style="cursor:pointer" data-toggle="popover" data-trigger="focus" data-placement="bottom" data-html="true" title="<b>Location Color Key</b>" data-content="<dl>%popover_body%</dl>">KEY</a>';
	var HTML_popover_img 	= "<img src='%res_link%' width='200' />";
	var HTML_popover_link 	= "<dd><a href='%url%'>• %link_text%</a></dd>";
<commit_msg>Disable wrapping in cells<commit_after>//
// garden.js
// <NAME>
//
// Draws garden charts
//
// 


//-------------------------------------------------------------------------------
// Draws garden data 
//-------------------------------------------------------------------------------
function displayGarden() {

	// Highlights correct navbar location
	$('li').removeClass('active');
	$('#garden').parent().addClass('active');

	$('#sidebar').hide();
	// $('#sidebar').animate({width: 'toggle'});
	$('#main').removeClass('col-sm-10').addClass('col-sm-12');

	// Clear chart area
	$('#graph-container').empty();
	$('#graph-container').css('overflowY', 'hidden');

    // Set up chart screen sections
    $('<div class="row"><div id="chart-section" style="margin: 1vh; padding-right: 1.2vh;"></div></div>').appendTo('#graph-container');

    getFileData('garden_data/gardening_web.json', 'json', drawGardenChart, []);

}


//-------------------------------------------------------------------------------
// Draw garden search bar
//-------------------------------------------------------------------------------
function minimumSearchBar(garden_data) {


	// Prepare date list
   	var year_list = [];
    for (var note in garden_data.notes) {
    	var year = new Date(Number(garden_data.notes[note]['created'])).getFullYear().toString();
    	if ($.inArray(year, year_list) == -1) {
     		year_list.push(year);
    	}
    }

	var search_data = {
		"plant": 	Object.keys(garden_data.plant_tags),
		"location": Object.keys(garden_data.location_tags), 
		"year": 	year_list,
		"alive": 	"unchecked",
		"watering": "unchecked"
	}


    var sorted_data = sortGardenData(garden_data, search_data);

    getFileData('garden_data/state_tags.json', 'json', drawGardenChart, [sorted_data, garden_data]);


}

//-------------------------------------------------------------------------------
// Draw charts
//-------------------------------------------------------------------------------
function drawGardenChart(notes_to_display) {


	// Colors based on google's material design palette
	// https://material.google.com/style/color.html#color-color-palette
	var colors = {
		"light_purple": "#E1BEE7", 
		"purple": "#C1A5E1", 
		"red": "#EF5350", 
		"lgreen": "#C5E1A5",
		"green": "#7CB342",
		"yellow": "#FFF176",
		"brown": "#CE8544",
		"orange": "#FFB74D",
		"darker_blue": "#95CAFD",
		"dark_blue": "#BDDEFE",
		"blue": "#E5F2FF",
		"grey": "#E0E0E0",
		"teal": "#009688",
		"lime": "#CDDC39",
		"ldeep_orange": "#FFAB91",
		"deep_orange": "#FF5722",
		"blue_grey": "#607D8B",
		"cyan": "#00BCD4",
		"pink": "#E91E63",
		"lpink": "#F48FB1",
		"indigo": "#3F51B5",
		"amber": "#FFC107"

	}

	var location_colors = {
		"1c5facd7-7bbd-4b97-8af2-a46a522e2ba7": "cyan", 
		"5fad5a58-d839-4da7-a23b-eec95fae4ad4": "lime", 
		"326b7a7c-4298-4e08-9330-199a4b9ddff3": "indigo",
		"21305133-7020-4c0c-8a4e-a4b11b37eb4f": "deep_orange",
		"52c6eaac-26b4-4479-827f-6df0bd728226": "pink",
		"f03fa0eb-a5ec-4ab0-b87d-6eedffd10d92": "purple",
		"89e011c2-8a63-4a5c-be18-f8fe6b5e5e19": "blue_grey",
		"0fd778c4-b5ee-4c5a-849f-776dbd99dc21": "teal",
		"ff340368-9f93-432e-8495-9dc9f2269212": "amber"
	}


	console.time("sort_data");

	var HTMLtable = '<div class="table-responsive"><table id="diary" class="table table-condensed nowrap" cellspacing="0">';
	HTMLtable += '<thead><tr bgcolor="#E0E0E0"><th colspan="4" style="text-align:right">Month</th><th style="text-align:center" ';
	HTMLtable += ['colspan="5">Jan','colspan="3">Feb','colspan="5">Mar','colspan="4">Apr','colspan="4">May','colspan="4">Jun','colspan="5">Jul','colspan="5">Aug','colspan="4">Sep','colspan="5">Oct','colspan="4">Nov','colspan="5">Dec'].join('</th><th style="text-align:center" ');
	HTMLtable += '</th></tr>';
	HTMLtable += '<tr bgcolor="#E0E0E0"><th colspan="4" style="text-align:right">Week Number</th>%week_no%</tr>';
	HTMLtable += '<tr bgcolor="#E0E0E0"><th>Plant Name</th><th>No.</th><th>Location</th><th>Year</th>%avg_temps%</tr></thead>';
	HTMLtable += '<tbody id="plant-table">%plants%</tbody></table></div>';

	var HTML_cell 			= '<td %cell_colour% %border% nowrap>%cell_contents%</td>'
	var HTML_cell_content 	= '<div style="cursor:pointer" data-toggle="popover" data-trigger="focus" data-placement="bottom" data-html="true" title="<b>%popover_title%</b>" data-content="<dl>%popover_body%</dl>">%symbol%</div>';
	var HTML_loc_popover 	= '<a href="#" style="cursor:pointer" data-toggle="popover" data-trigger="focus" data-placement="bottom" data-html="true" title="<b>Location Color Key</b>" data-content="<dl>%popover_body%</dl>">KEY</a>';
	var HTML_popover_img 	= "<img src='%res_link%' width='200' />";
	var HTML_popover_link 	= "<dd><a href='%url%'>• %link_text%</a></dd>";

{'fraction_non_alphanumeric': 0.3095766022595291, 'fraction_numerical': 0.057649667405764965, 'mean_word_length': 3.1128962223187147, 'pattern_counts': {'":': 72, '<': 111, '<?xml version=': 0, '>': 131, 'https://': 2, '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': '573632', 'n_tokens_mistral': 3831, 'n_tokens_neox': 3463, 'n_words': 480}