Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
ba3824ef
I
incubator-echarts
项目概览
x649585723
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
ba3824ef
编写于
12月 01, 2019
作者:
S
sushuang
提交者:
GitHub
12月 01, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into fix/dim-guess
上级
8031987c
98280fcf
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
552 addition
and
54 deletion
+552
-54
src/chart/funnel/FunnelSeries.js
src/chart/funnel/FunnelSeries.js
+5
-3
src/chart/graph/GraphSeries.js
src/chart/graph/GraphSeries.js
+8
-3
src/chart/pie/PieSeries.js
src/chart/pie/PieSeries.js
+4
-3
src/chart/radar/RadarSeries.js
src/chart/radar/RadarSeries.js
+5
-3
src/chart/themeRiver/ThemeRiverSeries.js
src/chart/themeRiver/ThemeRiverSeries.js
+4
-3
src/component/legend/LegendModel.js
src/component/legend/LegendModel.js
+3
-3
src/component/legend/LegendView.js
src/component/legend/LegendView.js
+10
-8
src/component/toolbox/ToolboxView.js
src/component/toolbox/ToolboxView.js
+5
-0
src/component/toolbox/feature/MagicType.js
src/component/toolbox/feature/MagicType.js
+17
-12
src/model/Series.js
src/model/Series.js
+3
-3
src/visual/LegendVisualProvider.js
src/visual/LegendVisualProvider.js
+55
-0
src/visual/dataColor.js
src/visual/dataColor.js
+0
-13
test/legend-visualMapColor.html
test/legend-visualMapColor.html
+237
-0
test/runTest/actions/__meta__.json
test/runTest/actions/__meta__.json
+1
-0
test/runTest/actions/legend-visualMapColor.json
test/runTest/actions/legend-visualMapColor.json
+1
-0
test/toolbox-stack.html
test/toolbox-stack.html
+194
-0
未找到文件。
src/chart/funnel/FunnelSeries.js
浏览文件 @
ba3824ef
...
...
@@ -22,6 +22,8 @@ import * as zrUtil from 'zrender/src/core/util';
import
createListSimply
from
'
../helper/createListSimply
'
;
import
{
defaultEmphasis
}
from
'
../../util/model
'
;
import
{
makeSeriesEncodeForNameBased
}
from
'
../../data/helper/sourceHelper
'
;
import
LegendVisualProvider
from
'
../../visual/LegendVisualProvider
'
;
import
{
bind
}
from
'
zrender/src/core/util
'
;
var
FunnelSeries
=
echarts
.
extendSeriesModel
({
...
...
@@ -32,9 +34,9 @@ var FunnelSeries = echarts.extendSeriesModel({
// Enable legend selection for each data item
// Use a function instead of direct access because data reference may changed
this
.
legend
DataProvider
=
function
()
{
return
this
.
getRawData
();
}
;
this
.
legend
VisualProvider
=
new
LegendVisualProvider
(
bind
(
this
.
getData
,
this
),
bind
(
this
.
getRawData
,
this
)
)
;
// Extend labelLine emphasis
this
.
_defaultLabelLine
(
option
);
},
...
...
src/chart/graph/GraphSeries.js
浏览文件 @
ba3824ef
...
...
@@ -24,6 +24,7 @@ import {defaultEmphasis} from '../../util/model';
import
Model
from
'
../../model/Model
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
createGraphFromNodeEdge
from
'
../helper/createGraphFromNodeEdge
'
;
import
LegendVisualProvider
from
'
../../visual/LegendVisualProvider
'
;
var
GraphSeries
=
echarts
.
extendSeriesModel
({
...
...
@@ -32,10 +33,14 @@ var GraphSeries = echarts.extendSeriesModel({
init
:
function
(
option
)
{
GraphSeries
.
superApply
(
this
,
'
init
'
,
arguments
);
var
self
=
this
;
function
getCategoriesData
()
{
return
self
.
_categoriesData
;
}
// Provide data for legend select
this
.
legend
DataProvider
=
function
()
{
return
this
.
_categoriesData
;
}
;
this
.
legend
VisualProvider
=
new
LegendVisualProvider
(
getCategoriesData
,
getCategoriesData
)
;
this
.
fillDataTextStyle
(
option
.
edges
||
option
.
links
);
...
...
src/chart/pie/PieSeries.js
浏览文件 @
ba3824ef
...
...
@@ -25,6 +25,7 @@ import {getPercentWithPrecision} from '../../util/number';
import
dataSelectableMixin
from
'
../../component/helper/selectableMixin
'
;
import
{
retrieveRawAttr
}
from
'
../../data/helper/dataProvider
'
;
import
{
makeSeriesEncodeForNameBased
}
from
'
../../data/helper/sourceHelper
'
;
import
LegendVisualProvider
from
'
../../visual/LegendVisualProvider
'
;
var
PieSeries
=
echarts
.
extendSeriesModel
({
...
...
@@ -37,9 +38,9 @@ var PieSeries = echarts.extendSeriesModel({
// Enable legend selection for each data item
// Use a function instead of direct access because data reference may changed
this
.
legend
DataProvider
=
function
()
{
return
this
.
getRawData
();
}
;
this
.
legend
VisualProvider
=
new
LegendVisualProvider
(
zrUtil
.
bind
(
this
.
getData
,
this
),
zrUtil
.
bind
(
this
.
getRawData
,
this
)
)
;
this
.
updateSelectedMap
(
this
.
_createSelectableList
());
...
...
src/chart/radar/RadarSeries.js
浏览文件 @
ba3824ef
...
...
@@ -21,6 +21,7 @@ import SeriesModel from '../../model/Series';
import
createListSimply
from
'
../helper/createListSimply
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
LegendVisualProvider
from
'
../../visual/LegendVisualProvider
'
;
var
RadarSeries
=
SeriesModel
.
extend
({
...
...
@@ -35,9 +36,10 @@ var RadarSeries = SeriesModel.extend({
// Enable legend selection for each data item
// Use a function instead of direct access because data reference may changed
this
.
legendDataProvider
=
function
()
{
return
this
.
getRawData
();
};
this
.
legendVisualProvider
=
new
LegendVisualProvider
(
zrUtil
.
bind
(
this
.
getData
,
this
),
zrUtil
.
bind
(
this
.
getRawData
,
this
)
);
},
getInitialData
:
function
(
option
,
ecModel
)
{
...
...
src/chart/themeRiver/ThemeRiverSeries.js
浏览文件 @
ba3824ef
...
...
@@ -24,6 +24,7 @@ import List from '../../data/List';
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
{
groupData
}
from
'
../../util/model
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
LegendVisualProvider
from
'
../../visual/LegendVisualProvider
'
;
var
DATA_NAME_INDEX
=
2
;
...
...
@@ -49,9 +50,9 @@ var ThemeRiverSeries = SeriesModel.extend({
// Put this function here is for the sake of consistency of code style.
// Enable legend selection for each data item
// Use a function instead of direct access because data reference may changed
this
.
legend
DataProvider
=
function
()
{
return
this
.
getRawData
();
}
;
this
.
legend
VisualProvider
=
new
LegendVisualProvider
(
zrUtil
.
bind
(
this
.
getData
,
this
),
zrUtil
.
bind
(
this
.
getRawData
,
this
)
)
;
},
/**
...
...
src/component/legend/LegendModel.js
浏览文件 @
ba3824ef
...
...
@@ -111,9 +111,9 @@ var LegendModel = echarts.extendComponentModel({
availableNames
.
push
(
seriesName
);
var
isPotential
;
if
(
seriesModel
.
legend
Data
Provider
)
{
var
data
=
seriesModel
.
legendDataProvider
()
;
var
names
=
data
.
mapArray
(
data
.
getName
);
if
(
seriesModel
.
legend
Visual
Provider
)
{
var
provider
=
seriesModel
.
legendVisualProvider
;
var
names
=
provider
.
getAllNames
(
);
if
(
!
ecModel
.
isSeriesFiltered
(
seriesModel
))
{
availableNames
=
availableNames
.
concat
(
names
);
...
...
src/component/legend/LegendView.js
浏览文件 @
ba3824ef
...
...
@@ -175,7 +175,7 @@ export default echarts.extendComponentView({
return
;
}
//
Series legend
//
Legend to control series.
if
(
seriesModel
)
{
var
data
=
seriesModel
.
getData
();
var
color
=
data
.
getVisual
(
'
color
'
);
...
...
@@ -211,22 +211,24 @@ export default echarts.extendComponentView({
legendDrawnMap
.
set
(
name
,
true
);
}
else
{
//
Data legend of pie, funnel
//
Legend to control data. In pie and funnel.
ecModel
.
eachRawSeries
(
function
(
seriesModel
)
{
// In case multiple series has same data name
if
(
legendDrawnMap
.
get
(
name
))
{
return
;
}
if
(
seriesModel
.
legendDataProvider
)
{
var
data
=
seriesModel
.
legendDataProvider
();
var
idx
=
data
.
indexOfName
(
name
);
if
(
idx
<
0
)
{
if
(
seriesModel
.
legendVisualProvider
)
{
var
provider
=
seriesModel
.
legendVisualProvider
;
if
(
!
provider
.
containName
(
name
))
{
return
;
}
var
color
=
data
.
getItemVisual
(
idx
,
'
color
'
);
var
borderColor
=
data
.
getItemVisual
(
idx
,
'
borderColor
'
);
var
idx
=
provider
.
indexOfName
(
name
);
var
color
=
provider
.
getItemVisual
(
idx
,
'
color
'
);
var
borderColor
=
provider
.
getItemVisual
(
idx
,
'
borderColor
'
);
var
legendSymbolType
=
'
roundRect
'
;
...
...
src/component/toolbox/ToolboxView.js
浏览文件 @
ba3824ef
...
...
@@ -63,6 +63,11 @@ export default echarts.extendComponentView({
var
featureModel
=
new
Model
(
featureOpt
,
toolboxModel
,
toolboxModel
.
ecModel
);
var
feature
;
// FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
if
(
payload
&&
payload
.
newTitle
!=
null
)
{
featureOpt
.
title
=
payload
.
newTitle
;
}
if
(
featureName
&&
!
oldName
)
{
// Create
if
(
isUserFeatureName
(
featureName
))
{
feature
=
{
...
...
src/component/toolbox/feature/MagicType.js
浏览文件 @
ba3824ef
...
...
@@ -23,6 +23,7 @@ import lang from '../../../lang';
import
*
as
featureManager
from
'
../featureManager
'
;
var
magicTypeLang
=
lang
.
toolbox
.
magicType
;
var
INNER_STACK_KEYWORD
=
'
__ec_magicType_stack__
'
;
function
MagicType
(
model
)
{
this
.
model
=
model
;
...
...
@@ -37,7 +38,6 @@ MagicType.defaultOption = {
line
:
'
M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4
'
,
bar
:
'
M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7
'
,
stack
:
'
M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z
'
,
// jshint ignore:line
tiled
:
'
M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z
'
/* eslint-enable */
},
// `line`, `bar`, `stack`, `tiled`
...
...
@@ -88,26 +88,20 @@ var seriesOptGenreator = {
}
},
'
stack
'
:
function
(
seriesType
,
seriesId
,
seriesModel
,
model
)
{
var
isStack
=
seriesModel
.
get
(
'
stack
'
)
===
INNER_STACK_KEYWORD
;
if
(
seriesType
===
'
line
'
||
seriesType
===
'
bar
'
)
{
model
.
setIconStatus
(
'
stack
'
,
isStack
?
'
normal
'
:
'
emphasis
'
);
return
zrUtil
.
merge
({
id
:
seriesId
,
stack
:
'
__ec_magicType_stack__
'
stack
:
isStack
?
''
:
INNER_STACK_KEYWORD
},
model
.
get
(
'
option.stack
'
)
||
{},
true
);
}
},
'
tiled
'
:
function
(
seriesType
,
seriesId
,
seriesModel
,
model
)
{
if
(
seriesType
===
'
line
'
||
seriesType
===
'
bar
'
)
{
return
zrUtil
.
merge
({
id
:
seriesId
,
stack
:
''
},
model
.
get
(
'
option.tiled
'
)
||
{},
true
);
}
}
};
var
radioTypes
=
[
[
'
line
'
,
'
bar
'
],
[
'
stack
'
,
'
tiled
'
]
[
'
stack
'
]
];
proto
.
onclick
=
function
(
ecModel
,
api
,
type
)
{
...
...
@@ -172,10 +166,21 @@ proto.onclick = function (ecModel, api, type) {
}
},
generateNewSeriesTypes
);
var
newTitle
;
// Change title of stack
if
(
type
===
'
stack
'
)
{
var
isStack
=
newOption
.
series
&&
newOption
.
series
[
0
]
&&
newOption
.
series
[
0
].
stack
===
INNER_STACK_KEYWORD
;
newTitle
=
isStack
?
zrUtil
.
merge
({
stack
:
magicTypeLang
.
title
.
tiled
},
magicTypeLang
.
title
)
:
zrUtil
.
clone
(
magicTypeLang
.
title
);
}
api
.
dispatchAction
({
type
:
'
changeMagicType
'
,
currentType
:
type
,
newOption
:
newOption
newOption
:
newOption
,
newTitle
:
newTitle
});
};
...
...
src/model/Series.js
浏览文件 @
ba3824ef
...
...
@@ -62,11 +62,11 @@ var SeriesModel = ComponentModel.extend({
defaultOption
:
null
,
/**
*
Data provided for legend
* @type {
Function
}
*
legend visual provider to the legend component
* @type {
Object
}
*/
// PENDING
legend
Data
Provider
:
null
,
legend
Visual
Provider
:
null
,
/**
* Access path of color for visual
...
...
src/visual/LegendVisualProvider.js
0 → 100644
浏览文件 @
ba3824ef
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* LegendVisualProvider is an bridge that pick encoded color from data and
* provide to the legend component.
* @param {Function} getDataWithEncodedVisual Function to get data after filtered. It stores all the encoding info
* @param {Function} getRawData Function to get raw data before filtered.
*/
function
LegendVisualProvider
(
getDataWithEncodedVisual
,
getRawData
)
{
this
.
getAllNames
=
function
()
{
var
rawData
=
getRawData
();
// We find the name from the raw data. In case it's filtered by the legend component.
// Normally, the name can be found in rawData, but can't be found in filtered data will display as gray.
return
rawData
.
mapArray
(
rawData
.
getName
);
};
this
.
containName
=
function
(
name
)
{
var
rawData
=
getRawData
();
return
rawData
.
indexOfName
(
name
)
>=
0
;
};
this
.
indexOfName
=
function
(
name
)
{
// Only get data when necessary.
// Because LegendVisualProvider constructor may be new in the stage that data is not prepared yet.
// Invoking Series#getData immediately will throw an error.
var
dataWithEncodedVisual
=
getDataWithEncodedVisual
();
return
dataWithEncodedVisual
.
indexOfName
(
name
);
};
this
.
getItemVisual
=
function
(
dataIndex
,
key
)
{
// Get encoded visual properties from final filtered data.
var
dataWithEncodedVisual
=
getDataWithEncodedVisual
();
return
dataWithEncodedVisual
.
getItemVisual
(
dataIndex
,
key
);
};
}
export
default
LegendVisualProvider
;
\ No newline at end of file
src/visual/dataColor.js
浏览文件 @
ba3824ef
...
...
@@ -68,33 +68,20 @@ export default function (seriesType) {
dataAll
.
getName
(
rawIdx
)
||
(
rawIdx
+
''
),
seriesModel
.
__paletteScope
,
dataAll
.
count
()
);
// Legend may use the visual info in data before processed
dataAll
.
setItemVisual
(
rawIdx
,
'
color
'
,
color
);
// Data is not filtered
if
(
filteredIdx
!=
null
)
{
data
.
setItemVisual
(
filteredIdx
,
'
color
'
,
color
);
}
}
else
{
// Set data all color for legend
dataAll
.
setItemVisual
(
rawIdx
,
'
color
'
,
singleDataColor
);
}
if
(
!
singleDataBorderColor
)
{
var
borderColor
=
itemModel
.
get
(
'
itemStyle.borderColor
'
);
// Legend may use the visual info in data before processed
dataAll
.
setItemVisual
(
rawIdx
,
'
borderColor
'
,
borderColor
);
// Data is not filtered
if
(
filteredIdx
!=
null
)
{
data
.
setItemVisual
(
filteredIdx
,
'
borderColor
'
,
borderColor
);
}
}
else
{
// Set data all borderColor for legend
dataAll
.
setItemVisual
(
rawIdx
,
'
borderColor
'
,
singleDataBorderColor
);
}
});
}
};
...
...
test/legend-visualMapColor.html
0 → 100644
浏览文件 @
ba3824ef
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<script
src=
"lib/esl.js"
></script>
<script
src=
"lib/config.js"
></script>
<script
src=
"lib/jquery.min.js"
></script>
<script
src=
"lib/facePrint.js"
></script>
<script
src=
"lib/testHelper.js"
></script>
<!-- <script src="ut/lib/canteen.js"></script> -->
<link
rel=
"stylesheet"
href=
"lib/reset.css"
/>
</head>
<body>
<style>
</style>
<div
id=
"main0"
></div>
<div
id=
"main1"
></div>
<div
id=
"main2"
></div>
<script>
require
([
'
echarts
'
/*, 'map/js/china' */
],
function
(
echarts
)
{
var
option
;
option
=
{
"
dataset
"
:
[
{
"
source
"
:
[
[
"
Mark3
"
,
"
Mark3_desc
"
,
"
Role4
"
,
"
Role4_desc
"
],
[
"
01
"
,
"
高档
"
,
6789
,
"
6789.00
"
],
[
"
03
"
,
"
中档
"
,
9546
,
"
9546.00
"
],
[
"
04
"
,
"
低档
"
,
16892
,
"
16892.00
"
]
]
}
],
"
series
"
:
[
{
"
type
"
:
"
pie
"
,
"
datasetIndex
"
:
0
,
"
name
"
:
"
销售数量
"
,
"
encode
"
:
{
"
value
"
:
"
Role4
"
,
"
itemName
"
:
"
Mark3_desc
"
}
}
],
"
visualMap
"
:
[
{
"
show
"
:
false
,
"
inRange
"
:
{
"
color
"
:
[
"
#6EB9FF
"
,
"
#99DFA2
"
,
"
#FDAD29
"
]
},
"
dataDefIndex
"
:
0
,
"
field
"
:
"
FA_XS_MONTH.JGDC
"
,
"
type
"
:
"
piecewise
"
,
"
categories
"
:
[
"
高档
"
,
"
中档
"
,
"
低档
"
],
"
dimension
"
:
"
Mark3_desc
"
,
"
seriesIndex
"
:
0
}
],
"
legend
"
:
{
"
show
"
:
true
}
};
var
chart
=
testHelper
.
create
(
echarts
,
'
main0
'
,
{
title
:
[
'
Legend use color from visualMap
'
,
'
Test case from #10766
'
],
option
:
option
});
});
</script>
<script>
require
([
'
echarts
'
/*, 'map/js/china' */
],
function
(
echarts
)
{
var
data
=
[
{
value
:
335
,
name
:
'
直接访问
'
},
{
value
:
310
,
name
:
'
邮件营销
'
},
{
value
:
274
,
name
:
'
联盟广告
'
},
{
value
:
235
,
name
:
'
视频广告
'
},
{
value
:
400
,
name
:
'
搜索引擎
'
}
].
sort
(
function
(
a
,
b
)
{
return
a
.
value
-
b
.
value
;
});
var
option
=
{
backgroundColor
:
'
#2c343c
'
,
legend
:
{
textStyle
:
{
color
:
'
#fff
'
}
},
visualMap
:
{
show
:
false
,
min
:
200
,
max
:
600
,
inRange
:
{
colorLightness
:
[
0
,
1
]
}
},
series
:
[
{
name
:
'
访问来源
'
,
type
:
'
pie
'
,
radius
:
'
55%
'
,
center
:
[
'
50%
'
,
'
50%
'
],
data
:
data
,
roseType
:
'
radius
'
,
label
:
{
normal
:
{
textStyle
:
{
color
:
'
rgba(255, 255, 255, 0.3)
'
}
}
},
labelLine
:
{
normal
:
{
lineStyle
:
{
color
:
'
rgba(255, 255, 255, 0.3)
'
},
smooth
:
0.2
,
length
:
10
,
length2
:
20
}
},
itemStyle
:
{
normal
:
{
color
:
'
#c23531
'
,
shadowBlur
:
200
,
shadowColor
:
'
rgba(0, 0, 0, 0.5)
'
}
},
animationType
:
'
scale
'
,
animationEasing
:
'
elasticOut
'
,
animationDelay
:
function
(
idx
)
{
return
Math
.
random
()
*
200
;
}
}
]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
main1
'
,
{
title
:
[
'
Legend use color from lightness visualMap.
'
],
option
:
option
});
});
</script>
<script>
require
([
'
echarts
'
/*, 'map/js/china' */
],
function
(
echarts
)
{
var
option
=
{
legend
:
{
},
series
:
{
type
:
'
pie
'
,
itemStyle
:
{
color
:
function
(
params
)
{
var
colorList
=
[
'
#ff3322
'
,
'
#232211
'
,
'
#aabbcc
'
];
return
colorList
[
params
.
dataIndex
];
}
},
data
:
[
{
name
:
'
First
'
,
value
:
1222
},
{
name
:
'
Second
'
,
value
:
2333
},
{
name
:
'
Third
'
,
value
:
3444
},
]
}
};
var
chart
=
testHelper
.
create
(
echarts
,
'
main2
'
,
{
title
:
[
'
Legend use color from callback
'
],
option
:
option
});
});
</script>
</body>
</html>
test/runTest/actions/__meta__.json
浏览文件 @
ba3824ef
...
...
@@ -86,6 +86,7 @@
"label-position"
:
1
,
"largeLine-tooltip"
:
1
,
"legend"
:
6
,
"legend-visualMapColor"
:
2
,
"line"
:
1
,
"line-animation"
:
1
,
"map"
:
3
,
...
...
test/runTest/actions/legend-visualMapColor.json
0 → 100644
浏览文件 @
ba3824ef
[{
"name"
:
"Action 1"
,
"ops"
:[{
"type"
:
"mousemove"
,
"time"
:
108
,
"x"
:
248
,
"y"
:
111
},{
"type"
:
"mousemove"
,
"time"
:
312
,
"x"
:
288
,
"y"
:
95
},{
"type"
:
"mousemove"
,
"time"
:
524
,
"x"
:
323
,
"y"
:
87
},{
"type"
:
"mousemove"
,
"time"
:
725
,
"x"
:
325
,
"y"
:
87
},{
"type"
:
"mousedown"
,
"time"
:
786
,
"x"
:
325
,
"y"
:
87
},{
"type"
:
"mouseup"
,
"time"
:
904
,
"x"
:
325
,
"y"
:
87
},{
"time"
:
905
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousedown"
,
"time"
:
1341
,
"x"
:
325
,
"y"
:
87
},{
"type"
:
"mouseup"
,
"time"
:
1423
,
"x"
:
325
,
"y"
:
87
},{
"time"
:
1424
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousemove"
,
"time"
:
1699
,
"x"
:
325
,
"y"
:
86
},{
"type"
:
"mousemove"
,
"time"
:
1899
,
"x"
:
374
,
"y"
:
84
},{
"type"
:
"mousemove"
,
"time"
:
2100
,
"x"
:
382
,
"y"
:
84
},{
"type"
:
"mousedown"
,
"time"
:
2155
,
"x"
:
382
,
"y"
:
84
},{
"type"
:
"mouseup"
,
"time"
:
2240
,
"x"
:
382
,
"y"
:
84
},{
"time"
:
2241
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousemove"
,
"time"
:
2483
,
"x"
:
383
,
"y"
:
85
},{
"type"
:
"mousemove"
,
"time"
:
2684
,
"x"
:
431
,
"y"
:
84
},{
"type"
:
"mousemove"
,
"time"
:
2890
,
"x"
:
450
,
"y"
:
86
},{
"type"
:
"mousedown"
,
"time"
:
3043
,
"x"
:
450
,
"y"
:
86
},{
"type"
:
"mouseup"
,
"time"
:
3133
,
"x"
:
450
,
"y"
:
86
},{
"time"
:
3134
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousemove"
,
"time"
:
3284
,
"x"
:
449
,
"y"
:
86
},{
"type"
:
"mousemove"
,
"time"
:
3484
,
"x"
:
332
,
"y"
:
88
},{
"type"
:
"mousemove"
,
"time"
:
3690
,
"x"
:
327
,
"y"
:
88
},{
"type"
:
"mousedown"
,
"time"
:
3914
,
"x"
:
327
,
"y"
:
88
},{
"type"
:
"mouseup"
,
"time"
:
4006
,
"x"
:
327
,
"y"
:
88
},{
"time"
:
4007
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousedown"
,
"time"
:
4524
,
"x"
:
327
,
"y"
:
88
},{
"type"
:
"mouseup"
,
"time"
:
4629
,
"x"
:
327
,
"y"
:
88
},{
"time"
:
4630
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousemove"
,
"time"
:
4686
,
"x"
:
327
,
"y"
:
88
},{
"type"
:
"mousemove"
,
"time"
:
4896
,
"x"
:
370
,
"y"
:
84
},{
"type"
:
"mousemove"
,
"time"
:
5110
,
"x"
:
378
,
"y"
:
83
},{
"type"
:
"mousedown"
,
"time"
:
5196
,
"x"
:
378
,
"y"
:
83
},{
"type"
:
"mouseup"
,
"time"
:
5278
,
"x"
:
378
,
"y"
:
83
},{
"time"
:
5279
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousemove"
,
"time"
:
5370
,
"x"
:
382
,
"y"
:
83
},{
"type"
:
"mousemove"
,
"time"
:
5570
,
"x"
:
467
,
"y"
:
93
},{
"type"
:
"mousemove"
,
"time"
:
5779
,
"x"
:
471
,
"y"
:
93
},{
"type"
:
"mousedown"
,
"time"
:
5797
,
"x"
:
471
,
"y"
:
93
},{
"type"
:
"mouseup"
,
"time"
:
5929
,
"x"
:
471
,
"y"
:
93
},{
"time"
:
5930
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
}],
"scrollY"
:
0
,
"scrollX"
:
0
,
"timestamp"
:
1574957708591
},{
"name"
:
"Action 2"
,
"ops"
:[{
"type"
:
"mousemove"
,
"time"
:
204
,
"x"
:
588
,
"y"
:
236
},{
"type"
:
"mousemove"
,
"time"
:
411
,
"x"
:
579
,
"y"
:
218
},{
"type"
:
"mousemove"
,
"time"
:
628
,
"x"
:
578
,
"y"
:
215
},{
"type"
:
"mousedown"
,
"time"
:
662
,
"x"
:
578
,
"y"
:
215
},{
"type"
:
"mouseup"
,
"time"
:
761
,
"x"
:
578
,
"y"
:
215
},{
"time"
:
762
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousemove"
,
"time"
:
1238
,
"x"
:
577
,
"y"
:
215
},{
"type"
:
"mousemove"
,
"time"
:
1439
,
"x"
:
493
,
"y"
:
209
},{
"type"
:
"mousemove"
,
"time"
:
1648
,
"x"
:
414
,
"y"
:
206
},{
"type"
:
"mousemove"
,
"time"
:
1867
,
"x"
:
412
,
"y"
:
207
},{
"type"
:
"mousedown"
,
"time"
:
1932
,
"x"
:
412
,
"y"
:
207
},{
"type"
:
"mouseup"
,
"time"
:
2000
,
"x"
:
412
,
"y"
:
207
},{
"time"
:
2001
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
},{
"type"
:
"mousemove"
,
"time"
:
2357
,
"x"
:
411
,
"y"
:
207
},{
"type"
:
"mousemove"
,
"time"
:
2564
,
"x"
:
347
,
"y"
:
211
},{
"type"
:
"mousemove"
,
"time"
:
2783
,
"x"
:
345
,
"y"
:
211
},{
"type"
:
"mousedown"
,
"time"
:
2798
,
"x"
:
345
,
"y"
:
211
},{
"type"
:
"mouseup"
,
"time"
:
2896
,
"x"
:
345
,
"y"
:
211
},{
"time"
:
2897
,
"delay"
:
400
,
"type"
:
"screenshot-auto"
}],
"scrollY"
:
334
,
"scrollX"
:
0
,
"timestamp"
:
1574957722873
}]
\ No newline at end of file
test/toolbox-stack.html
0 → 100644
浏览文件 @
ba3824ef
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta
charset=
"utf-8"
>
<script
src=
"lib/esl.js"
></script>
<script
src=
"lib/config.js"
></script>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
</head>
<body>
<style>
html
,
body
{
width
:
100%
;
height
:
100%
;
margin
:
0
;
}
#main
{
width
:
90%
;
height
:
45%
;
margin
:
0
;
background
:
#fff
;
}
#nodata
{
width
:
90%
;
height
:
45%
;
margin
:
0
;
background
:
#fff
;
}
</style>
<div
id=
"main"
></div>
<div
id=
"nodata"
></div>
<script>
require
([
'
echarts
'
// 'echarts/chart/bar',
// 'echarts/component/polar',
// 'zrender/vml/vml'
],
function
(
echarts
)
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
main
'
),
null
,
{
// renderer: 'svg'
});
option
=
{
color
:
[
'
#3398DB
'
,
'
#CA2121
'
],
legend
:
{
show
:
true
,
data
:
[
'
Bar
'
,
'
Bar2
'
],
},
tooltip
:
{
show
:
true
},
toolbox
:
{
show
:
true
,
right
:
'
5%
'
,
feature
:
{
saveAsImage
:
{
show
:
true
,
title
:
'
Save As Image
'
},
dataView
:
{
show
:
true
,
title
:
'
Data View
'
},
magicType
:
{
show
:
true
,
type
:
[
'
line
'
,
'
bar
'
,
'
stack
'
]},
},
},
grid
:
{
left
:
'
3%
'
,
right
:
'
4%
'
,
bottom
:
'
3%
'
,
containLabel
:
true
},
xAxis
:
[
{
type
:
'
category
'
,
data
:
[
'
Mon
'
,
'
Tue
'
,
'
Wed
'
,
'
Thu
'
,
'
Fri
'
,
'
Sat
'
,
'
Sun
'
],
axisTick
:
{
alignWithLabel
:
true
}
}
],
yAxis
:
[
{
type
:
'
value
'
}
],
series
:
[
{
name
:
'
Bar
'
,
type
:
'
bar
'
,
data
:[
10
,
52
,
200
,
334
,
390
,
330
,
220
]
},
{
name
:
'
Bar2
'
,
type
:
'
bar
'
,
stack
:
'
stackTest
'
,
data
:[
120
,
132
,
101
,
134
,
90
,
230
,
210
]
}
]
};
chart
.
setOption
(
option
,
true
);
});
</script>
<script>
require
([
'
echarts
'
// 'echarts/chart/bar',
// 'echarts/component/polar',
// 'zrender/vml/vml'
],
function
(
echarts
)
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
nodata
'
),
null
,
{
// renderer: 'svg'
});
option
=
{
color
:
[
'
#3398DB
'
,
'
#CA2121
'
],
legend
:
{
show
:
true
,
data
:
[],
},
tooltip
:
{
show
:
true
},
toolbox
:
{
show
:
true
,
right
:
'
5%
'
,
feature
:
{
saveAsImage
:
{
show
:
true
,
title
:
'
Save As Image
'
},
dataView
:
{
show
:
true
,
title
:
'
Data View
'
},
magicType
:
{
show
:
true
,
type
:
[
'
line
'
,
'
bar
'
,
'
stack
'
]},
},
},
grid
:
{
left
:
'
3%
'
,
right
:
'
4%
'
,
bottom
:
'
3%
'
,
containLabel
:
true
},
xAxis
:
[
{
type
:
'
category
'
,
data
:
[
'
Mon
'
,
'
Tue
'
,
'
Wed
'
,
'
Thu
'
,
'
Fri
'
,
'
Sat
'
,
'
Sun
'
],
axisTick
:
{
alignWithLabel
:
true
}
}
],
yAxis
:
[
{
type
:
'
value
'
}
],
series
:
[
]
};
chart
.
setOption
(
option
,
true
);
});
</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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录