<commit_before>define(function(require) {
	var d3 = require('d3');
	require('d3-layout-cloud');
	
	var modules = require('modules');

	var visualize = modules.get('visualize');
	visualize.directive('zxyCloud', function() {
		return {
			restrict: 'A',
			scope: {
				data: '='
			},
			link: function(scope, element, attrs) {
				var width = element.width();
				var height = element.height();

				var fill = d3.scale.category20();

				var layout = d3.layout.cloud();
				layout.words(scope.data)
					.size([width, height])
					.padding(5)
					.rotate(function() { return 0; })
					.fontSize(function(i) { return i['size'] })
					.on('end', draw);<commit_msg>bug fix: 当宽或高为0时，导致页面卡死<commit_after>define(function(require) {
	var d3 = require('d3');
	require('d3-layout-cloud');
	
	var modules = require('modules');

	var visualize = modules.get('visualize');
	visualize.directive('zxyCloud', function() {
		return {
			restrict: 'A',
			scope: {
				data: '='
			},
			link: function(scope, element, attrs) {
				var width = element.width();
				width = !!width ? width : 500;
				var height = element.height();
				height = !! height ? height : 500;

				var fill = d3.scale.category20();

				var layout = d3.layout.cloud();
				layout.words(scope.data)
					.timeInterval(10)
					.size([width, height])
					.padding(5)
					.rotate(function() { return 0; })
					.fontSize(function(i) { return i['size'] })
					.on('end', draw);
{'fraction_non_alphanumeric': 0.17973629424011103, 'fraction_numerical': 0.018736988202637056, 'mean_word_length': 3.253687315634218, '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': '1079026', 'n_tokens_mistral': 617, 'n_tokens_neox': 493, 'n_words': 102}