提交 dbaea2d3 编写于 作者: D deqingli
<!--
为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
Thanks for choosing ECharts!
感谢使用 ECharts!
It's highly recommended to use English in issues, to help others having the same problem in the future.
加入 Apache 开源基金会后,我们有了更多国外的用户。为了方便社区用户,强烈建议在 issue 中使用英文。
Please check the following questions to let our bot help.
请回答以下问题,以帮助我们的机器人维护 issue。
To check the option, add x in [ ], e.g.: [x] I am ...
勾选的方式:在 [ ] 中加入 x,变成:[x] I am ... 的形式。
-->
- [ ] I am using English in this issue. 在这个 Issue 中我使用了英文(强烈建议)。
## General Questions
<!-- BEGINNING OF REQUIRED FIELDS 必填项开始 -->
PLEASE MAKE SURE OF ALL THE FOLLOWING OPTIONS IN REQUIRED FIELDS ARE TICKED (with x)!
Otherwise, the issue will not be answered.
And think before you tick. :)
请确保以下每项都打上勾了!并且确保都做了这些事哦~ 这将大量简化我们的工作流程,使你的问题更快速得到解答。
- [ ] Required: I have read the document and examples and tried to solve it by myself. (必填)我读过了文档和教程,并且曾试图自己解决问题。
- [ ] Required: I have searched for similar issues and that didn't help. (必填)我搜索过 issue 但是没有帮助。
- [ ] Required: I have tried with the latest version of ECharts and still have this problem. (必填)我试过最新版本的 ECharts,还是存在这个问题。
In this issue, I have provided information with: 在这个 issue 中我提供了以下信息:
- [ ] Required: issue type;(必填)issue 类型
- [ ] Required: one sentence description in issue details;(必填)一句话的问题描述
- [ ] Required: demo;(必填)能反映问题的例子(如果你想提问或报 bug)
- [ ] Required: ECharts version;ECharts 版本
<!-- END OF REQUIRED FIELDS 必填项结束 -->
## Issue Type
<!-- Add `x` for the ones that is true with you, e.g.: [x] I have ... -->
- [ ] I have a question to ask about *how to use ECharts to ...*;我想提问如何使用 ECharts 实现某功能
- [ ] I have a bug to report;我想要报 bug
- [ ] I have a feature to request, e.g.: *I'd like a new feature that ...*;我需要一个新功能
- [ ] I have a feature to enhance, e.g.: *The current feature should be improved in the way that ...*;我希望改进某个功能
- [ ] There's something wrong with the documents;文档有些问题
- [ ] Others, or I'm not sure which issue types to choose here;其他,或我不知道应该选什么类型
## Issue Details
<!-- Use one sentence to describe what you want and what's wrong. 一句话描述问题。 -->
{DESCRIBE_HERE}
### Expected Behavior
### One-line summary [问题简述]
<!-- Add screenshots to demo if necessary. 期望的效果。 -->
{DESCRIBE_HERE}
### Current Behavior
<!-- Add screenshots to demo if necessary. Otherwise, replace the following line with N/A. 现在的效果。 -->
### Version & Environment [版本及环境]
+ ECharts version [ECharts 版本]:
+ Browser version [浏览器类型和版本]:
+ OS Version [操作系统类型和版本]:
{DESCRIBE_HERE}
### Online Example
<!-- Please use jsfiddle.net or gallery.echartsjs.com to provide a simplest demo to show the problem. And do not upload zip demos. 请使用 gallery.echartsjs.com 提供最简单可运行的代码,请不要上传 zip 文件。 -->
THIS IS REQUIRED FOR ALL BUG REPORTS AND QUESTIONS!!! 如果是提问或报 bug 一定要提供这一项!
{ADD_LINK_OF_DEMO_HERE}
### Expected behaviour [期望结果]
<!-- Please make your demo as simple as possible to help locate the problem. And paste only necessary part of code here. 提供必要的代码,不要全部粘贴。 -->
{PASTE_RELATED_CODE_HERE}
## Topics
<!-- Check those topics that are related. 选择相关主题。 -->
- [ ] Legend
- [ ] Tooltip
- [ ] Event
- [ ] Performance
- [ ] SVG
- [ ] Map
- [ ] ECharts GL
- [ ] Third-party libraries, e.g.: Vue.js, React
### ECharts option [ECharts配置项]
<!-- Copy and paste your 'echarts option' here. -->
<!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
```javascript
option = {
}
## Anything Else We Need to Know
```
<!-- You may reference other issues here. Otherwise, replace the following line with N/A. 其他我们需要知道的东西,比如引用其他 issue。 -->
{DESCRIBE_HERE}
## Environment
### Other comments [其他信息]
<!-- For example: Screenshot or Online demo -->
<!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
- ECharts version;ECharts 版本: {DESCRIBE_HERE}
- [ ] It happens only on certain browsers or operating systems. 对于特定浏览器或操作系统才会出现的问题,请提供相应环境信息:{BROWSER_VERSION_OR_OS_INFORMATION_HERE}
......@@ -95,6 +95,7 @@ ECharts-GL is an extension pack of ECharts, which provides 3D plots, globe visua
#### Vue Component
+ [vue-echarts](https://github.com/ecomfe/vue-echarts) by ecomfe
+ [vue-echarts](https://github.com/panteng/vue-echarts) by panteng
+ [vue-echarts-v3](https://github.com/xlsdg/vue-echarts-v3) by xlsdg
......
......@@ -201,6 +201,8 @@ export default echarts.extendChartView({
var cx = data.getLayout('cx');
var cy = data.getLayout('cy');
data.eachItemGraphicEl(function (el, idx) {
var itemModel = data.getItemModel(idx);
var labelRotate = itemModel.get('label.rotate') || 0;
var symbolPath = el.getSymbolPath();
if (circularRotateLabel) {
var pos = data.getItemLayout(idx);
......@@ -222,7 +224,7 @@ export default echarts.extendChartView({
}
else {
symbolPath.setStyle({
textRotation: 0
textRotation: labelRotate *= Math.PI / 180
});
}
});
......@@ -385,4 +387,4 @@ export default echarts.extendChartView({
this._symbolDraw && this._symbolDraw.remove();
this._lineDraw && this._lineDraw.remove();
}
});
\ No newline at end of file
});
......@@ -31,11 +31,19 @@ export default function (ecModel) {
var name = categoriesData.getName(idx);
// Add prefix to avoid conflict with Object.prototype.
categoryNameIdxMap['ec-' + name] = idx;
var itemModel = categoriesData.getItemModel(idx);
var color = itemModel.get('itemStyle.color')
|| seriesModel.getColorFromPalette(name, paletteScope);
categoriesData.setItemVisual(idx, 'color', color);
var itemStyleList = ['opacity', 'symbol', 'symbolSize', 'symbolKeepAspect'];
for (var i = 0; i < itemStyleList.length; i++) {
var itemStyle = itemModel.getShallow(itemStyleList[i], true);
if (itemStyle != null) {
categoriesData.setItemVisual(idx, itemStyleList[i], itemStyle);
}
}
});
// Assign category color to visual
......@@ -47,14 +55,19 @@ export default function (ecModel) {
if (typeof category === 'string') {
category = categoryNameIdxMap['ec-' + category];
}
if (!data.getItemVisual(idx, 'color', true)) {
data.setItemVisual(
idx, 'color',
categoriesData.getItemVisual(category, 'color')
);
var itemStyleList = ['color', 'opacity', 'symbol', 'symbolSize', 'symbolKeepAspect'];
for (var i = 0; i < itemStyleList.length; i++) {
if (data.getItemVisual(idx, itemStyleList[i], true) == null) {
data.setItemVisual(
idx, itemStyleList[i],
categoriesData.getItemVisual(category, itemStyleList[i])
);
}
}
}
});
}
});
}
\ No newline at end of file
}
......@@ -86,14 +86,16 @@ SunburstPieceProto.updateData = function (
var itemModel = node.getModel();
var layout = node.getLayout();
if (!layout) {
console.log(node.getLayout());
}
// if (!layout) {
// console.log(node.getLayout());
// }
var sectorShape = zrUtil.extend({}, layout);
sectorShape.label = null;
var visualColor = getNodeColor(node, seriesModel, ecModel);
fillDefaultColor(node, seriesModel, visualColor)
var normalStyle = itemModel.getModel('itemStyle').getItemStyle();
var style;
if (state === 'normal') {
......@@ -411,3 +413,9 @@ function isNodeHighlighted(node, activeNode, policy) {
return node === activeNode || node.isDescendantOf(activeNode);
}
}
// Fix tooltip callback function params.color incorrect when pick a default color
function fillDefaultColor(node, seriesModel, color) {
var data = seriesModel.getData();
data.setItemVisual(node.dataIndex, 'color', color);
}
......@@ -324,7 +324,7 @@ var ScrollableLegendView = LegendView.extend({
if (targetItemGroup) {
var itemRect = targetItemGroup.getBoundingRect();
var itemLoc = targetItemGroup.position[orientIdx] + itemRect[xy];
var itemLoc = targetItemGroup.position[orientIdx];
contentPos[orientIdx] = -itemLoc - contentRect[xy];
pageIndex = Math.floor(
pageCount * (itemLoc + itemRect[xy] + containerRectSize / 2) / contentRect[wh]
......
......@@ -180,7 +180,7 @@ TooltipRichContent.prototype = {
},
getOuterSize: function () {
const size = this.getSize();
var size = this.getSize();
return {
width: size[0],
height: size[1]
......
......@@ -48,7 +48,7 @@ function Geo(name, map, nameMap, invertLongitute) {
var source = geoSourceManager.load(map, nameMap);
this._nameCoordMap = source.nameCoordMap;
this._regionsMap = source.nameCoordMap;
this._regionsMap = source.regionsMap;
this._invertLongitute = invertLongitute == null ? true : invertLongitute;
/**
......
......@@ -35,6 +35,7 @@ import {summarizeDimensions} from './helper/dimensionHelper';
var isObject = zrUtil.isObject;
var UNDEFINED = 'undefined';
var INDEX_NOT_FOUND = -1;
// Use prefix to avoid index to be the same as otherIdList[idx],
// which will cause weird udpate animation.
......@@ -54,6 +55,7 @@ var dataCtors = {
// Caution: MUST not use `new CtorUint32Array(arr, 0, len)`, because the Ctor of array is
// different from the Ctor of typed array.
var CtorUint32Array = typeof Uint32Array === UNDEFINED ? Array : Uint32Array;
var CtorInt32Array = typeof Int32Array === UNDEFINED ? Array : Int32Array;
var CtorUint16Array = typeof Uint16Array === UNDEFINED ? Array : Uint16Array;
function getIndicesCtor(list) {
......@@ -599,13 +601,13 @@ function prepareInvertedIndex(list) {
// Currently, only dimensions that has ordinalMeta can create inverted indices.
var ordinalMeta = dimInfo.ordinalMeta;
if (ordinalMeta) {
invertedIndices = invertedIndicesMap[dim] = new CtorUint32Array(
invertedIndices = invertedIndicesMap[dim] = new CtorInt32Array(
ordinalMeta.categories.length
);
// The default value of TypedArray is 0. To avoid miss
// mapping to 0, we should set it as NaN.
// mapping to 0, we should set it as INDEX_NOT_FOUND.
for (var i = 0; i < invertedIndices.length; i++) {
invertedIndices[i] = NaN;
invertedIndices[i] = INDEX_NOT_FOUND;
}
for (var i = 0; i < list._count; i++) {
// Only support the case that all values are distinct.
......@@ -970,7 +972,7 @@ listProto.rawIndexOf = function (dim, value) {
}
var rawIndex = invertedIndices[value];
if (rawIndex == null || isNaN(rawIndex)) {
return -1;
return INDEX_NOT_FOUND;
}
return rawIndex;
};
......
......@@ -35,7 +35,8 @@ under the License.
</style>
<div id="main0"></div>
<!-- <div id="main0"></div> -->
<div id="main1"></div>
<script>
......@@ -131,5 +132,410 @@ under the License.
});
</script>
<script>
require([
'echarts'
], function (echarts) {
var option = {
"tooltip": {
"trigger": "axis"
},
"xAxis": {
"data": [
"",
"Good",
"Slightly polluted",
"Excellent",
"Medially polluted",
"Severely polluted"
]
},
"yAxis": {
},
grid: {
right: 200
},
"series": [
{
"type": "bar",
"stack": "WEATHER1",
"name": "Clear",
"data": [
[
"",
48
],
[
"Good",
41.38805970149254
],
[
"Slightly polluted",
58.78378378378378
],
[
"Excellent",
21.5
],
[
"Medially polluted",
64.66666666666667
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Cloudy",
"data": [
[
"Good",
41.49246231155779
],
[
"Slightly polluted",
62.5
],
[
"Excellent",
22.38888888888889
],
[
"Medially polluted",
63.25
],
[
"Severely polluted",
85.66666666666667
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Overcast",
"data": [
[
"Good",
39.73170731707317
],
[
"Excellent",
22.93548387096774
],
[
"Slightly polluted",
64.75
],
[
"Medially polluted",
121.5
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Light rain",
"data": [
[
"Slightly polluted",
60.09090909090909
],
[
"Good",
39.15277777777778
],
[
"Excellent",
19.822222222222223
],
[
"Severely polluted",
82
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Moderate to heavy rain",
"data": [
[
"Excellent",
20.2
],
[
"Good",
33.875
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Fog",
"data": [
[
"Medially polluted",
123.5
],
[
"Slightly polluted",
105.5
],
[
"Good",
71
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Moderate rain",
"data": [
[
"Excellent",
19.125
],
[
"Good",
30.071428571428573
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Shower",
"data": [
[
"Excellent",
21.571428571428573
],
[
"Good",
37.523809523809526
],
[
"Slightly polluted",
69.33333333333333
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Thundershower",
"data": [
[
"Good",
31.17241379310345
],
[
"Excellent",
20.6
],
[
"Slightly polluted",
43.75
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Heavy rain",
"data": [
[
"Excellent",
23.142857142857142
],
[
"Good",
30.285714285714285
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Rainstorm",
"data": [
[
"Excellent",
19.142857142857142
],
[
"Good",
31.083333333333332
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Slight to moderate rain",
"data": [
[
"Good",
33.23529411764706
],
[
"Excellent",
18.857142857142858
],
[
"Slightly polluted",
53
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
},
{
"type": "bar",
"stack": "WEATHER1",
"name": "Heavy rain to rainstorm",
"data": [
[
"Excellent",
18
]
],
"encode": {
"x": [
0
],
"y": [
1
]
}
}
],
"legend": {
orient: 'vertical',
right: 10
}
}
testHelper.create(echarts, 'main1', {
title: 'Check bars should not be overflow the Y extent. (#9346)',
option: option,
height: 500
});
});
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册