Replies: 1 comment
-
词云图的布局和渲染,本身就是带着随机性在其中的。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
数据:
data
[{name: "jewellery box", impressions: 256124, clicks: 1020, ctr: 0.004, cpc: 0.3613, cost: 368.56,…},{name: "jewellery boxes", impressions: 1635, clicks: 18, ctr: 0.011, cpc: 0.3511, cost: 6.32,…},…]
主键/权重
wordField: 'name',
weightField: 'impressions',
问题:
一、当没有加入rotation,或设置[0,90],数据将不能百分百显示
二、当缩减数据为[{name:"jewellery box",impressions: 256124},{name:"jewellery boxes",impressions: 1635}],问题一就不再出现
三、当rotation设置0,数据适量是可以显示,当集合长度超过一定,将无法全部显示
###代码:
const wordCloud = new WordCloud(chartDom, {
data,
wordField: 'name',
weightField: 'impressions',
colorField: 'name',
limitInPlot: false,
random: () => 0.5,
wordStyle: {
fontFamily: 'Verdana',
fontSize: [14, 40],
rotation: [0, 90]
},
// 设置交互类型
interactions: [{ type: 'element-active' }],
state: {
active: {
// 这里可以设置 active 时的样式
style: {
lineWidth: 3
}
}
},
tooltip: {
formatter: (datum) => {
console.log(datum)
}
}
})
wordCloud.render()
Beta Was this translation helpful? Give feedback.
All reactions