Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
12bffab6
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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,发现更多精彩内容 >>
提交
12bffab6
编写于
7月 16, 2020
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(state): support blur scope to be coordinateSystem
上级
cf374930
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
367 addition
and
15 deletion
+367
-15
src/chart/bar/PictorialBarView.ts
src/chart/bar/PictorialBarView.ts
+1
-1
src/component/helper/BrushTargetManager.ts
src/component/helper/BrushTargetManager.ts
+1
-1
src/coord/CoordinateSystem.ts
src/coord/CoordinateSystem.ts
+6
-0
src/coord/cartesian/Cartesian2D.ts
src/coord/cartesian/Cartesian2D.ts
+3
-3
src/coord/cartesian/Grid.ts
src/coord/cartesian/Grid.ts
+5
-5
src/coord/cartesian/prepareCustom.ts
src/coord/cartesian/prepareCustom.ts
+1
-1
src/layout/barGrid.ts
src/layout/barGrid.ts
+1
-1
src/util/states.ts
src/util/states.ts
+19
-3
test/hoverFocus2.html
test/hoverFocus2.html
+330
-0
未找到文件。
src/chart/bar/PictorialBarView.ts
浏览文件 @
12bffab6
...
@@ -144,7 +144,7 @@ class PictorialBarView extends ChartView {
...
@@ -144,7 +144,7 @@ class PictorialBarView extends ChartView {
const
cartesian
=
seriesModel
.
coordinateSystem
;
const
cartesian
=
seriesModel
.
coordinateSystem
;
const
baseAxis
=
cartesian
.
getBaseAxis
();
const
baseAxis
=
cartesian
.
getBaseAxis
();
const
isHorizontal
=
baseAxis
.
isHorizontal
();
const
isHorizontal
=
baseAxis
.
isHorizontal
();
const
coordSysRect
=
cartesian
.
grid
.
getRect
();
const
coordSysRect
=
cartesian
.
master
.
getRect
();
const
opt
:
CreateOpts
=
{
const
opt
:
CreateOpts
=
{
ecSize
:
{
width
:
api
.
getWidth
(),
height
:
api
.
getHeight
()},
ecSize
:
{
width
:
api
.
getWidth
(),
height
:
api
.
getHeight
()},
...
...
src/component/helper/BrushTargetManager.ts
浏览文件 @
12bffab6
...
@@ -396,7 +396,7 @@ const panelRectBuilders: Record<BrushTargetBuilderKey, PanelRectBuilder> = {
...
@@ -396,7 +396,7 @@ const panelRectBuilders: Record<BrushTargetBuilderKey, PanelRectBuilder> = {
grid
:
function
(
this
:
BrushTargetInfoCartesian2D
)
{
grid
:
function
(
this
:
BrushTargetInfoCartesian2D
)
{
// grid is not Transformable.
// grid is not Transformable.
return
this
.
coordSys
.
grid
.
getRect
().
clone
();
return
this
.
coordSys
.
master
.
getRect
().
clone
();
},
},
geo
:
function
(
this
:
BrushTargetInfoGeo
)
{
geo
:
function
(
this
:
BrushTargetInfoGeo
)
{
...
...
src/coord/CoordinateSystem.ts
浏览文件 @
12bffab6
...
@@ -99,6 +99,12 @@ export interface CoordinateSystem {
...
@@ -99,6 +99,12 @@ export interface CoordinateSystem {
type
:
string
type
:
string
/**
* Master of coordinate system. For example:
* Grid is master of cartesian.
*/
master
?:
CoordinateSystemMaster
// Should be the same as its coordinateSystemCreator.
// Should be the same as its coordinateSystemCreator.
dimensions
:
DimensionName
[];
dimensions
:
DimensionName
[];
...
...
src/coord/cartesian/Cartesian2D.ts
浏览文件 @
12bffab6
...
@@ -23,8 +23,8 @@ import Cartesian from './Cartesian';
...
@@ -23,8 +23,8 @@ import Cartesian from './Cartesian';
import
{
ScaleDataValue
}
from
'
../../util/types
'
;
import
{
ScaleDataValue
}
from
'
../../util/types
'
;
import
Axis2D
from
'
./Axis2D
'
;
import
Axis2D
from
'
./Axis2D
'
;
import
{
CoordinateSystem
}
from
'
../CoordinateSystem
'
;
import
{
CoordinateSystem
}
from
'
../CoordinateSystem
'
;
import
Grid
from
'
./Grid
'
;
import
GridModel
from
'
./GridModel
'
;
import
GridModel
from
'
./GridModel
'
;
import
Grid
from
'
./Grid
'
;
export
const
cartesian2DDimensions
=
[
'
x
'
,
'
y
'
];
export
const
cartesian2DDimensions
=
[
'
x
'
,
'
y
'
];
...
@@ -34,10 +34,10 @@ class Cartesian2D extends Cartesian<Axis2D> implements CoordinateSystem {
...
@@ -34,10 +34,10 @@ class Cartesian2D extends Cartesian<Axis2D> implements CoordinateSystem {
readonly
dimensions
=
cartesian2DDimensions
;
readonly
dimensions
=
cartesian2DDimensions
;
// Injected
grid
:
Grid
;
model
:
GridModel
;
model
:
GridModel
;
master
:
Grid
;
/**
/**
* Base axis will be used on stacking.
* Base axis will be used on stacking.
*/
*/
...
...
src/coord/cartesian/Grid.ts
浏览文件 @
12bffab6
...
@@ -333,12 +333,12 @@ class Grid implements CoordinateSystemMaster {
...
@@ -333,12 +333,12 @@ class Grid implements CoordinateSystemMaster {
this
.
_axesMap
=
axesMap
;
this
.
_axesMap
=
axesMap
;
/// Create cartesian2d
/// Create cartesian2d
each
(
axesMap
.
x
,
function
(
xAxis
,
xAxisIndex
)
{
each
(
axesMap
.
x
,
(
xAxis
,
xAxisIndex
)
=>
{
each
(
axesMap
.
y
,
function
(
yAxis
,
yAxisIndex
)
{
each
(
axesMap
.
y
,
(
yAxis
,
yAxisIndex
)
=>
{
const
key
=
'
x
'
+
xAxisIndex
+
'
y
'
+
yAxisIndex
;
const
key
=
'
x
'
+
xAxisIndex
+
'
y
'
+
yAxisIndex
;
const
cartesian
=
new
Cartesian2D
(
key
);
const
cartesian
=
new
Cartesian2D
(
key
);
cartesian
.
grid
=
this
;
cartesian
.
master
=
this
;
cartesian
.
model
=
gridModel
;
cartesian
.
model
=
gridModel
;
this
.
_coordsMap
[
key
]
=
cartesian
;
this
.
_coordsMap
[
key
]
=
cartesian
;
...
@@ -346,8 +346,8 @@ class Grid implements CoordinateSystemMaster {
...
@@ -346,8 +346,8 @@ class Grid implements CoordinateSystemMaster {
cartesian
.
addAxis
(
xAxis
);
cartesian
.
addAxis
(
xAxis
);
cartesian
.
addAxis
(
yAxis
);
cartesian
.
addAxis
(
yAxis
);
}
,
this
);
});
}
,
this
);
});
function
createAxisCreator
(
dimName
:
Cartesian2DDimensionName
)
{
function
createAxisCreator
(
dimName
:
Cartesian2DDimensionName
)
{
return
function
(
axisModel
:
CartesianAxisModel
,
idx
:
number
):
void
{
return
function
(
axisModel
:
CartesianAxisModel
,
idx
:
number
):
void
{
...
...
src/coord/cartesian/prepareCustom.ts
浏览文件 @
12bffab6
...
@@ -34,7 +34,7 @@ function dataToCoordSize(this: Cartesian2D, dataSize: number[], dataItem: number
...
@@ -34,7 +34,7 @@ function dataToCoordSize(this: Cartesian2D, dataSize: number[], dataItem: number
}
}
export
default
function
(
coordSys
:
Cartesian2D
)
{
export
default
function
(
coordSys
:
Cartesian2D
)
{
const
rect
=
coordSys
.
grid
.
getRect
();
const
rect
=
coordSys
.
master
.
getRect
();
return
{
return
{
coordSys
:
{
coordSys
:
{
// The name exposed to user is always 'cartesian2d' but not 'grid'.
// The name exposed to user is always 'cartesian2d' but not 'grid'.
...
...
src/layout/barGrid.ts
浏览文件 @
12bffab6
...
@@ -548,7 +548,7 @@ export const largeLayout: StageHandler = {
...
@@ -548,7 +548,7 @@ export const largeLayout: StageHandler = {
const
data
=
seriesModel
.
getData
();
const
data
=
seriesModel
.
getData
();
const
cartesian
=
seriesModel
.
coordinateSystem
as
Cartesian2D
;
const
cartesian
=
seriesModel
.
coordinateSystem
as
Cartesian2D
;
const
coordLayout
=
cartesian
.
grid
.
getRect
();
const
coordLayout
=
cartesian
.
master
.
getRect
();
const
baseAxis
=
cartesian
.
getBaseAxis
();
const
baseAxis
=
cartesian
.
getBaseAxis
();
const
valueAxis
=
cartesian
.
getOtherAxis
(
baseAxis
);
const
valueAxis
=
cartesian
.
getOtherAxis
(
baseAxis
);
const
valueDim
=
data
.
mapDimension
(
valueAxis
.
dim
);
const
valueDim
=
data
.
mapDimension
(
valueAxis
.
dim
);
...
...
src/util/states.ts
浏览文件 @
12bffab6
...
@@ -16,6 +16,8 @@ import {
...
@@ -16,6 +16,8 @@ import {
import
*
as
colorTool
from
'
zrender/src/tool/color
'
;
import
*
as
colorTool
from
'
zrender/src/tool/color
'
;
import
{
EChartsType
}
from
'
../echarts
'
;
import
{
EChartsType
}
from
'
../echarts
'
;
import
List
from
'
../data/List
'
;
import
List
from
'
../data/List
'
;
import
SeriesModel
from
'
../model/Series
'
;
import
{
CoordinateSystemMaster
,
CoordinateSystem
}
from
'
../coord/CoordinateSystem
'
;
// Reserve 0 as default.
// Reserve 0 as default.
export
let
_highlightNextDigit
=
1
;
export
let
_highlightNextDigit
=
1
;
...
@@ -315,11 +317,25 @@ export function toggleSeriesBlurStates(
...
@@ -315,11 +317,25 @@ export function toggleSeriesBlurStates(
}
}
}
}
const
targetSeriesModel
=
model
.
getSeriesByIndex
(
targetSeriesIndex
);
let
targetCoordSys
:
CoordinateSystemMaster
|
CoordinateSystem
=
targetSeriesModel
.
coordinateSystem
;
if
(
targetCoordSys
&&
(
targetCoordSys
as
CoordinateSystem
).
master
)
{
targetCoordSys
=
(
targetCoordSys
as
CoordinateSystem
).
master
;
}
model
.
eachSeries
(
function
(
seriesModel
)
{
model
.
eachSeries
(
function
(
seriesModel
)
{
const
sameSeries
=
targetSeriesIndex
===
seriesModel
.
seriesIndex
;
const
sameSeries
=
targetSeriesModel
===
seriesModel
;
let
coordSys
:
CoordinateSystemMaster
|
CoordinateSystem
=
seriesModel
.
coordinateSystem
;
if
(
coordSys
&&
(
coordSys
as
CoordinateSystem
).
master
)
{
coordSys
=
(
coordSys
as
CoordinateSystem
).
master
;
}
if
(
!
(
if
(
!
(
blurScope
===
'
series
'
&&
!
sameSeries
// Not blur other series if blurScope series
// Not blur other series if blurScope series
||
focus
===
'
series
'
&&
sameSeries
// Not blur self series if focus is series.
blurScope
===
'
series
'
&&
!
sameSeries
// Not blur other coordinate system if blurScope is coordinateSystem
||
blurScope
===
'
coordinateSystem
'
&&
!
(
coordSys
&&
targetCoordSys
&&
coordSys
===
targetCoordSys
)
// Not blur self series if focus is series.
||
focus
===
'
series
'
&&
sameSeries
// TODO blurScope: coordinate system
// TODO blurScope: coordinate system
))
{
))
{
const
view
=
ecIns
.
getViewOfSeriesModel
(
seriesModel
);
const
view
=
ecIns
.
getViewOfSeriesModel
(
seriesModel
);
...
...
test/hoverFocus2.html
0 → 100644
浏览文件 @
12bffab6
<!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>
<script>
function
makeToggleChartButtons
(
changeFocus
)
{
return
[{
text
:
'
Set focus: series
'
,
onclick
:
function
()
{
changeFocus
({
focus
:
'
series
'
});
}
},
{
text
:
'
Set focus: self
'
,
onclick
:
function
()
{
changeFocus
({
focus
:
'
self
'
});
}
},
{
text
:
'
Set blurScope: series
'
,
onclick
:
function
()
{
changeFocus
({
blurScope
:
'
series
'
});
}
},
{
text
:
'
Set blurScope: coordinateSystem
'
,
onclick
:
function
()
{
changeFocus
({
blurScope
:
'
coordinateSystem
'
});
}
},
{
text
:
'
Set blurScope: all
'
,
onclick
:
function
()
{
changeFocus
({
blurScope
:
'
all
'
});
}
}];
}
</script>
<script>
require
([
'
echarts
'
/*, 'map/js/china' */
],
function
(
echarts
)
{
var
option
;
option
=
{
grid
:
{
right
:
'
20%
'
},
legend
:
{
data
:
[
'
蒸发量
'
,
'
降水量
'
,
'
平均温度
'
]
},
xAxis
:
[
{
type
:
'
category
'
,
axisTick
:
{
alignWithLabel
:
true
},
data
:
[
'
1月
'
,
'
2月
'
,
'
3月
'
,
'
4月
'
,
'
5月
'
,
'
6月
'
,
'
7月
'
,
'
8月
'
,
'
9月
'
,
'
10月
'
,
'
11月
'
,
'
12月
'
]
}
],
yAxis
:
[
{
type
:
'
value
'
,
name
:
'
蒸发量
'
,
min
:
0
,
max
:
250
,
position
:
'
right
'
,
axisLabel
:
{
formatter
:
'
{value} ml
'
}
},
{
type
:
'
value
'
,
name
:
'
降水量
'
,
min
:
0
,
max
:
250
,
position
:
'
right
'
,
offset
:
80
,
axisLabel
:
{
formatter
:
'
{value} ml
'
}
},
{
type
:
'
value
'
,
name
:
'
温度
'
,
min
:
0
,
max
:
25
,
position
:
'
left
'
,
axisLabel
:
{
formatter
:
'
{value} °C
'
}
}
],
series
:
[
{
name
:
'
蒸发量
'
,
type
:
'
bar
'
,
data
:
[
2.0
,
4.9
,
7.0
,
23.2
,
25.6
,
76.7
,
135.6
,
162.2
,
32.6
,
20.0
,
6.4
,
3.3
]
},
{
name
:
'
降水量
'
,
type
:
'
bar
'
,
yAxisIndex
:
1
,
data
:
[
2.6
,
5.9
,
9.0
,
26.4
,
28.7
,
70.7
,
175.6
,
182.2
,
48.7
,
18.8
,
6.0
,
2.3
]
},
{
name
:
'
平均温度
'
,
type
:
'
line
'
,
yAxisIndex
:
2
,
data
:
[
2.0
,
2.2
,
3.3
,
4.5
,
6.3
,
10.2
,
20.3
,
23.4
,
23.0
,
16.5
,
12.0
,
6.2
]
}
]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
main0
'
,
{
title
:
[
'
Multiple series on same grid
'
],
buttons
:
makeToggleChartButtons
(
function
(
newOpt
)
{
option
.
series
.
forEach
(
function
(
seriesOpt
)
{
seriesOpt
.
emphasis
=
Object
.
assign
(
seriesOpt
.
emphasis
||
{},
newOpt
)
});
chart
.
setOption
(
option
);
}),
option
:
option
});
});
</script>
<script>
require
([
'
echarts
'
/*, 'map/js/china' */
],
function
(
echarts
)
{
var
dataAll
=
[
[
[
10.0
,
8.04
],
[
8.0
,
6.95
],
[
13.0
,
7.58
],
[
9.0
,
8.81
],
[
11.0
,
8.33
],
[
14.0
,
9.96
],
[
6.0
,
7.24
],
[
4.0
,
4.26
],
[
12.0
,
10.84
],
[
7.0
,
4.82
],
[
5.0
,
5.68
]
],
[
[
10.0
,
9.14
],
[
8.0
,
8.14
],
[
13.0
,
8.74
],
[
9.0
,
8.77
],
[
11.0
,
9.26
],
[
14.0
,
8.10
],
[
6.0
,
6.13
],
[
4.0
,
3.10
],
[
12.0
,
9.13
],
[
7.0
,
7.26
],
[
5.0
,
4.74
]
],
[
[
10.0
,
7.46
],
[
8.0
,
6.77
],
[
13.0
,
12.74
],
[
9.0
,
7.11
],
[
11.0
,
7.81
],
[
14.0
,
8.84
],
[
6.0
,
6.08
],
[
4.0
,
5.39
],
[
12.0
,
8.15
],
[
7.0
,
6.42
],
[
5.0
,
5.73
]
],
[
[
8.0
,
6.58
],
[
8.0
,
5.76
],
[
8.0
,
7.71
],
[
8.0
,
8.84
],
[
8.0
,
8.47
],
[
8.0
,
7.04
],
[
8.0
,
5.25
],
[
19.0
,
12.50
],
[
8.0
,
5.56
],
[
8.0
,
7.91
],
[
8.0
,
6.89
]
]
];
var
markLineOpt
=
{
animation
:
false
,
label
:
{
formatter
:
'
y = 0.5 * x + 3
'
,
align
:
'
right
'
},
lineStyle
:
{
type
:
'
solid
'
},
tooltip
:
{
formatter
:
'
y = 0.5 * x + 3
'
},
data
:
[[{
coord
:
[
0
,
3
],
symbol
:
'
none
'
},
{
coord
:
[
20
,
13
],
symbol
:
'
none
'
}]]
};
option
=
{
title
:
{
text
:
'
Anscombe
\'
s quartet
'
,
left
:
'
center
'
,
top
:
0
},
grid
:
[
{
x
:
'
7%
'
,
y
:
'
7%
'
,
width
:
'
38%
'
,
height
:
'
38%
'
},
{
x2
:
'
7%
'
,
y
:
'
7%
'
,
width
:
'
38%
'
,
height
:
'
38%
'
},
{
x
:
'
7%
'
,
y2
:
'
7%
'
,
width
:
'
38%
'
,
height
:
'
38%
'
},
{
x2
:
'
7%
'
,
y2
:
'
7%
'
,
width
:
'
38%
'
,
height
:
'
38%
'
}
],
tooltip
:
{
formatter
:
'
Group {a}: ({c})
'
},
xAxis
:
[
{
gridIndex
:
0
,
min
:
0
,
max
:
20
},
{
gridIndex
:
1
,
min
:
0
,
max
:
20
},
{
gridIndex
:
2
,
min
:
0
,
max
:
20
},
{
gridIndex
:
3
,
min
:
0
,
max
:
20
}
],
yAxis
:
[
{
gridIndex
:
0
,
min
:
0
,
max
:
15
},
{
gridIndex
:
1
,
min
:
0
,
max
:
15
},
{
gridIndex
:
2
,
min
:
0
,
max
:
15
},
{
gridIndex
:
3
,
min
:
0
,
max
:
15
}
],
series
:
[
{
name
:
'
I
'
,
type
:
'
scatter
'
,
xAxisIndex
:
0
,
yAxisIndex
:
0
,
data
:
dataAll
[
0
],
symbolSize
:
20
,
markLine
:
markLineOpt
},
{
name
:
'
II
'
,
type
:
'
scatter
'
,
xAxisIndex
:
1
,
yAxisIndex
:
1
,
data
:
dataAll
[
1
],
symbolSize
:
20
,
markLine
:
markLineOpt
},
{
name
:
'
III
'
,
type
:
'
scatter
'
,
xAxisIndex
:
2
,
yAxisIndex
:
2
,
data
:
dataAll
[
2
],
symbolSize
:
20
,
markLine
:
markLineOpt
},
{
name
:
'
IV
'
,
type
:
'
scatter
'
,
xAxisIndex
:
3
,
yAxisIndex
:
3
,
data
:
dataAll
[
3
],
symbolSize
:
20
,
markLine
:
markLineOpt
}
]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
main1
'
,
{
title
:
[
'
Multiple grid
'
],
buttons
:
makeToggleChartButtons
(
function
(
newOpt
)
{
option
.
series
.
forEach
(
function
(
seriesOpt
)
{
seriesOpt
.
emphasis
=
Object
.
assign
(
seriesOpt
.
emphasis
||
{},
newOpt
)
});
chart
.
setOption
(
option
);
}),
option
:
option
});
});
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录