[bug fix] Fixed adhoc metric is not working for WordCloud (#5877)

* fixed adhoc metric

* change rotate default to flat
This commit is contained in:
Conglei 2018-09-12 23:12:04 -07:00 committed by Maxime Beauchemin
parent 10836ce53c
commit 85692612d6
2 changed files with 3 additions and 3 deletions

View File

@ -1313,7 +1313,7 @@ export const controls = {
label: t('Rotation'), label: t('Rotation'),
choices: formatSelectOptions(['random', 'flat', 'square']), choices: formatSelectOptions(['random', 'flat', 'square']),
renderTrigger: true, renderTrigger: true,
default: 'square', default: 'flat',
description: t('Rotation to apply to words in the cloud'), description: t('Rotation to apply to words in the cloud'),
}, },

View File

@ -35,7 +35,7 @@ function wordCloud(element, props) {
const chart = d3.select(element); const chart = d3.select(element);
const size = [width, height]; const size = [width, height];
const rotationFn = ROTATION[rotation] || ROTATION.random; const rotationFn = ROTATION[rotation] || ROTATION.flat;
const scale = d3.scale.linear() const scale = d3.scale.linear()
.range(sizeRange) .range(sizeRange)
@ -88,7 +88,7 @@ function transform(data, formData) {
const transformedData = data.map(datum => ({ const transformedData = data.map(datum => ({
text: datum[series], text: datum[series],
size: datum[metric], size: datum[metric.label || metric],
})); }));
return transformedData; return transformedData;