echarts-wordcloud
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "echarts-wordcloud", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "ECharts wordcloud extension based on wordcloud2.js", | ||
@@ -9,3 +9,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"echarts": "^3.6.2" | ||
"echarts": "^3.7.0" | ||
}, | ||
@@ -12,0 +12,0 @@ "repository": { |
@@ -83,3 +83,3 @@ # [ECharts](https://github.com/ecomfe/echarts) wordcloud extension based on [wordcloud2.js](https://github.com/timdream/wordcloud2.js) | ||
// Allow word bigger than the size of the canvas to be drawn | ||
drawOutOfBounds: false, | ||
drawOutOfBound: false, | ||
@@ -86,0 +86,0 @@ // Global text style |
@@ -165,1 +165,25 @@ var echarts = require('echarts/lib/echarts'); | ||
}); | ||
echarts.registerPreprocessor(function (option) { | ||
var series = (option || {}).series; | ||
!echarts.util.isArray(series) && (series = series ? [series] : []); | ||
var compats = ['shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY']; | ||
echarts.util.each(series, function (seriesItem) { | ||
if (seriesItem && seriesItem.type === 'wordCloud') { | ||
var textStyle = seriesItem.textStyle || {}; | ||
compatTextStyle(textStyle.normal); | ||
compatTextStyle(textStyle.emphasis); | ||
} | ||
}); | ||
function compatTextStyle(textStyle) { | ||
textStyle && echarts.util.each(compats, function (key) { | ||
if (textStyle.hasOwnProperty(key)) { | ||
textStyle['text' + echarts.format.capitalFirst(key)] = textStyle[key]; | ||
} | ||
}); | ||
} | ||
}); |
@@ -24,30 +24,10 @@ var echarts = require('echarts/lib/echarts'); | ||
var getFont = function (model, otherModel) { | ||
var ecModel = model.ecModel; | ||
var gTextStyleModel = ecModel && ecModel.getModel('textStyle'); | ||
return ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily'].map(function (name, idx) { | ||
if (idx !== 2) { | ||
return model.getShallow(name) | ||
|| otherModel.getShallow(name) | ||
|| getShallow(gTextStyleModel, name); | ||
} | ||
else { | ||
return ( | ||
model.getShallow(name, true) | ||
|| Math.round( | ||
model === textStyleModel | ||
? size : (otherModel.getShallow(name, true) || size) | ||
) | ||
) + 'px'; | ||
} | ||
}).join(' '); | ||
}; | ||
var text = new echarts.graphic.Text({ | ||
style: { | ||
var textEl = new echarts.graphic.Text({ | ||
style: echarts.graphic.setTextStyle({}, textStyleModel, { | ||
x: drawn.info.fillTextOffsetX, | ||
y: drawn.info.fillTextOffsetY + size * 0.5, | ||
text: text, | ||
textBaseline: 'middle', | ||
font: getFont(textStyleModel, emphasisTextStyleModel) | ||
}, | ||
textFill: data.getItemVisual(dataIdx, 'color'), | ||
fontSize: size | ||
}), | ||
scale: [1 / drawn.info.mu, 1 / drawn.info.mu], | ||
@@ -61,18 +41,9 @@ position: [ | ||
text.setStyle(textStyleModel.getItemStyle()); | ||
group.add(textEl); | ||
text.setStyle({ | ||
fill: data.getItemVisual(dataIdx, 'color') | ||
}); | ||
data.setItemGraphicEl(dataIdx, textEl); | ||
group.add(text); | ||
data.setItemGraphicEl(dataIdx, text); | ||
echarts.graphic.setHoverStyle( | ||
text, echarts.util.extend( | ||
emphasisTextStyleModel.getItemStyle(), | ||
{ | ||
font: getFont(emphasisTextStyleModel, textStyleModel) | ||
} | ||
) | ||
textEl, | ||
echarts.graphic.setTextStyle({}, emphasisTextStyleModel, null, {forMerge: true}) | ||
); | ||
@@ -79,0 +50,0 @@ }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
195514
4678
Updatedecharts@^3.7.0