<commit_before>"use strict";

/*global module, require*/

var helpers = require("./helpers.js"),
    rounded = function(x) {
	return helpers.rounded(x, 2);
    };

/*
 Holds data about a legend in the form of labels and colours.

 If there are the same number of labels and colours, each label is assumed to refer to one colour.

 If there is one more label than colour, the labels are assumed to be boundary conditions. The legend is therefore assumed to be continuous and monotonic.
  */
module.exports = function(labels, colours) {
    var labelLen = labels.length,
	colourLen = colours.length;

    labels = labels.map(rounded);

    if (!(labelLen === colourLen || labelLen === colourLen + 1)) {
	throw new Error("When creating a legend, the number of labels must be either equal to or one greater than the number of colours..");
    }

    return {
	isBoundary: function() {
	    return labelLen === colourLen + 1;
	},
	
	colours: function() {
	    return colours;
	},
	
	labels: function() {
	    return labels;<commit_msg>Fixed a graphical glitch for a legend with no data.<commit_after>"use strict";

/*global module, require*/

var helpers = require("./helpers.js"),
    rounded = function(x) {
	return helpers.rounded(x, 2);
    };

/*
 Holds data about a legend in the form of labels and colours.

 If there are the same number of labels and colours, each label is assumed to refer to one colour.

 If there is one more label than colour, the labels are assumed to be boundary conditions. The legend is therefore assumed to be continuous and monotonic.
  */
module.exports = function(labels, colours) {
    var labelLen = labels.length,
	colourLen = colours.length;

    if (colourLen === 0) {
	labels = [];
    }

    labels = labels.map(rounded);

    if (!(labelLen === colourLen || labelLen === colourLen + 1)) {
	throw new Error("When creating a legend, the number of labels must be either equal to or one greater than the number of colours..");
    }

    return {
	isBoundary: function() {
	    return labelLen === colourLen + 1;
	},
	
	colours: function() {
	    return colours;
	},
	
	labels: function() {
	    return labels;
{'fraction_non_alphanumeric': 0.1043802423112768, 'fraction_numerical': 0.0032618825722274, 'mean_word_length': 3.3112449799196786, 'pattern_counts': {'":': 0, '<': 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': '3901436', 'n_tokens_mistral': 627, 'n_tokens_neox': 583, 'n_words': 260}