<commit_before>define( [], function() {

	var legendDefaults = {
		frame: false,
		backgroundColor: 'transparent',
		frameWidth: 0,
		frameColor: 'transparent',
		paddingTop: 10,
		paddingLeft: 10,
		paddingBottom: 10,
		paddingRight: 10,

		movable: false
	}

	var Legend = function( graph, options ) {

		this.options = $.extend( {}, legendDefaults, options );

		this.graph = graph;
		this.svg = document.createElementNS(this.graph.ns, 'g');
		this.rect = document.createElementNS( this.graph.ns, 'rect' );
		this.rectBottom = document.createElementNS( this.graph.ns, 'rect' );

		this.rect.setAttribute( 'x', 0 );
		this.rect.setAttribute( 'y', 0 );

		this.rectBottom.setAttribute( 'x', 0 );
		this.rectBottom.setAttribute( 'y', 0 );

		this.pos = { x: undefined, y: undefined, transformX: 0, transformY: 0 }

		this.setEvents();

		this.applyStyle();
	};

	Legend.prototype = {

		setPosition: function( position, alignToX, alignToY ) {

			if( ! position ) {
				return;
			}
	
			var pos = this.graph.getPosition( position );
	
			if( alignToX == "right" ) {
				pos.x -= this.width;
			}

			if( alignToY == "bottom" ) {
				pos.y -= this.height;
			}
		
			this.pos.transformX = pos.x;
			this.pos.transformY = pos.y;
	
			this._setPosition();
		},

		update: function() {

			var self = this;
			this.applyStyle();

			while( this.svg.hasChildNodes( ) ) {
    			this.svg.removeChild( this.svg.lastChild );
			}


			this.svg.appendChild( this.rectBottom );

			var series = this.graph.getSeries(),
				line,
				text,
				g;

			

			for( var i = 0, l = series.length ; i < l ; i ++ ) {


				( function( j ) {

					var g, line, text;

					g = document.createElementNS(self.graph.ns, 'g');
					g.setAttribute('transform', "translate(0, " + (i * 16 + 10 + self.options.paddingTop) + ")" );

					self.svg.appendChild( g );

					var line = series[ j ].getSymbolForLegend();
					var marker = series[ j ].getMarkerForLegend();
					var text = series[ j ].getTextForLegend();

					g.appendChild( line );
					if( marker ) {
						g.appendChild( marker );	<commit_msg>Fix legend issue<commit_after>define( [], function() {

	var legendDefaults = {
		frame: false,
		backgroundColor: 'transparent',
		frameWidth: 0,
		frameColor: 'transparent',
		paddingTop: 10,
		paddingLeft: 10,
		paddingBottom: 10,
		paddingRight: 10,

		movable: false
	}

	var Legend = function( graph, options ) {

		this.options = $.extend( {}, legendDefaults, options );

		this.graph = graph;
		this.svg = document.createElementNS(this.graph.ns, 'g');
		this.rect = document.createElementNS( this.graph.ns, 'rect' );
		this.rectBottom = document.createElementNS( this.graph.ns, 'rect' );

		this.rect.setAttribute( 'x', 0 );
		this.rect.setAttribute( 'y', 0 );

		this.rectBottom.setAttribute( 'x', 0 );
		this.rectBottom.setAttribute( 'y', 0 );

		this.pos = { x: undefined, y: undefined, transformX: 0, transformY: 0 }

		this.setEvents();

		this.applyStyle();
	};

	Legend.prototype = {

		setPosition: function( position, alignToX, alignToY ) {

			if( ! position ) {
				return;
			}
	
			var pos = this.graph.getPosition( position );
	
			if( alignToX == "right" ) {
				pos.x -= this.width;
			}

			if( alignToY == "bottom" ) {
				pos.y -= this.height;
			}
		
			this.pos.transformX = pos.x;
			this.pos.transformY = pos.y;
	
			this._setPosition();
		},

		update: function() {

			var self = this;
			this.applyStyle();

			while( this.svg.hasChildNodes( ) ) {
    			this.svg.removeChild( this.svg.lastChild );
			}


			this.svg.appendChild( this.rectBottom );

			var series = this.graph.getSeries(),
				line,
				text,
				g;

			

			for( var i = 0, l = series.length ; i < l ; i ++ ) {


				( function( j ) {

					var g, line, text;

					g = document.createElementNS(self.graph.ns, 'g');
					g.setAttribute('transform', "translate(0, " + (i * 16 + self.options.paddingTop) + ")" );

					self.svg.appendChild( g );

					var line = series[ j ].getSymbolForLegend();
					var marker = series[ j ].getMarkerForLegend();
					var text = series[ j ].getTextForLegend();

					g.appendChild( line );
					if( marker ) {
						g.appendChild( marker );	
{'fraction_non_alphanumeric': 0.15897065897065896, 'fraction_numerical': 0.00962000962000962, 'mean_word_length': 2.8120989917506876, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3471362', 'n_tokens_mistral': 1753, 'n_tokens_neox': 1408, 'n_words': 321}