<commit_before>﻿(function () {
	"use strict";

	var chartjs = this,
		helpers = chartjs.helpers;

	var defaultConfig = {

		// INHERIT
		// showScale: true,						// Boolean - If we should show the scale at all
		// scaleOverride: false,				// Boolean - If we want to override with a hard coded scale
		// ** Required if scaleOverride is true **
		// *** scaleSteps: null,				// Number - The number of steps in a hard coded scale
		// *** scaleStepWidth: null,			// Number - The value jump in the hard coded scale
		// *** scaleStartValue: null,			// Number - The scale starting value

		// scaleLineColor: "rgba(0,0,0,.1)",		// String - Colour of the scale line
		// scaleLineWidth: 1,						// Number - Pixel width of the scale line
		// scaleShowLabels: true,					// Boolean - Whether to show labels on the scale
		// scaleLabel: "<%=value%>",				// Interpolated JS string - can access value
		scaleArgLabel: "<%=value%>",				// Interpolated JS string - can access value

		// SCALE
		scaleShowGridLines: true,				//Boolean - Whether grid lines are shown across the chart
		scaleGridLineWidth: 1,					//Number - Width of the grid lines
		scaleGridLineColor: "rgba(0,0,0,.05)",	//String - Colour of the grid lines
		scaleShowHorizontalLines: true,			//Boolean - Whether to show horizontal lines (except X axis)
		scaleShowVerticalLines: true,			//Boolean - Whether to show vertical lines (except Y axis)



		// LINES
		datasetStroke: true,			// Boolean - Whether to show a stroke for datasets
		datasetStrokeWidth: 2,			// Number - Pixel width of dataset stroke
		datasetStrokeColor: '#007ACC',	// String - Color of dataset stroke

		bezierCurve: true,				// Boolean - Whether the line is curved between points
		bezierCurveTension: 0.4,		// Number - Tension of the bezier curve between points



		// POINTS
		pointDot: true,					// Boolean - Whether to show a dot for each point
		pointDotStrokeWidth: 1,			// Number - Pixel width of point dot stroke
		pointDotRadius: 4,				// Number - Radius of each point dot in pixels
		pointHitDetectionRadius: 4,		// Number - amount extra to add to the radius to cater for hit detection outside the drawn point


		multiTooltipTemplate: "<%=arg%>; <%=value%>",
		tooltipTemplate: "<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%=arg%>; <%=value%>"
	};

	chartjs.AltScale = chartjs.Element.extend({

		padding: 10,

		initialize: function () {

			// this.dataRange - минимальные и максимальные значения данных

			// инициализируем настройки
			// рассчитываем вспомогательные параметры

			this.font = helpers.fontString(this.fontSize, this.fontStyle, this.fontFamily);
		},

		api: {

			getElementOrDefault: function (array, index, defaultValue) {

				return index >= 0 && index < array.length
					? array[index]
					: defaultValue;
			},

			applyRange: function (value, min, max) {

				return value > max ? max
					: value < min ? min
					: value;
			},

			calculateControlPoints: function (prev, current, next, range, tension) {

				var tensionBefore = !!prev ? tension : 0;
				var tensionAfter = !!next ? tension : 0;

				var innerCurrent = current;
				var innerPrev = prev ? prev : current;
				var innerNext = next ? next : current;

				var a = { xx: innerCurrent.arg - innerPrev.arg, yy: innerCurrent.value - innerPrev.value }
				var b = { xx: innerNext.arg - innerPrev.arg, yy: innerNext.value - innerPrev.value }

				var mul = a.xx * b.xx + a.yy * b.yy;
				var mod = Math.sqrt(b.xx * b.xx + b.yy * b.yy);

				var k = Math.min(Math.max(mul / (mod * mod), 0.3), 0.7);

				var result = {
					before: {
						x: innerCurrent.arg - b.xx * k * tensionBefore,
						y: innerCurrent.value - b.yy * k * tensionBefore
					},
					after: {
						x: innerCurrent.arg + b.xx * (1 - k) * tensionAfter,
						y: innerCurrent.value + b.yy * (1 - k) * tensionAfter
					}
				};

				// Cap inner bezier handles to the upper/lower scale bounds
				result.before.y = this.applyRange(result.before.y, range.ymin, range.ymax);
				result.after.y = this.applyRange(result.after.y, range.ymin, range.ymax);

				return result;
			}
		},

		fit: function () {

			// vertical labels & padding
			this.yScaleRange = helpers.calculateScaleRange(
				[this.dataRange.ymin, this.dataRange.ymax],
				this.chart.height,
				this.fontSize,
				this.beginAtZero,
				this.integersOnly);

			this.yLabels = helpers.generateLabels(
				this.labelTemplate,
				this.yScaleRange.steps,
				this.yScaleRange.min,
				this.yScaleRange.stepValue);

			this.xPadding = this.showLabels
				? helpers.longestText(this.chart.ctx, this.font, this.yLabels) + this.padding : 0;

			// horisontal labels & padding
			this.xScaleRange = helpers.calculateScaleRange(
				[this.dataRange.xmin, this.dataRange.xmax],
				this.chart.width,
				this.fontSize,
				this.beginAtZero,
				this.integersOnly);

			this.xLabels = helpers.generateLabels(
				this.argLabelTemplate,
				this.xScaleRange.steps,
				this.xScaleRange.min,
				this.xScaleRange.stepValue);

			var xStepWidth = Math.floor((this.chart.width - this.xPadding) / this.xScaleRange.steps);
			var xLabelMaxWidth = helpers.longestText(this.chart.ctx, this.font, this.xLabels);
			var xLabelHeight = this.fontSize * 1.5;

			this.xLabelRotation = xLabelMaxWidth > xStepWidth;

			this.yPadding = this.showLabels
				? (this.xLabelRotation ? xLabelMaxWidth : xLabelHeight) + this.padding
				: 0;
		},

		updateBezierControlPoints: function (dataSetPoints, ease, tension) {

			for (var i = 0; i < dataSetPoints.length; i++) {

				var current = this.api.getElementOrDefault(dataSetPoints, i);
				var prev = this.api.getElementOrDefault(dataSetPoints, i - 1);
				var next = this.api.getElementOrDefault(dataSetPoints, i + 1);

				var obj = this.api.calculateControlPoints(prev, current, next, this.dataRange, tension);

				current.controlPoints = {

					x1: this.calculateX(obj.before.x),
					y1: this.calculateY(obj.before.y, ease),

					x2: this.calculateX(obj.after.x),
					y2: this.calculateY(obj.after.y, ease)
				};
			}
		},

		updatePoints: function (dataSetPoints, ease) {

			for (var i = 0; i < dataSetPoints.length; i++) {

				var current = dataSetPoints[i];

				current.x = this.calculateX(current.arg);
				current.y = this.calculateY(current.value, ease);
			}
		},

		calculateX: function (x) {

			return this.xPadding + ((x - this.xScaleRange.min) * (this.chart.width - this.xPadding) / (this.xScaleRange.max - this.xScaleRange.min));
		},
		calculateY: function (y, ease) {

			return this.chart.height - this.yPadding - ((y - this.yScaleRange.min) * (this.chart.height - this.yPadding) / (this.yScaleRange.max - this.yScaleRange.min)) * (ease || 1);
		},

		draw: function () {

			var ctx = this.chart.ctx, value, index;

			if (this.display) {

				var xpos1 = this.calculateX(this.xScaleRange.min);
				var xpos2 = this.calculateX(this.xScaleRange.max);
				var ypos1 = this.calculateY(this.yScaleRange.min);
				var ypos2 = this.calculateY(this.yScaleRange.max);

				// y axis
				for (index = 0, value = this.yScaleRange.min;
					 index < this.yScaleRange.steps;
					 index++, value += this.yScaleRange.stepValue) {

					var ypos = this.calculateY(value);

					if (this.showHorizontalLines) {

						ctx.lineWidth = this.gridLineWidth;
						ctx.strokeStyle = this.gridLineColor;

						ctx.beginPath();
						ctx.moveTo(xpos1, ypos);
						ctx.lineTo(xpos2, ypos);
						ctx.stroke();
					}

					// labels
					if (this.showLabels) {

						ctx.lineWidth = this.lineWidth;
						ctx.strokeStyle = this.lineColor;

						// черточки
						ctx.beginPath();
						ctx.moveTo(xpos1, ypos);
						ctx.lineTo(xpos1 - 5, ypos);
						ctx.stroke();

						// text
						ctx.textAlign = "right";
						ctx.textBaseline = "middle";
						ctx.font = this.font;
						ctx.fillStyle = this.textColor;
						ctx.fillText(this.yLabels[index], xpos1 - 7, ypos);
					}
				}

				// x axis
				for (index = 0, value = this.xScaleRange.min;
					 index < this.xScaleRange.steps;
					 index++, value += this.xScaleRange.stepValue) {

					var xpos = this.calculateX(value);

					if (this.showVerticalLines) {

						ctx.lineWidth = this.gridLineWidth;
						ctx.strokeStyle = this.gridLineColor;

						ctx.beginPath();
						ctx.moveTo(xpos, ypos1);
						ctx.lineTo(xpos, ypos2);
						ctx.stroke();
					}

					// labels
					if (this.showLabels) {

						ctx.lineWidth = this.lineWidth;
						ctx.strokeStyle = this.lineColor;

						// черточки
						ctx.beginPath();
						ctx.moveTo(xpos, ypos1);
						ctx.lineTo(xpos, ypos1 + 5);
						ctx.stroke();

						// text
						ctx.save();
						ctx.translate(xpos, ypos1 + 7);
						ctx.rotate(this.xLabelRotation ?  -Math.PI / 2 : 0);
						ctx.textAlign = (this.xLabelRotation) ? "right" : "center";
						ctx.textBaseline = (this.xLabelRotation) ? "middle" : "top";
						ctx.font = this.font;
						ctx.fillStyle = this.textColor;
						ctx.fillText(this.xLabels[index], 0, 0);
						ctx.restore();
					}
				}
				
				// axis
				ctx.lineWidth = this.lineWidth;
				ctx.strokeStyle = this.lineColor;

				ctx.beginPath();
				ctx.moveTo(xpos1, 0);
				ctx.lineTo(xpos1, ypos1);
				ctx.stroke();

				ctx.beginPath();<commit_msg>- dash size;<commit_after>﻿(function () {
	"use strict";

	var chartjs = this,
		helpers = chartjs.helpers;

	var defaultConfig = {

		// INHERIT
		// showScale: true,						// Boolean - If we should show the scale at all
		// scaleOverride: false,				// Boolean - If we want to override with a hard coded scale
		// ** Required if scaleOverride is true **
		// *** scaleSteps: null,				// Number - The number of steps in a hard coded scale
		// *** scaleStepWidth: null,			// Number - The value jump in the hard coded scale
		// *** scaleStartValue: null,			// Number - The scale starting value

		// scaleLineColor: "rgba(0,0,0,.1)",		// String - Colour of the scale line
		// scaleLineWidth: 1,						// Number - Pixel width of the scale line
		// scaleShowLabels: true,					// Boolean - Whether to show labels on the scale
		// scaleLabel: "<%=value%>",				// Interpolated JS string - can access value
		scaleArgLabel: "<%=value%>",				// Interpolated JS string - can access value

		// SCALE
		scaleShowGridLines: true,				//Boolean - Whether grid lines are shown across the chart
		scaleGridLineWidth: 1,					//Number - Width of the grid lines
		scaleGridLineColor: "rgba(0,0,0,.05)",	//String - Colour of the grid lines
		scaleShowHorizontalLines: true,			//Boolean - Whether to show horizontal lines (except X axis)
		scaleShowVerticalLines: true,			//Boolean - Whether to show vertical lines (except Y axis)



		// LINES
		datasetStroke: true,			// Boolean - Whether to show a stroke for datasets
		datasetStrokeWidth: 2,			// Number - Pixel width of dataset stroke
		datasetStrokeColor: '#007ACC',	// String - Color of dataset stroke

		bezierCurve: true,				// Boolean - Whether the line is curved between points
		bezierCurveTension: 0.4,		// Number - Tension of the bezier curve between points



		// POINTS
		pointDot: true,					// Boolean - Whether to show a dot for each point
		pointDotStrokeWidth: 1,			// Number - Pixel width of point dot stroke
		pointDotRadius: 4,				// Number - Radius of each point dot in pixels
		pointHitDetectionRadius: 4,		// Number - amount extra to add to the radius to cater for hit detection outside the drawn point


		multiTooltipTemplate: "<%=arg%>; <%=value%>",
		tooltipTemplate: "<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%=arg%>; <%=value%>"
	};

	chartjs.AltScale = chartjs.Element.extend({

		initialize: function () {

			// this.dataRange - минимальные и максимальные значения данных

			// инициализируем настройки
			// рассчитываем вспомогательные параметры

			this.font = helpers.fontString(this.fontSize, this.fontStyle, this.fontFamily);
			this.padding = this.fontSize * 1.5;
		},

		api: {

			getElementOrDefault: function (array, index, defaultValue) {

				return index >= 0 && index < array.length
					? array[index]
					: defaultValue;
			},

			applyRange: function (value, min, max) {

				return value > max ? max
					: value < min ? min
					: value;
			},

			calculateControlPoints: function (prev, current, next, range, tension) {

				var tensionBefore = !!prev ? tension : 0;
				var tensionAfter = !!next ? tension : 0;

				var innerCurrent = current;
				var innerPrev = prev ? prev : current;
				var innerNext = next ? next : current;

				var a = { xx: innerCurrent.arg - innerPrev.arg, yy: innerCurrent.value - innerPrev.value }
				var b = { xx: innerNext.arg - innerPrev.arg, yy: innerNext.value - innerPrev.value }

				var mul = a.xx * b.xx + a.yy * b.yy;
				var mod = Math.sqrt(b.xx * b.xx + b.yy * b.yy);

				var k = Math.min(Math.max(mul / (mod * mod), 0.3), 0.7);

				var result = {
					before: {
						x: innerCurrent.arg - b.xx * k * tensionBefore,
						y: innerCurrent.value - b.yy * k * tensionBefore
					},
					after: {
						x: innerCurrent.arg + b.xx * (1 - k) * tensionAfter,
						y: innerCurrent.value + b.yy * (1 - k) * tensionAfter
					}
				};

				// Cap inner bezier handles to the upper/lower scale bounds
				result.before.y = this.applyRange(result.before.y, range.ymin, range.ymax);
				result.after.y = this.applyRange(result.after.y, range.ymin, range.ymax);

				return result;
			}
		},

		fit: function () {

			// vertical labels & padding
			this.yScaleRange = helpers.calculateScaleRange(
				[this.dataRange.ymin, this.dataRange.ymax],
				this.chart.height,
				this.fontSize,
				this.beginAtZero,
				this.integersOnly);

			this.yLabels = helpers.generateLabels(
				this.labelTemplate,
				this.yScaleRange.steps,
				this.yScaleRange.min,
				this.yScaleRange.stepValue);

			this.xPadding = this.showLabels
				? helpers.longestText(this.chart.ctx, this.font, this.yLabels) + this.padding : 0;

			// horisontal labels & padding
			this.xScaleRange = helpers.calculateScaleRange(
				[this.dataRange.xmin, this.dataRange.xmax],
				this.chart.width,
				this.fontSize,
				this.beginAtZero,
				this.integersOnly);

			this.xLabels = helpers.generateLabels(
				this.argLabelTemplate,
				this.xScaleRange.steps,
				this.xScaleRange.min,
				this.xScaleRange.stepValue);

			var xStepWidth = Math.floor((this.chart.width - this.xPadding) / this.xScaleRange.steps);
			var xLabelMaxWidth = helpers.longestText(this.chart.ctx, this.font, this.xLabels);
			var xLabelHeight = this.fontSize * 1.5;

			this.xLabelRotation = xLabelMaxWidth > xStepWidth;

			this.yPadding = this.showLabels
				? (this.xLabelRotation ? xLabelMaxWidth : xLabelHeight) + this.padding
				: 0;
		},

		updateBezierControlPoints: function (dataSetPoints, ease, tension) {

			for (var i = 0; i < dataSetPoints.length; i++) {

				var current = this.api.getElementOrDefault(dataSetPoints, i);
				var prev = this.api.getElementOrDefault(dataSetPoints, i - 1);
				var next = this.api.getElementOrDefault(dataSetPoints, i + 1);

				var obj = this.api.calculateControlPoints(prev, current, next, this.dataRange, tension);

				current.controlPoints = {

					x1: this.calculateX(obj.before.x),
					y1: this.calculateY(obj.before.y, ease),

					x2: this.calculateX(obj.after.x),
					y2: this.calculateY(obj.after.y, ease)
				};
			}
		},

		updatePoints: function (dataSetPoints, ease) {

			for (var i = 0; i < dataSetPoints.length; i++) {

				var current = dataSetPoints[i];

				current.x = this.calculateX(current.arg);
				current.y = this.calculateY(current.value, ease);
			}
		},

		calculateX: function (x) {

			return this.xPadding + ((x - this.xScaleRange.min) * (this.chart.width - this.xPadding) / (this.xScaleRange.max - this.xScaleRange.min));
		},
		calculateY: function (y, ease) {

			return this.chart.height - this.yPadding - ((y - this.yScaleRange.min) * (this.chart.height - this.yPadding) / (this.yScaleRange.max - this.yScaleRange.min)) * (ease || 1);
		},

		draw: function () {

			var ctx = this.chart.ctx, value, index;

			if (this.display) {

				var xpos1 = this.calculateX(this.xScaleRange.min);
				var xpos2 = this.calculateX(this.xScaleRange.max);
				var ypos1 = this.calculateY(this.yScaleRange.min);
				var ypos2 = this.calculateY(this.yScaleRange.max);

				// y axis
				for (index = 0, value = this.yScaleRange.min;
					 index < this.yScaleRange.steps;
					 index++, value += this.yScaleRange.stepValue) {

					var ypos = this.calculateY(value);

					if (this.showHorizontalLines) {

						ctx.lineWidth = this.gridLineWidth;
						ctx.strokeStyle = this.gridLineColor;

						ctx.beginPath();
						ctx.moveTo(xpos1, ypos);
						ctx.lineTo(xpos2, ypos);
						ctx.stroke();
					}

					// labels
					if (this.showLabels) {

						ctx.lineWidth = this.lineWidth;
						ctx.strokeStyle = this.lineColor;

						// черточки
						ctx.beginPath();
						ctx.moveTo(xpos1, ypos);
						ctx.lineTo(xpos1 - (this.padding / 3), ypos);
						ctx.stroke();

						// text
						ctx.textAlign = "right";
						ctx.textBaseline = "middle";
						ctx.font = this.font;
						ctx.fillStyle = this.textColor;
						ctx.fillText(this.yLabels[index], xpos1 - (this.padding / 2), ypos);
					}
				}

				// x axis
				for (index = 0, value = this.xScaleRange.min;
					 index < this.xScaleRange.steps;
					 index++, value += this.xScaleRange.stepValue) {

					var xpos = this.calculateX(value);

					if (this.showVerticalLines) {

						ctx.lineWidth = this.gridLineWidth;
						ctx.strokeStyle = this.gridLineColor;

						ctx.beginPath();
						ctx.moveTo(xpos, ypos1);
						ctx.lineTo(xpos, ypos2);
						ctx.stroke();
					}

					// labels
					if (this.showLabels) {

						ctx.lineWidth = this.lineWidth;
						ctx.strokeStyle = this.lineColor;

						// черточки
						ctx.beginPath();
						ctx.moveTo(xpos, ypos1);
						ctx.lineTo(xpos, ypos1 + (this.padding / 3));
						ctx.stroke();

						// text
						ctx.save();
						ctx.translate(xpos, ypos1 + (this.padding / 2));
						ctx.rotate(this.xLabelRotation ?  -Math.PI / 2 : 0);
						ctx.textAlign = (this.xLabelRotation) ? "right" : "center";
						ctx.textBaseline = (this.xLabelRotation) ? "middle" : "top";
						ctx.font = this.font;
						ctx.fillStyle = this.textColor;
						ctx.fillText(this.xLabels[index], 0, 0);
						ctx.restore();
					}
				}
				
				// axis
				ctx.lineWidth = this.lineWidth;
				ctx.strokeStyle = this.lineColor;

				ctx.beginPath();
				ctx.moveTo(xpos1, 0);
				ctx.lineTo(xpos1, ypos1);
				ctx.stroke();

				ctx.beginPath();
{'fraction_non_alphanumeric': 0.132, 'fraction_numerical': 0.007783783783783783, 'mean_word_length': 2.707615230460922, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 27, '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': '6561949', 'n_tokens_mistral': 7742, 'n_tokens_neox': 6132, 'n_words': 1476}