mirror of https://github.com/apache/superset.git
[bug fix] Fixed adhoc metric is not working for WordCloud (#5877)
* fixed adhoc metric * change rotate default to flat
This commit is contained in:
parent
10836ce53c
commit
85692612d6
|
@ -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'),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue