<commit_before>/*global define: false, document: false */
define(['xenaQuery', 'dom_helper', 'highcharts', 'highcharts_helper', 'underscore_ext', 'rx', 'highcharts_exporting', 'highcharts_more'], function (xenaQuery, dom_helper, Highcharts, highcharts_helper, _, Rx) {
		'use strict';
		return function (root, cursor, sessionStorage) {
		var div,
			leftContainer, rightContainer, controlContainer,
			xenaState = sessionStorage.xena ? JSON.parse(sessionStorage.xena) : undefined,
			cohort,
			samples,
			updateArgs;

		root.setAttribute("id", "chartRoot");
		root.style.height =window.innerHeight+'px';  /// best to do with css, but don't how to set the chart to full window height in css

		// left panel
		leftContainer = document.createElement("div");
		leftContainer.setAttribute("id", "left");
		root.appendChild(leftContainer);

		// right panel
		rightContainer = document.createElement("div");
		rightContainer.setAttribute("id", "right");
		root.appendChild(rightContainer);

		// chart container
		rightContainer.appendChild(buildEmptyChartContainer());

		if (!(xenaState && xenaState.cohort && xenaState.samples && xenaState.column_order.length > 0)) {
			document.getElementById("myChart").innerHTML = "There is no heatmap data, please add some.";
			return;
		}

		cohort = xenaState.cohort;
		samples = xenaState.samples;
		updateArgs = [cohort, samples];

		// y axis selector
		div = dom_helper.elt("div",
			axisSelector("Yaxis", update, updateArgs));
		div.setAttribute("id", "Y");
		leftContainer.appendChild(div);

		//controls
		controlContainer = document.createElement("div");
		controlContainer.setAttribute("id", "controlContainer");
		rightContainer.appendChild(controlContainer);
		// whisker is 1, 2, 3 SD
		controlContainer.appendChild(buildSDDropdown());
		// normalization selection
		controlContainer.appendChild(buildNormalizationDropdown());


		// x axis selector
		div = dom_helper.elt("div", "Variable ",
			axisSelector("Xaxis", update, updateArgs));
		div.setAttribute("id", "X");
		rightContainer.appendChild(div);

		update.apply(this, updateArgs);

		//zoom and pan instructions
		rightContainer.appendChild(document.createElement("br"));
		rightContainer.appendChild(document.createElement("br"));
		rightContainer.appendChild(document.createTextNode("Click & drag to zoom; press SHIFT at the same time to pan."));


		function setStorage(state) {
			sessionStorage.xena = JSON.stringify(state);
			cursor.update(function (s) {
				return _.assoc(s, 'chartState', state.chartState);
			});
		}

		function buildSDDropdown() {
			var dropDownDiv, option,
				dropDown = [{
					"value": 1,
					"text": "1 standard deviation"
				}, {<commit_msg>modify zoom and pan instruction in chart.js<commit_after>/*global define: false, document: false */
define(['xenaQuery', 'dom_helper', 'highcharts', 'highcharts_helper', 'underscore_ext', 'rx', 'highcharts_exporting', 'highcharts_more'], function (xenaQuery, dom_helper, Highcharts, highcharts_helper, _, Rx) {
		'use strict';
		return function (root, cursor, sessionStorage) {
		var div,
			leftContainer, rightContainer, controlContainer,
			xenaState = sessionStorage.xena ? JSON.parse(sessionStorage.xena) : undefined,
			cohort,
			samples,
			updateArgs;

		root.setAttribute("id", "chartRoot");
		root.style.height =window.innerHeight+'px';  /// best to do with css, but don't how to set the chart to full window height in css

		// left panel
		leftContainer = document.createElement("div");
		leftContainer.setAttribute("id", "left");
		root.appendChild(leftContainer);

		// right panel
		rightContainer = document.createElement("div");
		rightContainer.setAttribute("id", "right");
		root.appendChild(rightContainer);

		// chart container
		rightContainer.appendChild(buildEmptyChartContainer());

		if (!(xenaState && xenaState.cohort && xenaState.samples && xenaState.column_order.length > 0)) {
			document.getElementById("myChart").innerHTML = "There is no heatmap data, please add some.";
			return;
		}

		cohort = xenaState.cohort;
		samples = xenaState.samples;
		updateArgs = [cohort, samples];

		// y axis selector
		div = dom_helper.elt("div",
			axisSelector("Yaxis", update, updateArgs));
		div.setAttribute("id", "Y");
		leftContainer.appendChild(div);

		//controls
		controlContainer = document.createElement("div");
		controlContainer.setAttribute("id", "controlContainer");
		rightContainer.appendChild(controlContainer);
		// whisker is 1, 2, 3 SD
		controlContainer.appendChild(buildSDDropdown());
		// normalization selection
		controlContainer.appendChild(buildNormalizationDropdown());


		// x axis selector
		div = dom_helper.elt("div", "Variable ",
			axisSelector("Xaxis", update, updateArgs));
		div.setAttribute("id", "X");
		rightContainer.appendChild(div);

		update.apply(this, updateArgs);

		//zoom and pan instructions
		rightContainer.appendChild(dom_helper.elt("section", "Click & drag to zoom; add SHIFT to pan."));

		function setStorage(state) {
			sessionStorage.xena = JSON.stringify(state);
			cursor.update(function (s) {
				return _.assoc(s, 'chartState', state.chartState);
			});
		}

		function buildSDDropdown() {
			var dropDownDiv, option,
				dropDown = [{
					"value": 1,
					"text": "1 standard deviation"
				}, {
{'fraction_non_alphanumeric': 0.13760424564063684, 'fraction_numerical': 0.002274450341167551, 'mean_word_length': 4.811674008810573, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, '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': '5722035', 'n_tokens_mistral': 1740, 'n_tokens_neox': 1513, 'n_words': 363}