js/partition.js
/**
	 * Helper function for producing a partitioning based on discrete values.
	 **/
Helper function for producing a partitioning based on discrete values.
Helper function for producing a partitioning based on discrete values .
partitionByField(field) {
		let values = {}; 
		for(let i = 0; i < this.data.length; i++)
			values[this.data[i][field]] = true;
		let partitions = [];
		for(let v in values) {
			if(values.hasOwnProperty(v)) {
				let subData = [];
				for(let i = 0; i < this.data.length; i++)
					if(this.data[i][field] == v)
						subData.push(this.data[i]);
				let partition = new Partition(v,subData,[]);
				partition.id = partitions.length;
				partitions.push(partition);
			}
		}
		let partitioning = new Partitioning(field, this);
		partitioning.data = partitions;
		partitioning.count = partitions.length;
		this.children.push(partitioning);
		return partitioning;
	}
partitionByField ( field ) { let values = { } ; for ( let i = 0 ; i < this . data . length ; i ++ ) values [ this . data [ i ] [ field ] ] = true ; let partitions = [ ] ; for ( let v in values ) { if ( values . hasOwnProperty ( v ) ) { let subData = [ ] ; for ( let i = 0 ; i < this . data . length ; i ++ ) if ( this . data [ i ] [ field ] == v ) subData . push ( this . data [ i ] ) ; let partition = new Partition ( v , subData , [ ] ) ; partition . id = partitions . length ; partitions . push ( partition ) ; } } let partitioning = new Partitioning ( field , this ) ; partitioning . data = partitions ; partitioning . count = partitions . length ; this . children . push ( partitioning ) ; return partitioning ; }
Helper function for producing a partitioning based on discrete values.
Helper function for producing a partitioning based on discrete values .
//unique values