Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dimensions setting & VisualMap support #158

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -81,6 +81,10 @@ chart.setOption({
rotationRange: [-90, 90],
rotationStep: 45,

// Dimensions can be used to define dimension info for series.data.

dimensions: ['value'],

// size of the grid in pixels for marking the availability of the canvas
// the larger the grid size, the bigger the gap between words.

8 changes: 6 additions & 2 deletions dist/echarts-wordcloud.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/echarts-wordcloud.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/WordCloudSeries.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ echarts.extendSeriesModel({

getInitialData: function (option, ecModel) {
var dimensions = echarts.helper.createDimensions(option.data, {
coordDimensions: ['value']
coordDimensions: option.dimensions
});
var list = new echarts.List(dimensions, this);
list.initData(option.data);
@@ -40,6 +40,8 @@ echarts.extendSeriesModel({
width: '70%',

height: '80%',

dimensions: ['value'],

sizeRange: [12, 60],

4 changes: 3 additions & 1 deletion src/WordCloudView.js
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ echarts.extendChartView({
seriesModel.layoutInstance.ondraw = function (text, size, dataIdx, drawn) {
var itemModel = data.getItemModel(dataIdx);
var textStyleModel = itemModel.getModel('textStyle');
var itemVisualStyle = data.getItemVisual(dataIdx, 'style');

var textEl = new echarts.graphic.Text({
style: echarts.helper.createTextStyle(textStyleModel),
@@ -28,7 +29,8 @@ echarts.extendChartView({
y: drawn.info.fillTextOffsetY + size * 0.5,
text: text,
verticalAlign: 'middle',
fill: data.getItemVisual(dataIdx, 'style').fill,
fill: itemVisualStyle.fill,
opacity: itemVisualStyle.opacity,
fontSize: size
});