Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
3603b33a
Commit
3603b33a
authored
Jan 31, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature] 添加资产树
parent
460fa8e8
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
259 additions
and
11 deletions
+259
-11
api.py
apps/assets/api.py
+23
-1
tree.py
apps/assets/models/tree.py
+1
-1
tree.html
apps/assets/templates/assets/tree.html
+167
-0
api_urls.py
apps/assets/urls/api_urls.py
+1
-0
views_urls.py
apps/assets/urls/views_urls.py
+2
-0
__init__.py
apps/assets/views/__init__.py
+1
-0
tree.py
apps/assets/views/tree.py
+23
-0
jumpserver.css
apps/static/css/jumpserver.css
+35
-3
jumpserver.js
apps/static/js/jumpserver.js
+1
-1
tree.js
apps/static/js/plugins/echarts/chart/tree.js
+2
-2
treemap.js
apps/static/js/plugins/echarts/chart/treemap.js
+2
-2
echarts-all.js
apps/static/js/plugins/echarts/echarts-all.js
+0
-0
heatmap.src.js
apps/static/js/plugins/highcharts/modules/heatmap.src.js
+1
-1
No files found.
apps/assets/api.py
View file @
3603b33a
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
# limitations under the License.
# limitations under the License.
from
rest_framework
import
generics
from
rest_framework
import
generics
from
rest_framework.views
import
APIView
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
from
rest_framework_bulk
import
BulkModelViewSet
from
rest_framework_bulk
import
BulkModelViewSet
from
rest_framework_bulk
import
ListBulkCreateUpdateDestroyAPIView
from
rest_framework_bulk
import
ListBulkCreateUpdateDestroyAPIView
...
@@ -25,7 +26,7 @@ from common.mixins import CustomFilterMixin
...
@@ -25,7 +26,7 @@ from common.mixins import CustomFilterMixin
from
common.utils
import
get_logger
from
common.utils
import
get_logger
from
.hands
import
IsSuperUser
,
IsValidUser
,
IsSuperUserOrAppUser
,
\
from
.hands
import
IsSuperUser
,
IsValidUser
,
IsSuperUserOrAppUser
,
\
get_user_granted_assets
get_user_granted_assets
from
.models
import
AssetGroup
,
Asset
,
Cluster
,
SystemUser
,
AdminUser
,
Label
from
.models
import
AssetGroup
,
Asset
,
Cluster
,
SystemUser
,
AdminUser
,
Label
,
Node
from
.
import
serializers
from
.
import
serializers
from
.tasks
import
update_asset_hardware_info_manual
,
test_admin_user_connectability_manual
,
\
from
.tasks
import
update_asset_hardware_info_manual
,
test_admin_user_connectability_manual
,
\
test_asset_connectability_manual
,
push_system_user_to_cluster_assets_manual
,
\
test_asset_connectability_manual
,
push_system_user_to_cluster_assets_manual
,
\
...
@@ -308,3 +309,23 @@ class LabelViewSet(BulkModelViewSet):
...
@@ -308,3 +309,23 @@ class LabelViewSet(BulkModelViewSet):
self
.
serializer_class
=
serializers
.
LabelDistinctSerializer
self
.
serializer_class
=
serializers
.
LabelDistinctSerializer
self
.
queryset
=
self
.
queryset
.
values
(
"name"
)
.
distinct
()
self
.
queryset
=
self
.
queryset
.
values
(
"name"
)
.
distinct
()
return
super
()
.
list
(
request
,
*
args
,
**
kwargs
)
return
super
()
.
list
(
request
,
*
args
,
**
kwargs
)
class
TreeViewApi
(
APIView
):
def
get_queryset
(
self
):
return
Node
.
objects
.
all
()
def
get
(
self
,
request
):
data
=
[]
for
node
in
self
.
get_queryset
():
if
node
.
id
==
"0"
:
parent
=
"#"
else
:
parent
=
":"
.
join
(
node
.
id
.
split
(
":"
)[:
-
1
])
data
.
append
({
"id"
:
node
.
id
,
"parent"
:
parent
,
"text"
:
node
.
name
})
return
Response
(
data
)
\ No newline at end of file
apps/assets/models/tree.py
View file @
3603b33a
...
@@ -51,7 +51,7 @@ class Node(models.Model):
...
@@ -51,7 +51,7 @@ class Node(models.Model):
return
assets
return
assets
@classmethod
@classmethod
def
root
(
cls
):
def
get_root_node
(
cls
):
obj
,
created
=
cls
.
objects
.
get_or_create
(
obj
,
created
=
cls
.
objects
.
get_or_create
(
id
=
'0'
,
defaults
=
{
"id"
:
'0'
,
'name'
:
"ROOT"
}
id
=
'0'
,
defaults
=
{
"id"
:
'0'
,
'name'
:
"ROOT"
}
)
)
...
...
apps/assets/templates/assets/tree.html
0 → 100644
View file @
3603b33a
{% extends 'base.html' %}
{% load static %}
{% load i18n %}
{% block custom_head_css_js %}
<link
href=
"{% static 'css/plugins/jstree/style.min.css' %}"
rel=
"stylesheet"
>
{% endblock %}
{% block content %}
<div
class=
"wrapper wrapper-content"
>
<div
class=
"row"
>
<div
class=
"col-lg-3"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content mailbox-content"
>
<div
class=
"file-manager"
>
<h5>
Tree View
</h5>
<div
id=
"jstree"
>
</div>
<div
class=
"clearfix"
></div>
</div>
</div>
</div>
</div>
<div
class=
"col-lg-9 animated fadeInRight"
>
<div
class=
"mail-box-header"
>
<div
class=
"uc pull-left m-r-5"
><a
href=
"{% url "
assets:asset-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create asset" %}
</a></div>
<div
class=
"btn-group"
style=
"float: right"
>
<button
data-toggle=
"dropdown"
class=
"btn btn-default btn-sm dropdown-toggle"
>
{% trans 'Label' %}
<span
class=
"caret"
></span></button>
<ul
class=
"dropdown-menu labels"
>
{% for label in labels %}
<li><a
style=
"font-weight: bolder"
>
{{ label.name }}:{{ label.value }}
</a></li>
{% endfor %}
</ul>
</div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"asset_list_table"
>
<thead>
<tr>
<th
class=
"text-center"
><input
type=
"checkbox"
class=
"ipt_check_all"
></th>
<th
class=
"text-center"
>
{% trans 'Hostname' %}
</th>
<th
class=
"text-center"
>
{% trans 'IP' %}
</th>
<th
class=
"text-center"
>
{% trans 'Port' %}
</th>
<th
class=
"text-center"
>
{% trans 'Cluster' %}
</th>
<th
class=
"text-center"
>
{% trans 'Hardware' %}
</th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</th>
<th
class=
"text-center"
>
{% trans 'Reachable' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div
id=
"actions"
class=
"hide"
>
<div
class=
"input-group"
>
<select
class=
"form-control m-b"
style=
"width: auto"
id=
"slct_bulk_update"
>
<option
value=
"delete"
>
{% trans 'Delete selected' %}
</option>
<option
value=
"update"
>
{% trans 'Update selected' %}
</option>
<option
value=
"deactive"
>
{% trans 'Deactive selected' %}
</option>
<option
value=
"active"
>
{% trans 'Active selected' %}
</option>
</select>
<div
class=
"input-group-btn pull-left"
style=
"padding-left: 5px;"
>
<button
id=
'btn_bulk_update'
style=
"height: 32px;"
class=
"btn btn-sm btn-primary"
>
{% trans 'Submit' %}
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block custom_foot_js %}
<script
src=
"{% static 'js/plugins/jstree/jstree.min.js' %}"
></script>
<script>
function
initTable
()
{
var
options
=
{
ele
:
$
(
'#asset_list_table'
),
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
%
url
'assets:asset-detail'
pk
=
DEFAULT_PK
as
the_url
%
}
var
detail_btn
=
'<a href="{{ the_url }}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'{{ DEFAULT_PK }}'
,
rowData
.
id
));
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
$
(
td
).
html
(
rowData
.
cluster_name
)
}},
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
$
(
td
).
html
(
rowData
.
hardware_info
)
}},
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'<i class="fa fa-times text-danger"></i>'
)
}
else
{
$
(
td
).
html
(
'<i class="fa fa-check text-navy"></i>'
)
}
}},
{
targets
:
7
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
==
'Unknown'
){
$
(
td
).
html
(
'<i class="fa fa-circle text-warning"></i>'
)
}
else
if
(
!
cellData
)
{
$
(
td
).
html
(
'<i class="fa fa-circle text-danger"></i>'
)
}
else
{
$
(
td
).
html
(
'<i class="fa fa-circle text-navy"></i>'
)
}
}},
{
targets
:
8
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "assets:asset-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
"{{ DEFAULT_PK }}"
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_asset_delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
$
(
td
).
html
(
update_btn
+
del_btn
)
}}
],
ajax_url
:
'{% url "api-assets:asset-list" %}'
,
columns
:
[
{
data
:
"id"
},
{
data
:
"hostname"
},
{
data
:
"ip"
},
{
data
:
"port"
},
{
data
:
"cluster"
},
{
data
:
"cpu_cores"
},
{
data
:
"is_active"
,
orderable
:
false
},
{
data
:
"is_connective"
,
orderable
:
false
},
{
data
:
"id"
,
orderable
:
false
}
],
op_html
:
$
(
'#actions'
).
html
()
};
return
jumpserver
.
initServerSideDataTable
(
options
);
}
$
(
document
).
ready
(
function
(){
initTable
();
$
(
'#jstree'
).
jstree
({
'core'
:
{
'check_callback'
:
true
,
'data'
:
{
'url'
:
'{% url "api-assets:tree-view" %}'
,
'data'
:
function
(
node
)
{
return
{
'id'
:
node
.
id
}
}
}
},
'plugins'
:
[
'types'
,
'dnd'
],
"checkbox"
:
{
"keep_selected_style"
:
true
},
'types'
:
{
'default'
:
{
'icon'
:
'fa fa-folder'
},
'html'
:
{
'icon'
:
'fa fa-file-code-o'
},
'svg'
:
{
'icon'
:
'fa fa-file-picture-o'
},
'css'
:
{
'icon'
:
'fa fa-file-code-o'
},
'img'
:
{
'icon'
:
'fa fa-file-image-o'
},
'js'
:
{
'icon'
:
'fa fa-file-text-o'
}
}
});
})
</script>
{% endblock %}
\ No newline at end of file
apps/assets/urls/api_urls.py
View file @
3603b33a
...
@@ -42,6 +42,7 @@ urlpatterns = [
...
@@ -42,6 +42,7 @@ urlpatterns = [
api
.
SystemUserPushApi
.
as_view
(),
name
=
'system-user-push'
),
api
.
SystemUserPushApi
.
as_view
(),
name
=
'system-user-push'
),
url
(
r'^v1/system-user/(?P<pk>[0-9a-zA-Z\-]{36})/connective/$'
,
url
(
r'^v1/system-user/(?P<pk>[0-9a-zA-Z\-]{36})/connective/$'
,
api
.
SystemUserTestConnectiveApi
.
as_view
(),
name
=
'system-user-connective'
),
api
.
SystemUserTestConnectiveApi
.
as_view
(),
name
=
'system-user-connective'
),
url
(
r'^v1/tree/$'
,
api
.
TreeViewApi
.
as_view
(),
name
=
'tree-view'
)
]
]
urlpatterns
+=
router
.
urls
urlpatterns
+=
router
.
urls
...
...
apps/assets/urls/views_urls.py
View file @
3603b33a
...
@@ -57,5 +57,7 @@ urlpatterns = [
...
@@ -57,5 +57,7 @@ urlpatterns = [
url
(
r'^label/create/$'
,
views
.
LabelCreateView
.
as_view
(),
name
=
'label-create'
),
url
(
r'^label/create/$'
,
views
.
LabelCreateView
.
as_view
(),
name
=
'label-create'
),
url
(
r'^label/(?P<pk>[0-9a-zA-Z\-]{36})/update/$'
,
views
.
LabelUpdateView
.
as_view
(),
name
=
'label-update'
),
url
(
r'^label/(?P<pk>[0-9a-zA-Z\-]{36})/update/$'
,
views
.
LabelUpdateView
.
as_view
(),
name
=
'label-update'
),
url
(
r'^label/(?P<pk>[0-9a-zA-Z\-]{36})/delete/$'
,
views
.
LabelDeleteView
.
as_view
(),
name
=
'label-delete'
),
url
(
r'^label/(?P<pk>[0-9a-zA-Z\-]{36})/delete/$'
,
views
.
LabelDeleteView
.
as_view
(),
name
=
'label-delete'
),
url
(
r'^tree/$'
,
views
.
TreeView
.
as_view
(),
name
=
'tree-view'
),
]
]
apps/assets/views/__init__.py
View file @
3603b33a
...
@@ -5,4 +5,5 @@ from .cluster import *
...
@@ -5,4 +5,5 @@ from .cluster import *
from
.system_user
import
*
from
.system_user
import
*
from
.admin_user
import
*
from
.admin_user
import
*
from
.label
import
*
from
.label
import
*
from
.tree
import
*
apps/assets/views/tree.py
0 → 100644
View file @
3603b33a
# -*- coding: utf-8 -*-
#
from
django.views.generic
import
TemplateView
from
django.utils.translation
import
ugettext_lazy
as
_
from
common.mixins
import
AdminUserRequiredMixin
__all__
=
[
'TreeView'
]
class
TreeView
(
AdminUserRequiredMixin
,
TemplateView
):
template_name
=
'assets/tree.html'
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'TreeView view'
),
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
apps/static/css/jumpserver.css
View file @
3603b33a
...
@@ -340,9 +340,41 @@ div.dataTables_wrapper div.dataTables_filter {
...
@@ -340,9 +340,41 @@ div.dataTables_wrapper div.dataTables_filter {
border
:
none
;
border
:
none
;
}
}
.popover-title
{
padding
:
8px
14px
;
margin
:
0
;
font-size
:
14px
;
background-color
:
#f7f7f7
;
border-bottom
:
1px
solid
#ebebeb
;
border-radius
:
5px
5px
0
0
;
}
.popover
{
.popover
{
max-width
:
100%
;
/* Max Width of the popover (depending on the container!) */
padding
:
9px
14px
;
padding-left
:
20px
;
position
:
absolute
;
padding-right
:
20px
;
top
:
0
;
left
:
0
;
z-index
:
1060
;
display
:
none
;
max-width
:
276px
;
font-family
:
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
font-size
:
14px
;
font-style
:
normal
;
font-weight
:
400
;
line-height
:
1.42857143
;
text-decoration
:
none
;
text-shadow
:
none
;
text-transform
:
none
;
letter-spacing
:
normal
;
word-break
:
normal
;
word-spacing
:
normal
;
word-wrap
:
normal
;
white-space
:
normal
;
background-color
:
#fff
;
background-clip
:
padding-box
;
border
:
1px
solid
#ccc
;
border-radius
:
6px
;
box-shadow
:
0
5px
10px
rgba
(
0
,
0
,
0
,
.2
);
line-break
:
auto
;
}
}
apps/static/js/jumpserver.js
View file @
3603b33a
...
@@ -316,7 +316,7 @@ jumpserver.initDataTable = function (options) {
...
@@ -316,7 +316,7 @@ jumpserver.initDataTable = function (options) {
$
(
'[data-toggle="popover"]'
).
popover
({
$
(
'[data-toggle="popover"]'
).
popover
({
html
:
true
,
html
:
true
,
placement
:
'bottom'
,
placement
:
'bottom'
,
trigger
:
'hover'
,
//
trigger: 'hover',
container
:
'body'
container
:
'body'
});
});
});
});
...
...
apps/static/js/plugins/echarts/chart/tree.js
View file @
3603b33a
define
(
"echarts/chart/tree"
,[
"require"
,
"./base"
,
"../util/shape/Icon"
,
"zrender/shape/Image"
,
"zrender/shape/Line"
,
"zrender/shape/BezierCurve"
,
"../layout/Tree"
,
"../data/Tree"
,
"../config"
,
"../util/ecData"
,
"zrender/config"
,
"zrender/tool/event"
,
"zrender/tool/util"
,
"../chart"
],
function
(
e
){
function
t
(
e
,
t
,
n
,
a
,
o
){
i
.
call
(
this
,
e
,
t
,
n
,
a
,
o
),
this
.
refresh
(
a
)}
var
i
=
e
(
"./base"
),
n
=
.
618
,
a
=
e
(
"../util/shape/Icon"
),
o
=
e
(
"zrender/shape/Image"
),
r
=
e
(
"zrender/shape/Line"
),
s
=
e
(
"zrender/shape/BezierCurve"
),
l
=
e
(
"../layout/Tree"
),
h
=
e
(
"../data/Tree"
),
m
=
e
(
"../config"
);
m
.
tree
=
{
zlevel
:
1
,
z
:
2
,
calculable
:
!
1
,
clickable
:
!
0
,
rootLocation
:{},
orient
:
"vertical"
,
symbol
:
"circle"
,
symbolSize
:
20
,
nodePadding
:
30
,
layerPadding
:
100
,
itemStyle
:{
normal
:{
label
:{
show
:
!
0
},
lineStyle
:{
width
:
1
,
color
:
"#777"
,
type
:
"curve"
}},
emphasis
:{}}};
var
V
=
e
(
"../util/ecData"
),
U
=
(
e
(
"zrender/config"
),
e
(
"zrender/tool/event"
),
e
(
"zrender/tool/util"
));
return
t
.
prototype
=
{
type
:
m
.
CHART_TYPE_TREE
,
_buildShape
:
function
(
e
,
t
){
var
i
=
e
.
data
[
0
];
this
.
tree
=
h
.
fromOptionData
(
i
.
name
,
i
.
children
),
this
.
tree
.
root
.
data
=
i
,
this
.
_setTreeShape
(
e
),
this
.
tree
.
traverse
(
function
(
i
){
this
.
_buildItem
(
i
,
e
,
t
),
i
.
children
.
length
>
0
&&
this
.
_buildLink
(
i
,
e
)},
this
);
var
n
=
e
.
roam
===!
0
||
"move"
===
e
.
roam
,
a
=
e
.
roam
===!
0
||
"scale"
===
e
.
roam
;
this
.
zr
.
modLayer
(
this
.
getZlevelBase
(),{
panable
:
n
,
zoomable
:
a
}),(
this
.
query
(
"markPoint.effect.show"
)
||
this
.
query
(
"markLine.effect.show"
))
&&
this
.
zr
.
modLayer
(
m
.
EFFECT_ZLEVEL
,{
panable
:
n
,
zoomable
:
a
}),
this
.
addShapeList
()},
_buildItem
:
function
(
e
,
t
,
i
){
var
n
=
[
e
.
data
,
t
],
r
=
this
.
deepQuery
(
n
,
"symbol"
),
s
=
this
.
deepMerge
(
n
,
"itemStyle.normal"
)
||
{},
l
=
this
.
deepMerge
(
n
,
"itemStyle.emphasis"
)
||
{},
h
=
s
.
color
||
this
.
zr
.
getColor
(),
m
=
l
.
color
||
this
.
zr
.
getColor
(),
U
=-
e
.
layout
.
angle
||
0
;
e
.
id
===
this
.
tree
.
root
.
id
&&
(
U
=
0
);
var
d
=
"right"
;
Math
.
abs
(
U
)
>=
Math
.
PI
/
2
&&
Math
.
abs
(
U
)
<
3
*
Math
.
PI
/
2
&&
(
U
+=
Math
.
PI
,
d
=
"left"
);
var
p
=
[
U
,
e
.
layout
.
position
[
0
],
e
.
layout
.
position
[
1
]],
c
=
new
a
({
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
()
+
1
,
rotation
:
p
,
clickable
:
this
.
deepQuery
(
n
,
"clickable"
),
style
:{
x
:
e
.
layout
.
position
[
0
]
-
.
5
*
e
.
layout
.
width
,
y
:
e
.
layout
.
position
[
1
]
-
.
5
*
e
.
layout
.
height
,
width
:
e
.
layout
.
width
,
height
:
e
.
layout
.
height
,
iconType
:
r
,
color
:
h
,
brushType
:
"both"
,
lineWidth
:
s
.
borderWidth
,
strokeColor
:
s
.
borderColor
},
highlightStyle
:{
color
:
m
,
lineWidth
:
l
.
borderWidth
,
strokeColor
:
l
.
borderColor
}});
c
.
style
.
iconType
.
match
(
"image"
)
&&
(
c
.
style
.
image
=
c
.
style
.
iconType
.
replace
(
new
RegExp
(
"^image:
\\
/
\\
/"
),
""
),
c
=
new
o
({
rotation
:
p
,
style
:
c
.
style
,
highlightStyle
:
c
.
highlightStyle
,
clickable
:
c
.
clickable
,
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
()})),
this
.
deepQuery
(
n
,
"itemStyle.normal.label.show"
)
&&
(
c
.
style
.
text
=
null
==
e
.
data
.
label
?
e
.
id
:
e
.
data
.
label
,
c
.
style
.
textPosition
=
this
.
deepQuery
(
n
,
"itemStyle.normal.label.position"
),
"radial"
===
t
.
orient
&&
"inside"
!==
c
.
style
.
textPosition
&&
(
c
.
style
.
textPosition
=
d
),
c
.
style
.
textColor
=
this
.
deepQuery
(
n
,
"itemStyle.normal.label.textStyle.color"
),
c
.
style
.
textFont
=
this
.
getFont
(
this
.
deepQuery
(
n
,
"itemStyle.normal.label.textStyle"
)
||
{})),
this
.
deepQuery
(
n
,
"itemStyle.emphasis.label.show"
)
&&
(
c
.
highlightStyle
.
textPosition
=
this
.
deepQuery
(
n
,
"itemStyle.emphasis.label.position"
),
c
.
highlightStyle
.
textColor
=
this
.
deepQuery
(
n
,
"itemStyle.emphasis.label.textStyle.color"
),
c
.
highlightStyle
.
textFont
=
this
.
getFont
(
this
.
deepQuery
(
n
,
"itemStyle.emphasis.label.textStyle"
)
||
{})),
V
.
pack
(
c
,
t
,
i
,
e
.
data
,
0
,
e
.
id
),
this
.
shapeList
.
push
(
c
)},
_buildLink
:
function
(
e
,
t
){
var
i
=
t
.
itemStyle
.
normal
.
lineStyle
;
if
(
"broken"
===
i
.
type
)
return
void
this
.
_buildBrokenLine
(
e
,
i
,
t
);
for
(
var
n
=
0
;
n
<
e
.
children
.
length
;
n
++
){
var
a
=
e
.
layout
.
position
[
0
],
o
=
e
.
layout
.
position
[
1
],
r
=
e
.
children
[
n
].
layout
.
position
[
0
],
s
=
e
.
children
[
n
].
layout
.
position
[
1
];
switch
(
i
.
type
){
case
"curve"
:
this
.
_buildBezierCurve
(
e
,
e
.
children
[
n
],
i
,
t
);
break
;
case
"broken"
:
break
;
default
:
var
l
=
this
.
_getLine
(
a
,
o
,
r
,
s
,
i
);
this
.
shapeList
.
push
(
l
)}}},
_buildBrokenLine
:
function
(
e
,
t
,
i
){
var
a
=
U
.
clone
(
t
);
a
.
type
=
"solid"
;
var
o
=
[],
r
=
e
.
layout
.
position
[
0
],
s
=
e
.
layout
.
position
[
1
],
l
=
i
.
orient
,
h
=
e
.
children
[
0
].
layout
.
position
[
1
],
m
=
r
,
V
=
s
+
(
h
-
s
)
*
(
1
-
n
),
d
=
e
.
children
[
0
].
layout
.
position
[
0
],
p
=
V
,
c
=
e
.
children
[
e
.
children
.
length
-
1
].
layout
.
position
[
0
],
u
=
V
;
if
(
"horizontal"
===
l
){
var
y
=
e
.
children
[
0
].
layout
.
position
[
0
];
m
=
r
+
(
y
-
r
)
*
(
1
-
n
),
V
=
s
,
d
=
m
,
p
=
e
.
children
[
0
].
layout
.
position
[
1
],
c
=
m
,
u
=
e
.
children
[
e
.
children
.
length
-
1
].
layout
.
position
[
1
]}
o
.
push
(
this
.
_getLine
(
r
,
s
,
m
,
V
,
a
)),
o
.
push
(
this
.
_getLine
(
d
,
p
,
c
,
u
,
a
));
for
(
var
g
=
0
;
g
<
e
.
children
.
length
;
g
++
)
y
=
e
.
children
[
g
].
layout
.
position
[
0
],
h
=
e
.
children
[
g
].
layout
.
position
[
1
],
"horizontal"
===
l
?
p
=
h
:
d
=
y
,
o
.
push
(
this
.
_getLine
(
d
,
p
,
y
,
h
,
a
));
this
.
shapeList
=
this
.
shapeList
.
concat
(
o
)},
_getLine
:
function
(
e
,
t
,
i
,
n
,
a
){
return
e
===
i
&&
(
e
=
i
=
this
.
subPixelOptimize
(
e
,
a
.
width
)),
t
===
n
&&
(
t
=
n
=
this
.
subPixelOptimize
(
t
,
a
.
width
)),
new
r
({
zlevel
:
this
.
getZlevelBase
(),
hoverable
:
!
1
,
style
:
U
.
merge
({
xStart
:
e
,
yStart
:
t
,
xEnd
:
i
,
yEnd
:
n
,
lineType
:
a
.
type
,
strokeColor
:
a
.
color
,
lineWidth
:
a
.
width
},
a
,
!
0
)})},
_buildBezierCurve
:
function
(
e
,
t
,
i
,
a
){
var
o
=
n
,
r
=
a
.
orient
,
l
=
e
.
layout
.
position
[
0
],
h
=
e
.
layout
.
position
[
1
],
m
=
t
.
layout
.
position
[
0
],
V
=
t
.
layout
.
position
[
1
],
d
=
l
,
p
=
(
V
-
h
)
*
o
+
h
,
c
=
m
,
u
=
(
V
-
h
)
*
(
1
-
o
)
+
h
;
if
(
"horizontal"
===
r
)
d
=
(
m
-
l
)
*
o
+
l
,
p
=
h
,
c
=
(
m
-
l
)
*
(
1
-
o
)
+
l
,
u
=
V
;
else
if
(
"radial"
===
r
)
if
(
e
.
id
===
this
.
tree
.
root
.
id
)
d
=
(
m
-
l
)
*
o
+
l
,
p
=
(
V
-
h
)
*
o
+
h
,
c
=
(
m
-
l
)
*
(
1
-
o
)
+
l
,
u
=
(
V
-
h
)
*
(
1
-
o
)
+
h
;
else
{
var
y
=
e
.
layout
.
originPosition
[
0
],
g
=
e
.
layout
.
originPosition
[
1
],
b
=
t
.
layout
.
originPosition
[
0
],
f
=
t
.
layout
.
originPosition
[
1
],
k
=
this
.
tree
.
root
.
layout
.
position
[
0
],
_
=
this
.
tree
.
root
.
layout
.
position
[
1
];
d
=
y
,
p
=
(
f
-
g
)
*
o
+
g
,
c
=
b
,
u
=
(
f
-
g
)
*
(
1
-
o
)
+
g
;
var
x
=
(
d
-
this
.
minX
)
/
this
.
width
*
Math
.
PI
*
2
;
d
=
p
*
Math
.
cos
(
x
)
+
k
,
p
=
p
*
Math
.
sin
(
x
)
+
_
,
x
=
(
c
-
this
.
minX
)
/
this
.
width
*
Math
.
PI
*
2
,
c
=
u
*
Math
.
cos
(
x
)
+
k
,
u
=
u
*
Math
.
sin
(
x
)
+
_
}
var
L
=
new
s
({
zlevel
:
this
.
getZlevelBase
(),
hoverable
:
!
1
,
style
:
U
.
merge
({
xStart
:
l
,
yStart
:
h
,
cpX1
:
d
,
cpY1
:
p
,
cpX2
:
c
,
cpY2
:
u
,
xEnd
:
m
,
yEnd
:
V
,
strokeColor
:
i
.
color
,
lineWidth
:
i
.
width
},
i
,
!
0
)});
this
.
shapeList
.
push
(
L
)},
_setTreeShape
:
function
(
e
){
var
t
=
new
l
({
nodePadding
:
e
.
nodePadding
,
layerPadding
:
e
.
layerPadding
});
this
.
tree
.
traverse
(
function
(
t
){
var
i
=
[
t
.
data
,
e
],
n
=
this
.
deepQuery
(
i
,
"symbolSize"
);
"number"
==
typeof
n
&&
(
n
=
[
n
,
n
]),
t
.
layout
=
{
width
:
n
[
0
],
height
:
n
[
1
]}},
this
),
t
.
run
(
this
.
tree
);
var
i
=
e
.
orient
,
n
=
e
.
rootLocation
.
x
,
a
=
e
.
rootLocation
.
y
,
o
=
this
.
zr
.
getWidth
(),
r
=
this
.
zr
.
getHeight
();
n
=
"center"
===
n
?.
5
*
o
:
this
.
parsePercent
(
n
,
o
),
a
=
"center"
===
a
?.
5
*
r
:
this
.
parsePercent
(
a
,
r
),
a
=
this
.
parsePercent
(
a
,
r
),
"horizontal"
===
i
&&
(
n
=
isNaN
(
n
)?
10
:
n
,
a
=
isNaN
(
a
)?.
5
*
r
:
a
),
"radial"
===
i
?(
n
=
isNaN
(
n
)?.
5
*
o
:
n
,
a
=
isNaN
(
a
)?.
5
*
r
:
a
):(
n
=
isNaN
(
n
)?.
5
*
o
:
n
,
a
=
isNaN
(
a
)?
10
:
a
);
var
s
=
this
.
tree
.
root
.
layout
.
position
[
0
];
if
(
"radial"
===
i
){
var
h
=
1
/
0
,
m
=
0
,
V
=
0
;
this
.
tree
.
traverse
(
function
(
e
){
m
=
Math
.
max
(
m
,
e
.
layout
.
position
[
0
]),
h
=
Math
.
min
(
h
,
e
.
layout
.
position
[
0
]),
V
=
Math
.
max
(
V
,
e
.
layout
.
width
)}),
this
.
width
=
m
-
h
+
2
*
V
,
this
.
minX
=
h
}
this
.
tree
.
traverse
(
function
(
t
){
var
o
,
r
;
if
(
"vertical"
===
i
&&
"inverse"
===
e
.
direction
)
o
=
t
.
layout
.
position
[
0
]
-
s
+
n
,
r
=
a
-
t
.
layout
.
position
[
1
];
else
if
(
"vertical"
===
i
)
o
=
t
.
layout
.
position
[
0
]
-
s
+
n
,
r
=
t
.
layout
.
position
[
1
]
+
a
;
else
if
(
"horizontal"
===
i
&&
"inverse"
===
e
.
direction
)
r
=
t
.
layout
.
position
[
0
]
-
s
+
a
,
o
=
n
-
t
.
layout
.
position
[
1
];
else
if
(
"horizontal"
===
i
)
r
=
t
.
layout
.
position
[
0
]
-
s
+
a
,
o
=
t
.
layout
.
position
[
1
]
+
n
;
else
{
o
=
t
.
layout
.
position
[
0
],
r
=
t
.
layout
.
position
[
1
],
t
.
layout
.
originPosition
=
[
o
,
r
];
var
l
=
r
,
m
=
(
o
-
h
)
/
this
.
width
*
Math
.
PI
*
2
;
o
=
l
*
Math
.
cos
(
m
)
+
n
,
r
=
l
*
Math
.
sin
(
m
)
+
a
,
t
.
layout
.
angle
=
m
}
t
.
layout
.
position
[
0
]
=
o
,
t
.
layout
.
position
[
1
]
=
r
},
this
)},
refresh
:
function
(
e
){
this
.
clear
(),
e
&&
(
this
.
option
=
e
,
this
.
series
=
this
.
option
.
series
);
for
(
var
t
=
this
.
series
,
i
=
this
.
component
.
legend
,
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
].
type
===
m
.
CHART_TYPE_TREE
){
t
[
n
]
=
this
.
reformOption
(
t
[
n
]);
var
a
=
t
[
n
].
name
||
""
;
if
(
this
.
selectedMap
[
a
]
=
i
?
i
.
isSelected
(
a
):
!
0
,
!
this
.
selectedMap
[
a
])
continue
;
this
.
_buildSeries
(
t
[
n
],
n
)}},
_buildSeries
:
function
(
e
,
t
){
this
.
_buildShape
(
e
,
t
)}},
U
.
inherits
(
t
,
i
),
e
(
"../chart"
).
define
(
"tree"
,
t
),
t
}),
define
(
"echarts/layout/Tree"
,[
"require"
,
"zrender/tool/vector"
],
function
(
e
){
function
t
(
e
){
e
=
e
||
{},
this
.
nodePadding
=
e
.
nodePadding
||
30
,
this
.
layerPadding
=
e
.
layerPadding
||
100
,
this
.
_layerOffsets
=
[],
this
.
_layers
=
[]}
var
i
=
e
(
"zrender/tool/vector"
);
return
t
.
prototype
.
run
=
function
(
e
){
this
.
_layerOffsets
.
length
=
0
;
for
(
var
t
=
0
;
t
<
e
.
root
.
height
+
1
;
t
++
)
this
.
_layerOffsets
[
t
]
=
0
,
this
.
_layers
[
t
]
=
[];
this
.
_updateNodeXPosition
(
e
.
root
);
var
i
=
e
.
root
;
this
.
_updateNodeYPosition
(
i
,
0
,
i
.
layout
.
height
)},
t
.
prototype
.
_updateNodeXPosition
=
function
(
e
){
var
t
=
1
/
0
,
n
=-
(
1
/
0
);
e
.
layout
.
position
=
e
.
layout
.
position
||
i
.
create
();
for
(
var
a
=
0
;
a
<
e
.
children
.
length
;
a
++
){
var
o
=
e
.
children
[
a
];
this
.
_updateNodeXPosition
(
o
);
var
r
=
o
.
layout
.
position
[
0
];
t
>
r
&&
(
t
=
r
),
r
>
n
&&
(
n
=
r
)}
e
.
layout
.
position
[
0
]
=
e
.
children
.
length
>
0
?(
t
+
n
)
/
2
:
0
;
var
s
=
this
.
_layerOffsets
[
e
.
depth
]
||
0
;
if
(
s
>
e
.
layout
.
position
[
0
]){
var
l
=
s
-
e
.
layout
.
position
[
0
];
this
.
_shiftSubtree
(
e
,
l
);
for
(
var
a
=
e
.
depth
+
1
;
a
<
e
.
height
+
e
.
depth
;
a
++
)
this
.
_layerOffsets
[
a
]
+=
l
}
this
.
_layerOffsets
[
e
.
depth
]
=
e
.
layout
.
position
[
0
]
+
e
.
layout
.
width
+
this
.
nodePadding
,
this
.
_layers
[
e
.
depth
].
push
(
e
)},
t
.
prototype
.
_shiftSubtree
=
function
(
e
,
t
){
e
.
layout
.
position
[
0
]
+=
t
;
for
(
var
i
=
0
;
i
<
e
.
children
.
length
;
i
++
)
this
.
_shiftSubtree
(
e
.
children
[
i
],
t
)},
t
.
prototype
.
_updateNodeYPosition
=
function
(
e
,
t
,
i
){
e
.
layout
.
position
[
1
]
=
t
;
for
(
var
n
=
0
,
a
=
0
;
a
<
e
.
children
.
length
;
a
++
)
n
=
Math
.
max
(
e
.
children
[
a
].
layout
.
height
,
n
);
var
o
=
this
.
layerPadding
;
"function"
==
typeof
o
&&
(
o
=
o
(
e
.
depth
));
for
(
var
a
=
0
;
a
<
e
.
children
.
length
;
a
++
)
this
.
_updateNodeYPosition
(
e
.
children
[
a
],
t
+
o
+
i
,
n
)},
t
}),
define
(
"echarts/data/Tree"
,[
"require"
,
"zrender/tool/util"
],
function
(
e
){
function
t
(
e
,
t
){
this
.
id
=
e
,
this
.
depth
=
0
,
this
.
height
=
0
,
this
.
children
=
[],
this
.
parent
=
null
,
this
.
data
=
t
||
null
}
function
i
(
e
){
this
.
root
=
new
t
(
e
)}
var
n
=
e
(
"zrender/tool/util"
);
return
t
.
prototype
.
add
=
function
(
e
){
var
t
=
this
.
children
;
e
.
parent
!==
this
&&
(
t
.
push
(
e
),
e
.
parent
=
this
)},
t
.
prototype
.
remove
=
function
(
e
){
var
t
=
this
.
children
,
i
=
n
.
indexOf
(
t
,
e
);
i
>=
0
&&
(
t
.
splice
(
i
,
1
),
e
.
parent
=
null
)},
t
.
prototype
.
traverse
=
function
(
e
,
t
){
e
.
call
(
t
,
this
);
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
this
.
children
[
i
].
traverse
(
e
,
t
)},
t
.
prototype
.
updateDepthAndHeight
=
function
(
e
){
var
t
=
0
;
this
.
depth
=
e
;
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
){
var
n
=
this
.
children
[
i
];
n
.
updateDepthAndHeight
(
e
+
1
),
n
.
height
>
t
&&
(
t
=
n
.
height
)}
this
.
height
=
t
+
1
},
t
.
prototype
.
getNodeById
=
function
(
e
){
if
(
this
.
id
===
e
)
return
this
;
for
(
var
t
=
0
;
t
<
this
.
children
.
length
;
t
++
){
var
i
=
this
.
children
[
t
].
getNodeById
(
e
);
if
(
i
)
return
i
}},
i
.
prototype
.
traverse
=
function
(
e
,
t
){
this
.
root
.
traverse
(
e
,
t
)},
i
.
prototype
.
getSubTree
=
function
(
e
){
var
t
=
this
.
getNodeById
(
e
);
if
(
t
){
var
n
=
new
i
(
t
.
id
);
return
n
.
root
=
t
,
n
}},
i
.
prototype
.
getNodeById
=
function
(
e
){
return
this
.
root
.
getNodeById
(
e
)},
i
.
fromOptionData
=
function
(
e
,
n
){
function
a
(
e
,
i
){
var
n
=
new
t
(
e
.
name
,
e
);
i
.
add
(
n
);
var
o
=
e
.
children
;
if
(
o
)
for
(
var
r
=
0
;
r
<
o
.
length
;
r
++
)
a
(
o
[
r
],
n
)}
var
o
=
new
i
(
e
),
r
=
o
.
root
;
r
.
data
=
{
name
:
e
,
children
:
n
};
for
(
var
s
=
0
;
s
<
n
.
length
;
s
++
)
a
(
n
[
s
],
r
);
return
o
.
root
.
updateDepthAndHeight
(
0
),
o
},
i
.
fromGraph
=
function
(
e
){
function
n
(
t
){
for
(
var
i
=
e
.
getNodeById
(
t
.
id
),
a
=
0
;
a
<
i
.
outEdges
.
length
;
a
++
){
var
r
=
i
.
outEdges
[
a
],
s
=
o
[
r
.
node2
.
id
];
t
.
children
.
push
(
s
),
n
(
s
)}}
for
(
var
a
=
{},
o
=
{},
r
=
0
;
r
<
e
.
nodes
.
length
;
r
++
){
var
s
,
l
=
e
.
nodes
[
r
];
0
===
l
.
inDegree
()?(
a
[
l
.
id
]
=
new
i
(
l
.
id
),
s
=
a
[
l
.
id
].
root
):
s
=
new
t
(
l
.
id
),
s
.
data
=
l
.
data
,
o
[
l
.
id
]
=
s
}
var
h
=
[];
for
(
var
m
in
a
)
n
(
a
[
m
].
root
),
a
[
m
].
root
.
updateDepthAndHeight
(
0
),
h
.
push
(
a
[
m
]);
return
h
},
i
});
define
(
"echarts/chart/tree"
,[
"require"
,
"./base"
,
"../util/shape/Icon"
,
"zrender/shape/Image"
,
"zrender/shape/Line"
,
"zrender/shape/BezierCurve"
,
"../layout/TreeView"
,
"../data/TreeView"
,
"../config"
,
"../util/ecData"
,
"zrender/config"
,
"zrender/tool/event"
,
"zrender/tool/util"
,
"../chart"
],
function
(
e
){
function
t
(
e
,
t
,
n
,
a
,
o
){
i
.
call
(
this
,
e
,
t
,
n
,
a
,
o
),
this
.
refresh
(
a
)}
var
i
=
e
(
"./base"
),
n
=
.
618
,
a
=
e
(
"../util/shape/Icon"
),
o
=
e
(
"zrender/shape/Image"
),
r
=
e
(
"zrender/shape/Line"
),
s
=
e
(
"zrender/shape/BezierCurve"
),
l
=
e
(
"../layout/TreeView"
),
h
=
e
(
"../data/TreeView"
),
m
=
e
(
"../config"
);
m
.
tree
=
{
zlevel
:
1
,
z
:
2
,
calculable
:
!
1
,
clickable
:
!
0
,
rootLocation
:{},
orient
:
"vertical"
,
symbol
:
"circle"
,
symbolSize
:
20
,
nodePadding
:
30
,
layerPadding
:
100
,
itemStyle
:{
normal
:{
label
:{
show
:
!
0
},
lineStyle
:{
width
:
1
,
color
:
"#777"
,
type
:
"curve"
}},
emphasis
:{}}};
var
V
=
e
(
"../util/ecData"
),
U
=
(
e
(
"zrender/config"
),
e
(
"zrender/tool/event"
),
e
(
"zrender/tool/util"
));
return
t
.
prototype
=
{
type
:
m
.
CHART_TYPE_TREE
,
_buildShape
:
function
(
e
,
t
){
var
i
=
e
.
data
[
0
];
this
.
tree
=
h
.
fromOptionData
(
i
.
name
,
i
.
children
),
this
.
tree
.
root
.
data
=
i
,
this
.
_setTreeShape
(
e
),
this
.
tree
.
traverse
(
function
(
i
){
this
.
_buildItem
(
i
,
e
,
t
),
i
.
children
.
length
>
0
&&
this
.
_buildLink
(
i
,
e
)},
this
);
var
n
=
e
.
roam
===!
0
||
"move"
===
e
.
roam
,
a
=
e
.
roam
===!
0
||
"scale"
===
e
.
roam
;
this
.
zr
.
modLayer
(
this
.
getZlevelBase
(),{
panable
:
n
,
zoomable
:
a
}),(
this
.
query
(
"markPoint.effect.show"
)
||
this
.
query
(
"markLine.effect.show"
))
&&
this
.
zr
.
modLayer
(
m
.
EFFECT_ZLEVEL
,{
panable
:
n
,
zoomable
:
a
}),
this
.
addShapeList
()},
_buildItem
:
function
(
e
,
t
,
i
){
var
n
=
[
e
.
data
,
t
],
r
=
this
.
deepQuery
(
n
,
"symbol"
),
s
=
this
.
deepMerge
(
n
,
"itemStyle.normal"
)
||
{},
l
=
this
.
deepMerge
(
n
,
"itemStyle.emphasis"
)
||
{},
h
=
s
.
color
||
this
.
zr
.
getColor
(),
m
=
l
.
color
||
this
.
zr
.
getColor
(),
U
=-
e
.
layout
.
angle
||
0
;
e
.
id
===
this
.
tree
.
root
.
id
&&
(
U
=
0
);
var
d
=
"right"
;
Math
.
abs
(
U
)
>=
Math
.
PI
/
2
&&
Math
.
abs
(
U
)
<
3
*
Math
.
PI
/
2
&&
(
U
+=
Math
.
PI
,
d
=
"left"
);
var
p
=
[
U
,
e
.
layout
.
position
[
0
],
e
.
layout
.
position
[
1
]],
c
=
new
a
({
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
()
+
1
,
rotation
:
p
,
clickable
:
this
.
deepQuery
(
n
,
"clickable"
),
style
:{
x
:
e
.
layout
.
position
[
0
]
-
.
5
*
e
.
layout
.
width
,
y
:
e
.
layout
.
position
[
1
]
-
.
5
*
e
.
layout
.
height
,
width
:
e
.
layout
.
width
,
height
:
e
.
layout
.
height
,
iconType
:
r
,
color
:
h
,
brushType
:
"both"
,
lineWidth
:
s
.
borderWidth
,
strokeColor
:
s
.
borderColor
},
highlightStyle
:{
color
:
m
,
lineWidth
:
l
.
borderWidth
,
strokeColor
:
l
.
borderColor
}});
c
.
style
.
iconType
.
match
(
"image"
)
&&
(
c
.
style
.
image
=
c
.
style
.
iconType
.
replace
(
new
RegExp
(
"^image:
\\
/
\\
/"
),
""
),
c
=
new
o
({
rotation
:
p
,
style
:
c
.
style
,
highlightStyle
:
c
.
highlightStyle
,
clickable
:
c
.
clickable
,
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
()})),
this
.
deepQuery
(
n
,
"itemStyle.normal.label.show"
)
&&
(
c
.
style
.
text
=
null
==
e
.
data
.
label
?
e
.
id
:
e
.
data
.
label
,
c
.
style
.
textPosition
=
this
.
deepQuery
(
n
,
"itemStyle.normal.label.position"
),
"radial"
===
t
.
orient
&&
"inside"
!==
c
.
style
.
textPosition
&&
(
c
.
style
.
textPosition
=
d
),
c
.
style
.
textColor
=
this
.
deepQuery
(
n
,
"itemStyle.normal.label.textStyle.color"
),
c
.
style
.
textFont
=
this
.
getFont
(
this
.
deepQuery
(
n
,
"itemStyle.normal.label.textStyle"
)
||
{})),
this
.
deepQuery
(
n
,
"itemStyle.emphasis.label.show"
)
&&
(
c
.
highlightStyle
.
textPosition
=
this
.
deepQuery
(
n
,
"itemStyle.emphasis.label.position"
),
c
.
highlightStyle
.
textColor
=
this
.
deepQuery
(
n
,
"itemStyle.emphasis.label.textStyle.color"
),
c
.
highlightStyle
.
textFont
=
this
.
getFont
(
this
.
deepQuery
(
n
,
"itemStyle.emphasis.label.textStyle"
)
||
{})),
V
.
pack
(
c
,
t
,
i
,
e
.
data
,
0
,
e
.
id
),
this
.
shapeList
.
push
(
c
)},
_buildLink
:
function
(
e
,
t
){
var
i
=
t
.
itemStyle
.
normal
.
lineStyle
;
if
(
"broken"
===
i
.
type
)
return
void
this
.
_buildBrokenLine
(
e
,
i
,
t
);
for
(
var
n
=
0
;
n
<
e
.
children
.
length
;
n
++
){
var
a
=
e
.
layout
.
position
[
0
],
o
=
e
.
layout
.
position
[
1
],
r
=
e
.
children
[
n
].
layout
.
position
[
0
],
s
=
e
.
children
[
n
].
layout
.
position
[
1
];
switch
(
i
.
type
){
case
"curve"
:
this
.
_buildBezierCurve
(
e
,
e
.
children
[
n
],
i
,
t
);
break
;
case
"broken"
:
break
;
default
:
var
l
=
this
.
_getLine
(
a
,
o
,
r
,
s
,
i
);
this
.
shapeList
.
push
(
l
)}}},
_buildBrokenLine
:
function
(
e
,
t
,
i
){
var
a
=
U
.
clone
(
t
);
a
.
type
=
"solid"
;
var
o
=
[],
r
=
e
.
layout
.
position
[
0
],
s
=
e
.
layout
.
position
[
1
],
l
=
i
.
orient
,
h
=
e
.
children
[
0
].
layout
.
position
[
1
],
m
=
r
,
V
=
s
+
(
h
-
s
)
*
(
1
-
n
),
d
=
e
.
children
[
0
].
layout
.
position
[
0
],
p
=
V
,
c
=
e
.
children
[
e
.
children
.
length
-
1
].
layout
.
position
[
0
],
u
=
V
;
if
(
"horizontal"
===
l
){
var
y
=
e
.
children
[
0
].
layout
.
position
[
0
];
m
=
r
+
(
y
-
r
)
*
(
1
-
n
),
V
=
s
,
d
=
m
,
p
=
e
.
children
[
0
].
layout
.
position
[
1
],
c
=
m
,
u
=
e
.
children
[
e
.
children
.
length
-
1
].
layout
.
position
[
1
]}
o
.
push
(
this
.
_getLine
(
r
,
s
,
m
,
V
,
a
)),
o
.
push
(
this
.
_getLine
(
d
,
p
,
c
,
u
,
a
));
for
(
var
g
=
0
;
g
<
e
.
children
.
length
;
g
++
)
y
=
e
.
children
[
g
].
layout
.
position
[
0
],
h
=
e
.
children
[
g
].
layout
.
position
[
1
],
"horizontal"
===
l
?
p
=
h
:
d
=
y
,
o
.
push
(
this
.
_getLine
(
d
,
p
,
y
,
h
,
a
));
this
.
shapeList
=
this
.
shapeList
.
concat
(
o
)},
_getLine
:
function
(
e
,
t
,
i
,
n
,
a
){
return
e
===
i
&&
(
e
=
i
=
this
.
subPixelOptimize
(
e
,
a
.
width
)),
t
===
n
&&
(
t
=
n
=
this
.
subPixelOptimize
(
t
,
a
.
width
)),
new
r
({
zlevel
:
this
.
getZlevelBase
(),
hoverable
:
!
1
,
style
:
U
.
merge
({
xStart
:
e
,
yStart
:
t
,
xEnd
:
i
,
yEnd
:
n
,
lineType
:
a
.
type
,
strokeColor
:
a
.
color
,
lineWidth
:
a
.
width
},
a
,
!
0
)})},
_buildBezierCurve
:
function
(
e
,
t
,
i
,
a
){
var
o
=
n
,
r
=
a
.
orient
,
l
=
e
.
layout
.
position
[
0
],
h
=
e
.
layout
.
position
[
1
],
m
=
t
.
layout
.
position
[
0
],
V
=
t
.
layout
.
position
[
1
],
d
=
l
,
p
=
(
V
-
h
)
*
o
+
h
,
c
=
m
,
u
=
(
V
-
h
)
*
(
1
-
o
)
+
h
;
if
(
"horizontal"
===
r
)
d
=
(
m
-
l
)
*
o
+
l
,
p
=
h
,
c
=
(
m
-
l
)
*
(
1
-
o
)
+
l
,
u
=
V
;
else
if
(
"radial"
===
r
)
if
(
e
.
id
===
this
.
tree
.
root
.
id
)
d
=
(
m
-
l
)
*
o
+
l
,
p
=
(
V
-
h
)
*
o
+
h
,
c
=
(
m
-
l
)
*
(
1
-
o
)
+
l
,
u
=
(
V
-
h
)
*
(
1
-
o
)
+
h
;
else
{
var
y
=
e
.
layout
.
originPosition
[
0
],
g
=
e
.
layout
.
originPosition
[
1
],
b
=
t
.
layout
.
originPosition
[
0
],
f
=
t
.
layout
.
originPosition
[
1
],
k
=
this
.
tree
.
root
.
layout
.
position
[
0
],
_
=
this
.
tree
.
root
.
layout
.
position
[
1
];
d
=
y
,
p
=
(
f
-
g
)
*
o
+
g
,
c
=
b
,
u
=
(
f
-
g
)
*
(
1
-
o
)
+
g
;
var
x
=
(
d
-
this
.
minX
)
/
this
.
width
*
Math
.
PI
*
2
;
d
=
p
*
Math
.
cos
(
x
)
+
k
,
p
=
p
*
Math
.
sin
(
x
)
+
_
,
x
=
(
c
-
this
.
minX
)
/
this
.
width
*
Math
.
PI
*
2
,
c
=
u
*
Math
.
cos
(
x
)
+
k
,
u
=
u
*
Math
.
sin
(
x
)
+
_
}
var
L
=
new
s
({
zlevel
:
this
.
getZlevelBase
(),
hoverable
:
!
1
,
style
:
U
.
merge
({
xStart
:
l
,
yStart
:
h
,
cpX1
:
d
,
cpY1
:
p
,
cpX2
:
c
,
cpY2
:
u
,
xEnd
:
m
,
yEnd
:
V
,
strokeColor
:
i
.
color
,
lineWidth
:
i
.
width
},
i
,
!
0
)});
this
.
shapeList
.
push
(
L
)},
_setTreeShape
:
function
(
e
){
var
t
=
new
l
({
nodePadding
:
e
.
nodePadding
,
layerPadding
:
e
.
layerPadding
});
this
.
tree
.
traverse
(
function
(
t
){
var
i
=
[
t
.
data
,
e
],
n
=
this
.
deepQuery
(
i
,
"symbolSize"
);
"number"
==
typeof
n
&&
(
n
=
[
n
,
n
]),
t
.
layout
=
{
width
:
n
[
0
],
height
:
n
[
1
]}},
this
),
t
.
run
(
this
.
tree
);
var
i
=
e
.
orient
,
n
=
e
.
rootLocation
.
x
,
a
=
e
.
rootLocation
.
y
,
o
=
this
.
zr
.
getWidth
(),
r
=
this
.
zr
.
getHeight
();
n
=
"center"
===
n
?.
5
*
o
:
this
.
parsePercent
(
n
,
o
),
a
=
"center"
===
a
?.
5
*
r
:
this
.
parsePercent
(
a
,
r
),
a
=
this
.
parsePercent
(
a
,
r
),
"horizontal"
===
i
&&
(
n
=
isNaN
(
n
)?
10
:
n
,
a
=
isNaN
(
a
)?.
5
*
r
:
a
),
"radial"
===
i
?(
n
=
isNaN
(
n
)?.
5
*
o
:
n
,
a
=
isNaN
(
a
)?.
5
*
r
:
a
):(
n
=
isNaN
(
n
)?.
5
*
o
:
n
,
a
=
isNaN
(
a
)?
10
:
a
);
var
s
=
this
.
tree
.
root
.
layout
.
position
[
0
];
if
(
"radial"
===
i
){
var
h
=
1
/
0
,
m
=
0
,
V
=
0
;
this
.
tree
.
traverse
(
function
(
e
){
m
=
Math
.
max
(
m
,
e
.
layout
.
position
[
0
]),
h
=
Math
.
min
(
h
,
e
.
layout
.
position
[
0
]),
V
=
Math
.
max
(
V
,
e
.
layout
.
width
)}),
this
.
width
=
m
-
h
+
2
*
V
,
this
.
minX
=
h
}
this
.
tree
.
traverse
(
function
(
t
){
var
o
,
r
;
if
(
"vertical"
===
i
&&
"inverse"
===
e
.
direction
)
o
=
t
.
layout
.
position
[
0
]
-
s
+
n
,
r
=
a
-
t
.
layout
.
position
[
1
];
else
if
(
"vertical"
===
i
)
o
=
t
.
layout
.
position
[
0
]
-
s
+
n
,
r
=
t
.
layout
.
position
[
1
]
+
a
;
else
if
(
"horizontal"
===
i
&&
"inverse"
===
e
.
direction
)
r
=
t
.
layout
.
position
[
0
]
-
s
+
a
,
o
=
n
-
t
.
layout
.
position
[
1
];
else
if
(
"horizontal"
===
i
)
r
=
t
.
layout
.
position
[
0
]
-
s
+
a
,
o
=
t
.
layout
.
position
[
1
]
+
n
;
else
{
o
=
t
.
layout
.
position
[
0
],
r
=
t
.
layout
.
position
[
1
],
t
.
layout
.
originPosition
=
[
o
,
r
];
var
l
=
r
,
m
=
(
o
-
h
)
/
this
.
width
*
Math
.
PI
*
2
;
o
=
l
*
Math
.
cos
(
m
)
+
n
,
r
=
l
*
Math
.
sin
(
m
)
+
a
,
t
.
layout
.
angle
=
m
}
t
.
layout
.
position
[
0
]
=
o
,
t
.
layout
.
position
[
1
]
=
r
},
this
)},
refresh
:
function
(
e
){
this
.
clear
(),
e
&&
(
this
.
option
=
e
,
this
.
series
=
this
.
option
.
series
);
for
(
var
t
=
this
.
series
,
i
=
this
.
component
.
legend
,
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
].
type
===
m
.
CHART_TYPE_TREE
){
t
[
n
]
=
this
.
reformOption
(
t
[
n
]);
var
a
=
t
[
n
].
name
||
""
;
if
(
this
.
selectedMap
[
a
]
=
i
?
i
.
isSelected
(
a
):
!
0
,
!
this
.
selectedMap
[
a
])
continue
;
this
.
_buildSeries
(
t
[
n
],
n
)}},
_buildSeries
:
function
(
e
,
t
){
this
.
_buildShape
(
e
,
t
)}},
U
.
inherits
(
t
,
i
),
e
(
"../chart"
).
define
(
"tree"
,
t
),
t
}),
define
(
"echarts/layout/Tree"
,[
"require"
,
"zrender/tool/vector"
],
function
(
e
){
function
t
(
e
){
e
=
e
||
{},
this
.
nodePadding
=
e
.
nodePadding
||
30
,
this
.
layerPadding
=
e
.
layerPadding
||
100
,
this
.
_layerOffsets
=
[],
this
.
_layers
=
[]}
var
i
=
e
(
"zrender/tool/vector"
);
return
t
.
prototype
.
run
=
function
(
e
){
this
.
_layerOffsets
.
length
=
0
;
for
(
var
t
=
0
;
t
<
e
.
root
.
height
+
1
;
t
++
)
this
.
_layerOffsets
[
t
]
=
0
,
this
.
_layers
[
t
]
=
[];
this
.
_updateNodeXPosition
(
e
.
root
);
var
i
=
e
.
root
;
this
.
_updateNodeYPosition
(
i
,
0
,
i
.
layout
.
height
)},
t
.
prototype
.
_updateNodeXPosition
=
function
(
e
){
var
t
=
1
/
0
,
n
=-
(
1
/
0
);
e
.
layout
.
position
=
e
.
layout
.
position
||
i
.
create
();
for
(
var
a
=
0
;
a
<
e
.
children
.
length
;
a
++
){
var
o
=
e
.
children
[
a
];
this
.
_updateNodeXPosition
(
o
);
var
r
=
o
.
layout
.
position
[
0
];
t
>
r
&&
(
t
=
r
),
r
>
n
&&
(
n
=
r
)}
e
.
layout
.
position
[
0
]
=
e
.
children
.
length
>
0
?(
t
+
n
)
/
2
:
0
;
var
s
=
this
.
_layerOffsets
[
e
.
depth
]
||
0
;
if
(
s
>
e
.
layout
.
position
[
0
]){
var
l
=
s
-
e
.
layout
.
position
[
0
];
this
.
_shiftSubtree
(
e
,
l
);
for
(
var
a
=
e
.
depth
+
1
;
a
<
e
.
height
+
e
.
depth
;
a
++
)
this
.
_layerOffsets
[
a
]
+=
l
}
this
.
_layerOffsets
[
e
.
depth
]
=
e
.
layout
.
position
[
0
]
+
e
.
layout
.
width
+
this
.
nodePadding
,
this
.
_layers
[
e
.
depth
].
push
(
e
)},
t
.
prototype
.
_shiftSubtree
=
function
(
e
,
t
){
e
.
layout
.
position
[
0
]
+=
t
;
for
(
var
i
=
0
;
i
<
e
.
children
.
length
;
i
++
)
this
.
_shiftSubtree
(
e
.
children
[
i
],
t
)},
t
.
prototype
.
_updateNodeYPosition
=
function
(
e
,
t
,
i
){
e
.
layout
.
position
[
1
]
=
t
;
for
(
var
n
=
0
,
a
=
0
;
a
<
e
.
children
.
length
;
a
++
)
n
=
Math
.
max
(
e
.
children
[
a
].
layout
.
height
,
n
);
var
o
=
this
.
layerPadding
;
"function"
==
typeof
o
&&
(
o
=
o
(
e
.
depth
));
for
(
var
a
=
0
;
a
<
e
.
children
.
length
;
a
++
)
this
.
_updateNodeYPosition
(
e
.
children
[
a
],
t
+
o
+
i
,
n
)},
t
}),
define
(
"echarts/data/Tree"
,[
"require"
,
"zrender/tool/util"
],
function
(
e
){
function
t
(
e
,
t
){
this
.
id
=
e
,
this
.
depth
=
0
,
this
.
height
=
0
,
this
.
children
=
[],
this
.
parent
=
null
,
this
.
data
=
t
||
null
}
function
i
(
e
){
this
.
root
=
new
t
(
e
)}
var
n
=
e
(
"zrender/tool/util"
);
return
t
.
prototype
.
add
=
function
(
e
){
var
t
=
this
.
children
;
e
.
parent
!==
this
&&
(
t
.
push
(
e
),
e
.
parent
=
this
)},
t
.
prototype
.
remove
=
function
(
e
){
var
t
=
this
.
children
,
i
=
n
.
indexOf
(
t
,
e
);
i
>=
0
&&
(
t
.
splice
(
i
,
1
),
e
.
parent
=
null
)},
t
.
prototype
.
traverse
=
function
(
e
,
t
){
e
.
call
(
t
,
this
);
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
this
.
children
[
i
].
traverse
(
e
,
t
)},
t
.
prototype
.
updateDepthAndHeight
=
function
(
e
){
var
t
=
0
;
this
.
depth
=
e
;
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
){
var
n
=
this
.
children
[
i
];
n
.
updateDepthAndHeight
(
e
+
1
),
n
.
height
>
t
&&
(
t
=
n
.
height
)}
this
.
height
=
t
+
1
},
t
.
prototype
.
getNodeById
=
function
(
e
){
if
(
this
.
id
===
e
)
return
this
;
for
(
var
t
=
0
;
t
<
this
.
children
.
length
;
t
++
){
var
i
=
this
.
children
[
t
].
getNodeById
(
e
);
if
(
i
)
return
i
}},
i
.
prototype
.
traverse
=
function
(
e
,
t
){
this
.
root
.
traverse
(
e
,
t
)},
i
.
prototype
.
getSubTree
=
function
(
e
){
var
t
=
this
.
getNodeById
(
e
);
if
(
t
){
var
n
=
new
i
(
t
.
id
);
return
n
.
root
=
t
,
n
}},
i
.
prototype
.
getNodeById
=
function
(
e
){
return
this
.
root
.
getNodeById
(
e
)},
i
.
fromOptionData
=
function
(
e
,
n
){
function
a
(
e
,
i
){
var
n
=
new
t
(
e
.
name
,
e
);
i
.
add
(
n
);
var
o
=
e
.
children
;
if
(
o
)
for
(
var
r
=
0
;
r
<
o
.
length
;
r
++
)
a
(
o
[
r
],
n
)}
var
o
=
new
i
(
e
),
r
=
o
.
root
;
r
.
data
=
{
name
:
e
,
children
:
n
};
for
(
var
s
=
0
;
s
<
n
.
length
;
s
++
)
a
(
n
[
s
],
r
);
return
o
.
root
.
updateDepthAndHeight
(
0
),
o
},
i
.
fromGraph
=
function
(
e
){
function
n
(
t
){
for
(
var
i
=
e
.
getNodeById
(
t
.
id
),
a
=
0
;
a
<
i
.
outEdges
.
length
;
a
++
){
var
r
=
i
.
outEdges
[
a
],
s
=
o
[
r
.
node2
.
id
];
t
.
children
.
push
(
s
),
n
(
s
)}}
for
(
var
a
=
{},
o
=
{},
r
=
0
;
r
<
e
.
nodes
.
length
;
r
++
){
var
s
,
l
=
e
.
nodes
[
r
];
0
===
l
.
inDegree
()?(
a
[
l
.
id
]
=
new
i
(
l
.
id
),
s
=
a
[
l
.
id
].
root
):
s
=
new
t
(
l
.
id
),
s
.
data
=
l
.
data
,
o
[
l
.
id
]
=
s
}
var
h
=
[];
for
(
var
m
in
a
)
n
(
a
[
m
].
root
),
a
[
m
].
root
.
updateDepthAndHeight
(
0
),
h
.
push
(
a
[
m
]);
return
h
},
i
});
\ No newline at end of file
\ No newline at end of file
apps/static/js/plugins/echarts/chart/treemap.js
View file @
3603b33a
define
(
"echarts/chart/treemap"
,[
"require"
,
"./base"
,
"zrender/tool/area"
,
"zrender/shape/Rectangle"
,
"zrender/shape/Text"
,
"zrender/shape/Line"
,
"../layout/TreeMap"
,
"../data/Tree"
,
"../config"
,
"../util/ecData"
,
"zrender/config"
,
"zrender/tool/event"
,
"zrender/tool/util"
,
"zrender/tool/color"
,
"../chart"
],
function
(
e
){
function
t
(
e
,
t
,
n
,
a
,
o
){
i
.
call
(
this
,
e
,
t
,
n
,
a
,
o
),
this
.
refresh
(
a
);
var
r
=
this
;
r
.
_onclick
=
function
(
e
){
return
r
.
__onclick
(
e
)},
r
.
zr
.
on
(
V
.
EVENT
.
CLICK
,
r
.
_onclick
)}
var
i
=
e
(
"./base"
),
n
=
e
(
"zrender/tool/area"
),
a
=
e
(
"zrender/shape/Rectangle"
),
o
=
e
(
"zrender/shape/Text"
),
r
=
e
(
"zrender/shape/Line"
),
s
=
e
(
"../layout/TreeMap"
),
l
=
e
(
"../data/Tree"
),
h
=
e
(
"../config"
);
h
.
treemap
=
{
zlevel
:
0
,
z
:
1
,
calculable
:
!
1
,
clickable
:
!
0
,
center
:[
"50%"
,
"50%"
],
size
:[
"80%"
,
"80%"
],
root
:
""
,
itemStyle
:{
normal
:{
label
:{
show
:
!
0
,
x
:
5
,
y
:
12
,
textStyle
:{
align
:
"left"
,
color
:
"#000"
,
fontFamily
:
"Arial"
,
fontSize
:
13
,
fontStyle
:
"normal"
,
fontWeight
:
"normal"
}},
breadcrumb
:{
show
:
!
0
,
textStyle
:{}},
borderWidth
:
1
,
borderColor
:
"#ccc"
,
childBorderWidth
:
1
,
childBorderColor
:
"#ccc"
},
emphasis
:{}}};
var
m
=
e
(
"../util/ecData"
),
V
=
e
(
"zrender/config"
),
U
=
(
e
(
"zrender/tool/event"
),
e
(
"zrender/tool/util"
)),
d
=
e
(
"zrender/tool/color"
);
return
t
.
prototype
=
{
type
:
h
.
CHART_TYPE_TREEMAP
,
refresh
:
function
(
e
){
this
.
clear
(),
e
&&
(
this
.
option
=
e
,
this
.
series
=
this
.
option
.
series
),
this
.
_treesMap
=
{};
for
(
var
t
=
this
.
series
,
i
=
this
.
component
.
legend
,
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
].
type
===
h
.
CHART_TYPE_TREEMAP
){
t
[
n
]
=
this
.
reformOption
(
t
[
n
]);
var
a
=
t
[
n
].
name
||
""
;
if
(
this
.
selectedMap
[
a
]
=
i
?
i
.
isSelected
(
a
):
!
0
,
!
this
.
selectedMap
[
a
])
continue
;
this
.
_buildSeries
(
t
[
n
],
n
)}},
_buildSeries
:
function
(
e
,
t
){
var
i
=
l
.
fromOptionData
(
e
.
name
,
e
.
data
);
this
.
_treesMap
[
t
]
=
i
;
var
n
=
e
.
root
&&
i
.
getNodeById
(
e
.
root
)
||
i
.
root
;
this
.
_buildTreemap
(
n
,
t
)},
_buildTreemap
:
function
(
e
,
t
){
for
(
var
i
=
this
.
shapeList
,
n
=
0
;
n
<
i
.
length
;){
var
a
=
i
[
n
];
m
.
get
(
a
,
"seriesIndex"
)
===
t
?(
this
.
zr
.
delShape
(
i
[
n
]),
i
.
splice
(
n
,
1
)):
n
++
}
for
(
var
o
=
i
.
length
,
r
=
this
.
series
[
t
],
l
=
r
.
itemStyle
,
h
=
this
.
parsePercent
(
r
.
size
[
0
],
this
.
zr
.
getWidth
())
||
400
,
V
=
this
.
parsePercent
(
r
.
size
[
1
],
this
.
zr
.
getHeight
())
||
500
,
U
=
this
.
parseCenter
(
this
.
zr
,
r
.
center
),
d
=
U
[
0
]
-
.
5
*
h
,
p
=
U
[
1
]
-
.
5
*
V
,
c
=
h
*
V
,
u
=
0
,
y
=
[],
g
=
e
.
children
,
n
=
0
;
n
<
g
.
length
;
n
++
)
u
+=
g
[
n
].
data
.
value
;
for
(
var
b
=
0
;
b
<
g
.
length
;
b
++
)
y
.
push
(
g
[
b
].
data
.
value
*
c
/
u
);
for
(
var
f
=
new
s
({
x
:
d
,
y
:
p
,
width
:
h
,
height
:
V
}),
k
=
f
.
run
(
y
),
_
=
0
;
_
<
k
.
length
;
_
++
){
var
x
=
g
[
_
].
data
,
L
=
k
[
_
],
W
=
[
x
.
itemStyle
,
l
],
X
=
this
.
deepMerge
(
W
);
X
.
normal
.
color
||
(
X
.
normal
.
color
=
this
.
zr
.
getColor
(
_
)),
X
.
emphasis
.
color
||
(
X
.
emphasis
.
color
=
X
.
normal
.
color
),
this
.
_buildItem
(
x
,
X
,
L
,
t
,
_
),
x
.
children
&&
this
.
_buildChildrenTreemap
(
x
.
children
,
X
,
L
,
t
)}
this
.
query
(
r
,
"itemStyle.normal.breadcrumb.show"
)
&&
this
.
_buildBreadcrumb
(
e
,
t
,
d
,
p
+
V
);
for
(
var
n
=
o
;
n
<
i
.
length
;
n
++
)
this
.
zr
.
addShape
(
i
[
n
])},
_buildItem
:
function
(
e
,
t
,
i
,
n
,
a
){
var
o
=
this
.
series
,
r
=
this
.
getRectangle
(
e
,
t
,
i
);
m
.
pack
(
r
,
o
[
n
],
n
,
e
,
a
,
e
.
name
),
this
.
shapeList
.
push
(
r
)},
getRectangle
:
function
(
e
,
t
,
i
){
var
n
=
t
.
emphasis
,
o
=
t
.
normal
,
r
=
this
.
getLabel
(
t
,
i
,
e
.
name
,
e
.
value
),
s
=
this
.
option
.
hoverable
,
l
=
{
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
(),
hoverable
:
s
,
clickable
:
!
0
,
style
:
U
.
merge
({
x
:
i
.
x
,
y
:
i
.
y
,
width
:
i
.
width
,
height
:
i
.
height
,
brushType
:
"both"
,
color
:
o
.
color
,
lineWidth
:
o
.
borderWidth
,
strokeColor
:
o
.
borderColor
},
r
.
style
,
!
0
),
highlightStyle
:
U
.
merge
({
color
:
n
.
color
,
lineWidth
:
n
.
borderWidth
,
strokeColor
:
n
.
borderColor
},
r
.
highlightStyle
,
!
0
)};
return
new
a
(
l
)},
getLabel
:
function
(
e
,
t
,
i
,
a
){
var
o
=
e
.
normal
.
label
.
textStyle
,
r
=
[
e
.
emphasis
.
label
.
textStyle
,
o
],
s
=
this
.
deepMerge
(
r
),
l
=
e
.
normal
.
label
.
formatter
,
h
=
this
.
getLabelText
(
i
,
a
,
l
),
m
=
this
.
getFont
(
o
),
V
=
n
.
getTextWidth
(
h
,
m
),
U
=
n
.
getTextHeight
(
h
,
m
),
d
=
this
.
deepQuery
([
e
.
emphasis
,
e
.
normal
],
"label.formatter"
),
p
=
this
.
getLabelText
(
i
,
a
,
d
),
c
=
this
.
getFont
(
s
),
u
=
n
.
getTextWidth
(
h
,
c
),
y
=
n
.
getTextHeight
(
h
,
c
);
e
.
normal
.
label
.
show
?(
e
.
normal
.
label
.
x
+
V
>
t
.
width
||
e
.
normal
.
label
.
y
+
U
>
t
.
height
)
&&
(
h
=
""
):
h
=
""
,
e
.
emphasis
.
label
.
show
?(
s
.
x
+
u
>
t
.
width
||
s
.
y
+
y
>
t
.
height
)
&&
(
p
=
""
):
p
=
""
;
var
g
=
{
style
:{
textX
:
t
.
x
+
e
.
normal
.
label
.
x
,
textY
:
t
.
y
+
e
.
normal
.
label
.
y
,
text
:
h
,
textPosition
:
"specific"
,
textColor
:
o
.
color
,
textFont
:
m
},
highlightStyle
:{
textX
:
t
.
x
+
e
.
emphasis
.
label
.
x
,
textY
:
t
.
y
+
e
.
emphasis
.
label
.
y
,
text
:
p
,
textColor
:
s
.
color
,
textPosition
:
"specific"
}};
return
g
},
getLabelText
:
function
(
e
,
t
,
i
){
return
i
?
"function"
==
typeof
i
?
i
.
call
(
this
.
myChart
,
e
,
t
):
"string"
==
typeof
i
?(
i
=
i
.
replace
(
"{b}"
,
"{b0}"
).
replace
(
"{c}"
,
"{c0}"
),
i
=
i
.
replace
(
"{b0}"
,
e
).
replace
(
"{c0}"
,
t
)):
void
0
:
e
},
_buildChildrenTreemap
:
function
(
e
,
t
,
i
,
n
){
for
(
var
a
=
i
.
width
*
i
.
height
,
o
=
0
,
r
=
[],
l
=
0
;
l
<
e
.
length
;
l
++
)
o
+=
e
[
l
].
value
;
for
(
var
h
=
0
;
h
<
e
.
length
;
h
++
)
r
.
push
(
e
[
h
].
value
*
a
/
o
);
for
(
var
V
=
new
s
({
x
:
i
.
x
,
y
:
i
.
y
,
width
:
i
.
width
,
height
:
i
.
height
}),
U
=
V
.
run
(
r
),
d
=
t
.
normal
.
childBorderWidth
,
p
=
t
.
normal
.
childBorderColor
,
c
=
0
;
c
<
U
.
length
;
c
++
){
var
u
=
U
[
c
],
y
=
[];
i
.
y
.
toFixed
(
2
)
!==
u
.
y
.
toFixed
(
2
)
&&
y
.
push
(
this
.
_getLine
(
u
.
x
,
u
.
y
,
u
.
x
+
u
.
width
,
u
.
y
,
d
,
p
)),
i
.
x
.
toFixed
(
2
)
!==
u
.
x
.
toFixed
(
2
)
&&
y
.
push
(
this
.
_getLine
(
u
.
x
,
u
.
y
,
u
.
x
,
u
.
y
+
u
.
height
,
d
,
p
)),(
i
.
y
+
i
.
height
).
toFixed
(
2
)
!==
(
u
.
y
+
u
.
height
).
toFixed
(
2
)
&&
y
.
push
(
this
.
_getLine
(
u
.
x
,
u
.
y
+
u
.
height
,
u
.
x
+
u
.
width
,
u
.
y
+
u
.
height
,
d
,
p
)),(
i
.
x
+
i
.
width
).
toFixed
(
2
)
!==
(
u
.
x
+
u
.
width
).
toFixed
(
2
)
&&
y
.
push
(
this
.
_getLine
(
u
.
x
+
u
.
width
,
u
.
y
,
u
.
x
+
u
.
width
,
u
.
y
+
u
.
height
,
d
,
p
));
for
(
var
g
=
0
;
g
<
y
.
length
;
g
++
)
m
.
set
(
y
[
g
],
"seriesIndex"
,
n
),
this
.
shapeList
.
push
(
y
[
g
])}},
_getLine
:
function
(
e
,
t
,
i
,
n
,
a
,
o
){
var
s
=
{
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
(),
hoverable
:
!
1
,
style
:{
xStart
:
e
,
yStart
:
t
,
xEnd
:
i
,
yEnd
:
n
,
lineWidth
:
a
,
strokeColor
:
o
}};
return
new
r
(
s
)},
_buildBreadcrumb
:
function
(
e
,
t
,
i
,
n
){
for
(
var
a
=
[],
r
=
e
;
r
;)
a
.
unshift
(
r
.
data
.
name
),
r
=
r
.
parent
;
for
(
var
s
=
this
.
series
[
t
],
l
=
this
.
query
(
s
,
"itemStyle.normal.breadcrumb.textStyle"
)
||
{},
h
=
this
.
query
(
s
,
"itemStyle.emphasis.breadcrumb.textStyle"
)
||
{},
V
=
{
y
:
n
+
10
,
textBaseline
:
"top"
,
textAlign
:
"left"
,
color
:
l
.
color
,
textFont
:
this
.
getFont
(
l
)},
p
=
{
brushType
:
"fill"
,
color
:
h
.
color
||
d
.
lift
(
l
.
color
,
-
.
3
),
textFont
:
this
.
getFont
(
h
)},
c
=
0
;
c
<
a
.
length
;
c
++
){
var
u
=
new
o
({
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
(),
style
:
U
.
merge
({
x
:
i
,
text
:
a
[
c
]
+
(
a
.
length
-
1
-
c
?
" > "
:
""
)},
V
),
clickable
:
!
0
,
highlightStyle
:
p
});
m
.
set
(
u
,
"seriesIndex"
,
t
),
m
.
set
(
u
,
"name"
,
a
[
c
]),
i
+=
u
.
getRect
(
u
.
style
).
width
,
this
.
shapeList
.
push
(
u
)}},
__onclick
:
function
(
e
){
var
t
=
e
.
target
;
if
(
t
){
var
i
=
m
.
get
(
t
,
"seriesIndex"
),
n
=
m
.
get
(
t
,
"name"
),
a
=
this
.
_treesMap
[
i
],
o
=
a
.
getNodeById
(
n
);
o
&&
o
.
children
.
length
&&
this
.
_buildTreemap
(
o
,
i
)}}},
U
.
inherits
(
t
,
i
),
e
(
"../chart"
).
define
(
"treemap"
,
t
),
t
}),
define
(
"echarts/layout/TreeMap"
,[
"require"
],
function
(){
function
e
(
e
){({
x
:
e
.
x
,
y
:
e
.
y
,
width
:
e
.
width
,
height
:
e
.
height
});
this
.
x
=
e
.
x
,
this
.
y
=
e
.
y
,
this
.
width
=
e
.
width
,
this
.
height
=
e
.
height
}
return
e
.
prototype
.
run
=
function
(
e
){
var
t
=
[];
return
this
.
_squarify
(
e
,{
x
:
this
.
x
,
y
:
this
.
y
,
width
:
this
.
width
,
height
:
this
.
height
},
t
),
t
},
e
.
prototype
.
_squarify
=
function
(
e
,
t
,
i
){
var
n
=
"VERTICAL"
,
a
=
t
.
width
,
o
=
t
.
height
;
t
.
width
<
t
.
height
&&
(
n
=
"HORIZONTAL"
,
a
=
t
.
height
,
o
=
t
.
width
);
for
(
var
r
=
this
.
_getShapeListInAbstractRow
(
e
,
a
,
o
),
s
=
0
;
s
<
r
.
length
;
s
++
){
r
[
s
].
x
=
0
,
r
[
s
].
y
=
0
;
for
(
var
l
=
0
;
s
>
l
;
l
++
)
r
[
s
].
y
+=
r
[
l
].
height
}
var
h
=
{};
if
(
"VERTICAL"
==
n
){
for
(
var
m
=
0
;
m
<
r
.
length
;
m
++
)
i
.
push
({
x
:
r
[
m
].
x
+
t
.
x
,
y
:
r
[
m
].
y
+
t
.
y
,
width
:
r
[
m
].
width
,
height
:
r
[
m
].
height
});
h
=
{
x
:
r
[
0
].
width
+
t
.
x
,
y
:
t
.
y
,
width
:
t
.
width
-
r
[
0
].
width
,
height
:
t
.
height
}}
else
{
for
(
var
V
=
0
;
V
<
r
.
length
;
V
++
)
i
.
push
({
x
:
r
[
V
].
y
+
t
.
x
,
y
:
r
[
V
].
x
+
t
.
y
,
width
:
r
[
V
].
height
,
height
:
r
[
V
].
width
});
h
=
{
x
:
t
.
x
,
y
:
t
.
y
+
r
[
0
].
width
,
width
:
t
.
width
,
height
:
t
.
height
-
r
[
0
].
width
}}
var
U
=
e
.
slice
(
r
.
length
);
0
!==
U
.
length
&&
this
.
_squarify
(
U
,
h
,
i
)},
e
.
prototype
.
_getShapeListInAbstractRow
=
function
(
e
,
t
,
i
){
if
(
1
===
e
.
length
)
return
[{
width
:
t
,
height
:
i
}];
for
(
var
n
=
1
;
n
<
e
.
length
;
n
++
){
var
a
=
this
.
_placeFixedNumberRectangles
(
e
.
slice
(
0
,
n
),
t
,
i
),
o
=
this
.
_placeFixedNumberRectangles
(
e
.
slice
(
0
,
n
+
1
),
t
,
i
);
if
(
this
.
_isFirstBetter
(
a
,
o
))
return
a
}},
e
.
prototype
.
_placeFixedNumberRectangles
=
function
(
e
,
t
,
i
){
for
(
var
n
=
e
.
length
,
a
=
[],
o
=
0
,
r
=
0
;
r
<
e
.
length
;
r
++
)
o
+=
e
[
r
];
for
(
var
s
=
o
/
i
,
l
=
0
;
n
>
l
;
l
++
){
var
h
=
i
*
e
[
l
]
/
o
;
a
.
push
({
width
:
s
,
height
:
h
})}
return
a
},
e
.
prototype
.
_isFirstBetter
=
function
(
e
,
t
){
var
i
=
e
[
0
].
height
/
e
[
0
].
width
;
i
=
i
>
1
?
1
/
i
:
i
;
var
n
=
t
[
0
].
height
/
t
[
0
].
width
;
return
n
=
n
>
1
?
1
/
n
:
n
,
Math
.
abs
(
i
-
1
)
<=
Math
.
abs
(
n
-
1
)?
!
0
:
!
1
},
e
}),
define
(
"echarts/data/Tree"
,[
"require"
,
"zrender/tool/util"
],
function
(
e
){
function
t
(
e
,
t
){
this
.
id
=
e
,
this
.
depth
=
0
,
this
.
height
=
0
,
this
.
children
=
[],
this
.
parent
=
null
,
this
.
data
=
t
||
null
}
function
i
(
e
){
this
.
root
=
new
t
(
e
)}
var
n
=
e
(
"zrender/tool/util"
);
return
t
.
prototype
.
add
=
function
(
e
){
var
t
=
this
.
children
;
e
.
parent
!==
this
&&
(
t
.
push
(
e
),
e
.
parent
=
this
)},
t
.
prototype
.
remove
=
function
(
e
){
var
t
=
this
.
children
,
i
=
n
.
indexOf
(
t
,
e
);
i
>=
0
&&
(
t
.
splice
(
i
,
1
),
e
.
parent
=
null
)},
t
.
prototype
.
traverse
=
function
(
e
,
t
){
e
.
call
(
t
,
this
);
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
this
.
children
[
i
].
traverse
(
e
,
t
)},
t
.
prototype
.
updateDepthAndHeight
=
function
(
e
){
var
t
=
0
;
this
.
depth
=
e
;
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
){
var
n
=
this
.
children
[
i
];
n
.
updateDepthAndHeight
(
e
+
1
),
n
.
height
>
t
&&
(
t
=
n
.
height
)}
this
.
height
=
t
+
1
},
t
.
prototype
.
getNodeById
=
function
(
e
){
if
(
this
.
id
===
e
)
return
this
;
for
(
var
t
=
0
;
t
<
this
.
children
.
length
;
t
++
){
var
i
=
this
.
children
[
t
].
getNodeById
(
e
);
if
(
i
)
return
i
}},
i
.
prototype
.
traverse
=
function
(
e
,
t
){
this
.
root
.
traverse
(
e
,
t
)},
i
.
prototype
.
getSubTree
=
function
(
e
){
var
t
=
this
.
getNodeById
(
e
);
if
(
t
){
var
n
=
new
i
(
t
.
id
);
return
n
.
root
=
t
,
n
}},
i
.
prototype
.
getNodeById
=
function
(
e
){
return
this
.
root
.
getNodeById
(
e
)},
i
.
fromOptionData
=
function
(
e
,
n
){
function
a
(
e
,
i
){
var
n
=
new
t
(
e
.
name
,
e
);
i
.
add
(
n
);
var
o
=
e
.
children
;
if
(
o
)
for
(
var
r
=
0
;
r
<
o
.
length
;
r
++
)
a
(
o
[
r
],
n
)}
var
o
=
new
i
(
e
),
r
=
o
.
root
;
r
.
data
=
{
name
:
e
,
children
:
n
};
for
(
var
s
=
0
;
s
<
n
.
length
;
s
++
)
a
(
n
[
s
],
r
);
return
o
.
root
.
updateDepthAndHeight
(
0
),
o
},
i
.
fromGraph
=
function
(
e
){
function
n
(
t
){
for
(
var
i
=
e
.
getNodeById
(
t
.
id
),
a
=
0
;
a
<
i
.
outEdges
.
length
;
a
++
){
var
r
=
i
.
outEdges
[
a
],
s
=
o
[
r
.
node2
.
id
];
t
.
children
.
push
(
s
),
n
(
s
)}}
for
(
var
a
=
{},
o
=
{},
r
=
0
;
r
<
e
.
nodes
.
length
;
r
++
){
var
s
,
l
=
e
.
nodes
[
r
];
0
===
l
.
inDegree
()?(
a
[
l
.
id
]
=
new
i
(
l
.
id
),
s
=
a
[
l
.
id
].
root
):
s
=
new
t
(
l
.
id
),
s
.
data
=
l
.
data
,
o
[
l
.
id
]
=
s
}
var
h
=
[];
for
(
var
m
in
a
)
n
(
a
[
m
].
root
),
a
[
m
].
root
.
updateDepthAndHeight
(
0
),
h
.
push
(
a
[
m
]);
return
h
},
i
});
define
(
"echarts/chart/treemap"
,[
"require"
,
"./base"
,
"zrender/tool/area"
,
"zrender/shape/Rectangle"
,
"zrender/shape/Text"
,
"zrender/shape/Line"
,
"../layout/TreeMap"
,
"../data/TreeView"
,
"../config"
,
"../util/ecData"
,
"zrender/config"
,
"zrender/tool/event"
,
"zrender/tool/util"
,
"zrender/tool/color"
,
"../chart"
],
function
(
e
){
function
t
(
e
,
t
,
n
,
a
,
o
){
i
.
call
(
this
,
e
,
t
,
n
,
a
,
o
),
this
.
refresh
(
a
);
var
r
=
this
;
r
.
_onclick
=
function
(
e
){
return
r
.
__onclick
(
e
)},
r
.
zr
.
on
(
V
.
EVENT
.
CLICK
,
r
.
_onclick
)}
var
i
=
e
(
"./base"
),
n
=
e
(
"zrender/tool/area"
),
a
=
e
(
"zrender/shape/Rectangle"
),
o
=
e
(
"zrender/shape/Text"
),
r
=
e
(
"zrender/shape/Line"
),
s
=
e
(
"../layout/TreeMap"
),
l
=
e
(
"../data/TreeView"
),
h
=
e
(
"../config"
);
h
.
treemap
=
{
zlevel
:
0
,
z
:
1
,
calculable
:
!
1
,
clickable
:
!
0
,
center
:[
"50%"
,
"50%"
],
size
:[
"80%"
,
"80%"
],
root
:
""
,
itemStyle
:{
normal
:{
label
:{
show
:
!
0
,
x
:
5
,
y
:
12
,
textStyle
:{
align
:
"left"
,
color
:
"#000"
,
fontFamily
:
"Arial"
,
fontSize
:
13
,
fontStyle
:
"normal"
,
fontWeight
:
"normal"
}},
breadcrumb
:{
show
:
!
0
,
textStyle
:{}},
borderWidth
:
1
,
borderColor
:
"#ccc"
,
childBorderWidth
:
1
,
childBorderColor
:
"#ccc"
},
emphasis
:{}}};
var
m
=
e
(
"../util/ecData"
),
V
=
e
(
"zrender/config"
),
U
=
(
e
(
"zrender/tool/event"
),
e
(
"zrender/tool/util"
)),
d
=
e
(
"zrender/tool/color"
);
return
t
.
prototype
=
{
type
:
h
.
CHART_TYPE_TREEMAP
,
refresh
:
function
(
e
){
this
.
clear
(),
e
&&
(
this
.
option
=
e
,
this
.
series
=
this
.
option
.
series
),
this
.
_treesMap
=
{};
for
(
var
t
=
this
.
series
,
i
=
this
.
component
.
legend
,
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
].
type
===
h
.
CHART_TYPE_TREEMAP
){
t
[
n
]
=
this
.
reformOption
(
t
[
n
]);
var
a
=
t
[
n
].
name
||
""
;
if
(
this
.
selectedMap
[
a
]
=
i
?
i
.
isSelected
(
a
):
!
0
,
!
this
.
selectedMap
[
a
])
continue
;
this
.
_buildSeries
(
t
[
n
],
n
)}},
_buildSeries
:
function
(
e
,
t
){
var
i
=
l
.
fromOptionData
(
e
.
name
,
e
.
data
);
this
.
_treesMap
[
t
]
=
i
;
var
n
=
e
.
root
&&
i
.
getNodeById
(
e
.
root
)
||
i
.
root
;
this
.
_buildTreemap
(
n
,
t
)},
_buildTreemap
:
function
(
e
,
t
){
for
(
var
i
=
this
.
shapeList
,
n
=
0
;
n
<
i
.
length
;){
var
a
=
i
[
n
];
m
.
get
(
a
,
"seriesIndex"
)
===
t
?(
this
.
zr
.
delShape
(
i
[
n
]),
i
.
splice
(
n
,
1
)):
n
++
}
for
(
var
o
=
i
.
length
,
r
=
this
.
series
[
t
],
l
=
r
.
itemStyle
,
h
=
this
.
parsePercent
(
r
.
size
[
0
],
this
.
zr
.
getWidth
())
||
400
,
V
=
this
.
parsePercent
(
r
.
size
[
1
],
this
.
zr
.
getHeight
())
||
500
,
U
=
this
.
parseCenter
(
this
.
zr
,
r
.
center
),
d
=
U
[
0
]
-
.
5
*
h
,
p
=
U
[
1
]
-
.
5
*
V
,
c
=
h
*
V
,
u
=
0
,
y
=
[],
g
=
e
.
children
,
n
=
0
;
n
<
g
.
length
;
n
++
)
u
+=
g
[
n
].
data
.
value
;
for
(
var
b
=
0
;
b
<
g
.
length
;
b
++
)
y
.
push
(
g
[
b
].
data
.
value
*
c
/
u
);
for
(
var
f
=
new
s
({
x
:
d
,
y
:
p
,
width
:
h
,
height
:
V
}),
k
=
f
.
run
(
y
),
_
=
0
;
_
<
k
.
length
;
_
++
){
var
x
=
g
[
_
].
data
,
L
=
k
[
_
],
W
=
[
x
.
itemStyle
,
l
],
X
=
this
.
deepMerge
(
W
);
X
.
normal
.
color
||
(
X
.
normal
.
color
=
this
.
zr
.
getColor
(
_
)),
X
.
emphasis
.
color
||
(
X
.
emphasis
.
color
=
X
.
normal
.
color
),
this
.
_buildItem
(
x
,
X
,
L
,
t
,
_
),
x
.
children
&&
this
.
_buildChildrenTreemap
(
x
.
children
,
X
,
L
,
t
)}
this
.
query
(
r
,
"itemStyle.normal.breadcrumb.show"
)
&&
this
.
_buildBreadcrumb
(
e
,
t
,
d
,
p
+
V
);
for
(
var
n
=
o
;
n
<
i
.
length
;
n
++
)
this
.
zr
.
addShape
(
i
[
n
])},
_buildItem
:
function
(
e
,
t
,
i
,
n
,
a
){
var
o
=
this
.
series
,
r
=
this
.
getRectangle
(
e
,
t
,
i
);
m
.
pack
(
r
,
o
[
n
],
n
,
e
,
a
,
e
.
name
),
this
.
shapeList
.
push
(
r
)},
getRectangle
:
function
(
e
,
t
,
i
){
var
n
=
t
.
emphasis
,
o
=
t
.
normal
,
r
=
this
.
getLabel
(
t
,
i
,
e
.
name
,
e
.
value
),
s
=
this
.
option
.
hoverable
,
l
=
{
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
(),
hoverable
:
s
,
clickable
:
!
0
,
style
:
U
.
merge
({
x
:
i
.
x
,
y
:
i
.
y
,
width
:
i
.
width
,
height
:
i
.
height
,
brushType
:
"both"
,
color
:
o
.
color
,
lineWidth
:
o
.
borderWidth
,
strokeColor
:
o
.
borderColor
},
r
.
style
,
!
0
),
highlightStyle
:
U
.
merge
({
color
:
n
.
color
,
lineWidth
:
n
.
borderWidth
,
strokeColor
:
n
.
borderColor
},
r
.
highlightStyle
,
!
0
)};
return
new
a
(
l
)},
getLabel
:
function
(
e
,
t
,
i
,
a
){
var
o
=
e
.
normal
.
label
.
textStyle
,
r
=
[
e
.
emphasis
.
label
.
textStyle
,
o
],
s
=
this
.
deepMerge
(
r
),
l
=
e
.
normal
.
label
.
formatter
,
h
=
this
.
getLabelText
(
i
,
a
,
l
),
m
=
this
.
getFont
(
o
),
V
=
n
.
getTextWidth
(
h
,
m
),
U
=
n
.
getTextHeight
(
h
,
m
),
d
=
this
.
deepQuery
([
e
.
emphasis
,
e
.
normal
],
"label.formatter"
),
p
=
this
.
getLabelText
(
i
,
a
,
d
),
c
=
this
.
getFont
(
s
),
u
=
n
.
getTextWidth
(
h
,
c
),
y
=
n
.
getTextHeight
(
h
,
c
);
e
.
normal
.
label
.
show
?(
e
.
normal
.
label
.
x
+
V
>
t
.
width
||
e
.
normal
.
label
.
y
+
U
>
t
.
height
)
&&
(
h
=
""
):
h
=
""
,
e
.
emphasis
.
label
.
show
?(
s
.
x
+
u
>
t
.
width
||
s
.
y
+
y
>
t
.
height
)
&&
(
p
=
""
):
p
=
""
;
var
g
=
{
style
:{
textX
:
t
.
x
+
e
.
normal
.
label
.
x
,
textY
:
t
.
y
+
e
.
normal
.
label
.
y
,
text
:
h
,
textPosition
:
"specific"
,
textColor
:
o
.
color
,
textFont
:
m
},
highlightStyle
:{
textX
:
t
.
x
+
e
.
emphasis
.
label
.
x
,
textY
:
t
.
y
+
e
.
emphasis
.
label
.
y
,
text
:
p
,
textColor
:
s
.
color
,
textPosition
:
"specific"
}};
return
g
},
getLabelText
:
function
(
e
,
t
,
i
){
return
i
?
"function"
==
typeof
i
?
i
.
call
(
this
.
myChart
,
e
,
t
):
"string"
==
typeof
i
?(
i
=
i
.
replace
(
"{b}"
,
"{b0}"
).
replace
(
"{c}"
,
"{c0}"
),
i
=
i
.
replace
(
"{b0}"
,
e
).
replace
(
"{c0}"
,
t
)):
void
0
:
e
},
_buildChildrenTreemap
:
function
(
e
,
t
,
i
,
n
){
for
(
var
a
=
i
.
width
*
i
.
height
,
o
=
0
,
r
=
[],
l
=
0
;
l
<
e
.
length
;
l
++
)
o
+=
e
[
l
].
value
;
for
(
var
h
=
0
;
h
<
e
.
length
;
h
++
)
r
.
push
(
e
[
h
].
value
*
a
/
o
);
for
(
var
V
=
new
s
({
x
:
i
.
x
,
y
:
i
.
y
,
width
:
i
.
width
,
height
:
i
.
height
}),
U
=
V
.
run
(
r
),
d
=
t
.
normal
.
childBorderWidth
,
p
=
t
.
normal
.
childBorderColor
,
c
=
0
;
c
<
U
.
length
;
c
++
){
var
u
=
U
[
c
],
y
=
[];
i
.
y
.
toFixed
(
2
)
!==
u
.
y
.
toFixed
(
2
)
&&
y
.
push
(
this
.
_getLine
(
u
.
x
,
u
.
y
,
u
.
x
+
u
.
width
,
u
.
y
,
d
,
p
)),
i
.
x
.
toFixed
(
2
)
!==
u
.
x
.
toFixed
(
2
)
&&
y
.
push
(
this
.
_getLine
(
u
.
x
,
u
.
y
,
u
.
x
,
u
.
y
+
u
.
height
,
d
,
p
)),(
i
.
y
+
i
.
height
).
toFixed
(
2
)
!==
(
u
.
y
+
u
.
height
).
toFixed
(
2
)
&&
y
.
push
(
this
.
_getLine
(
u
.
x
,
u
.
y
+
u
.
height
,
u
.
x
+
u
.
width
,
u
.
y
+
u
.
height
,
d
,
p
)),(
i
.
x
+
i
.
width
).
toFixed
(
2
)
!==
(
u
.
x
+
u
.
width
).
toFixed
(
2
)
&&
y
.
push
(
this
.
_getLine
(
u
.
x
+
u
.
width
,
u
.
y
,
u
.
x
+
u
.
width
,
u
.
y
+
u
.
height
,
d
,
p
));
for
(
var
g
=
0
;
g
<
y
.
length
;
g
++
)
m
.
set
(
y
[
g
],
"seriesIndex"
,
n
),
this
.
shapeList
.
push
(
y
[
g
])}},
_getLine
:
function
(
e
,
t
,
i
,
n
,
a
,
o
){
var
s
=
{
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
(),
hoverable
:
!
1
,
style
:{
xStart
:
e
,
yStart
:
t
,
xEnd
:
i
,
yEnd
:
n
,
lineWidth
:
a
,
strokeColor
:
o
}};
return
new
r
(
s
)},
_buildBreadcrumb
:
function
(
e
,
t
,
i
,
n
){
for
(
var
a
=
[],
r
=
e
;
r
;)
a
.
unshift
(
r
.
data
.
name
),
r
=
r
.
parent
;
for
(
var
s
=
this
.
series
[
t
],
l
=
this
.
query
(
s
,
"itemStyle.normal.breadcrumb.textStyle"
)
||
{},
h
=
this
.
query
(
s
,
"itemStyle.emphasis.breadcrumb.textStyle"
)
||
{},
V
=
{
y
:
n
+
10
,
textBaseline
:
"top"
,
textAlign
:
"left"
,
color
:
l
.
color
,
textFont
:
this
.
getFont
(
l
)},
p
=
{
brushType
:
"fill"
,
color
:
h
.
color
||
d
.
lift
(
l
.
color
,
-
.
3
),
textFont
:
this
.
getFont
(
h
)},
c
=
0
;
c
<
a
.
length
;
c
++
){
var
u
=
new
o
({
zlevel
:
this
.
getZlevelBase
(),
z
:
this
.
getZBase
(),
style
:
U
.
merge
({
x
:
i
,
text
:
a
[
c
]
+
(
a
.
length
-
1
-
c
?
" > "
:
""
)},
V
),
clickable
:
!
0
,
highlightStyle
:
p
});
m
.
set
(
u
,
"seriesIndex"
,
t
),
m
.
set
(
u
,
"name"
,
a
[
c
]),
i
+=
u
.
getRect
(
u
.
style
).
width
,
this
.
shapeList
.
push
(
u
)}},
__onclick
:
function
(
e
){
var
t
=
e
.
target
;
if
(
t
){
var
i
=
m
.
get
(
t
,
"seriesIndex"
),
n
=
m
.
get
(
t
,
"name"
),
a
=
this
.
_treesMap
[
i
],
o
=
a
.
getNodeById
(
n
);
o
&&
o
.
children
.
length
&&
this
.
_buildTreemap
(
o
,
i
)}}},
U
.
inherits
(
t
,
i
),
e
(
"../chart"
).
define
(
"treemap"
,
t
),
t
}),
define
(
"echarts/layout/TreeMap"
,[
"require"
],
function
(){
function
e
(
e
){({
x
:
e
.
x
,
y
:
e
.
y
,
width
:
e
.
width
,
height
:
e
.
height
});
this
.
x
=
e
.
x
,
this
.
y
=
e
.
y
,
this
.
width
=
e
.
width
,
this
.
height
=
e
.
height
}
return
e
.
prototype
.
run
=
function
(
e
){
var
t
=
[];
return
this
.
_squarify
(
e
,{
x
:
this
.
x
,
y
:
this
.
y
,
width
:
this
.
width
,
height
:
this
.
height
},
t
),
t
},
e
.
prototype
.
_squarify
=
function
(
e
,
t
,
i
){
var
n
=
"VERTICAL"
,
a
=
t
.
width
,
o
=
t
.
height
;
t
.
width
<
t
.
height
&&
(
n
=
"HORIZONTAL"
,
a
=
t
.
height
,
o
=
t
.
width
);
for
(
var
r
=
this
.
_getShapeListInAbstractRow
(
e
,
a
,
o
),
s
=
0
;
s
<
r
.
length
;
s
++
){
r
[
s
].
x
=
0
,
r
[
s
].
y
=
0
;
for
(
var
l
=
0
;
s
>
l
;
l
++
)
r
[
s
].
y
+=
r
[
l
].
height
}
var
h
=
{};
if
(
"VERTICAL"
==
n
){
for
(
var
m
=
0
;
m
<
r
.
length
;
m
++
)
i
.
push
({
x
:
r
[
m
].
x
+
t
.
x
,
y
:
r
[
m
].
y
+
t
.
y
,
width
:
r
[
m
].
width
,
height
:
r
[
m
].
height
});
h
=
{
x
:
r
[
0
].
width
+
t
.
x
,
y
:
t
.
y
,
width
:
t
.
width
-
r
[
0
].
width
,
height
:
t
.
height
}}
else
{
for
(
var
V
=
0
;
V
<
r
.
length
;
V
++
)
i
.
push
({
x
:
r
[
V
].
y
+
t
.
x
,
y
:
r
[
V
].
x
+
t
.
y
,
width
:
r
[
V
].
height
,
height
:
r
[
V
].
width
});
h
=
{
x
:
t
.
x
,
y
:
t
.
y
+
r
[
0
].
width
,
width
:
t
.
width
,
height
:
t
.
height
-
r
[
0
].
width
}}
var
U
=
e
.
slice
(
r
.
length
);
0
!==
U
.
length
&&
this
.
_squarify
(
U
,
h
,
i
)},
e
.
prototype
.
_getShapeListInAbstractRow
=
function
(
e
,
t
,
i
){
if
(
1
===
e
.
length
)
return
[{
width
:
t
,
height
:
i
}];
for
(
var
n
=
1
;
n
<
e
.
length
;
n
++
){
var
a
=
this
.
_placeFixedNumberRectangles
(
e
.
slice
(
0
,
n
),
t
,
i
),
o
=
this
.
_placeFixedNumberRectangles
(
e
.
slice
(
0
,
n
+
1
),
t
,
i
);
if
(
this
.
_isFirstBetter
(
a
,
o
))
return
a
}},
e
.
prototype
.
_placeFixedNumberRectangles
=
function
(
e
,
t
,
i
){
for
(
var
n
=
e
.
length
,
a
=
[],
o
=
0
,
r
=
0
;
r
<
e
.
length
;
r
++
)
o
+=
e
[
r
];
for
(
var
s
=
o
/
i
,
l
=
0
;
n
>
l
;
l
++
){
var
h
=
i
*
e
[
l
]
/
o
;
a
.
push
({
width
:
s
,
height
:
h
})}
return
a
},
e
.
prototype
.
_isFirstBetter
=
function
(
e
,
t
){
var
i
=
e
[
0
].
height
/
e
[
0
].
width
;
i
=
i
>
1
?
1
/
i
:
i
;
var
n
=
t
[
0
].
height
/
t
[
0
].
width
;
return
n
=
n
>
1
?
1
/
n
:
n
,
Math
.
abs
(
i
-
1
)
<=
Math
.
abs
(
n
-
1
)?
!
0
:
!
1
},
e
}),
define
(
"echarts/data/Tree"
,[
"require"
,
"zrender/tool/util"
],
function
(
e
){
function
t
(
e
,
t
){
this
.
id
=
e
,
this
.
depth
=
0
,
this
.
height
=
0
,
this
.
children
=
[],
this
.
parent
=
null
,
this
.
data
=
t
||
null
}
function
i
(
e
){
this
.
root
=
new
t
(
e
)}
var
n
=
e
(
"zrender/tool/util"
);
return
t
.
prototype
.
add
=
function
(
e
){
var
t
=
this
.
children
;
e
.
parent
!==
this
&&
(
t
.
push
(
e
),
e
.
parent
=
this
)},
t
.
prototype
.
remove
=
function
(
e
){
var
t
=
this
.
children
,
i
=
n
.
indexOf
(
t
,
e
);
i
>=
0
&&
(
t
.
splice
(
i
,
1
),
e
.
parent
=
null
)},
t
.
prototype
.
traverse
=
function
(
e
,
t
){
e
.
call
(
t
,
this
);
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
this
.
children
[
i
].
traverse
(
e
,
t
)},
t
.
prototype
.
updateDepthAndHeight
=
function
(
e
){
var
t
=
0
;
this
.
depth
=
e
;
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
){
var
n
=
this
.
children
[
i
];
n
.
updateDepthAndHeight
(
e
+
1
),
n
.
height
>
t
&&
(
t
=
n
.
height
)}
this
.
height
=
t
+
1
},
t
.
prototype
.
getNodeById
=
function
(
e
){
if
(
this
.
id
===
e
)
return
this
;
for
(
var
t
=
0
;
t
<
this
.
children
.
length
;
t
++
){
var
i
=
this
.
children
[
t
].
getNodeById
(
e
);
if
(
i
)
return
i
}},
i
.
prototype
.
traverse
=
function
(
e
,
t
){
this
.
root
.
traverse
(
e
,
t
)},
i
.
prototype
.
getSubTree
=
function
(
e
){
var
t
=
this
.
getNodeById
(
e
);
if
(
t
){
var
n
=
new
i
(
t
.
id
);
return
n
.
root
=
t
,
n
}},
i
.
prototype
.
getNodeById
=
function
(
e
){
return
this
.
root
.
getNodeById
(
e
)},
i
.
fromOptionData
=
function
(
e
,
n
){
function
a
(
e
,
i
){
var
n
=
new
t
(
e
.
name
,
e
);
i
.
add
(
n
);
var
o
=
e
.
children
;
if
(
o
)
for
(
var
r
=
0
;
r
<
o
.
length
;
r
++
)
a
(
o
[
r
],
n
)}
var
o
=
new
i
(
e
),
r
=
o
.
root
;
r
.
data
=
{
name
:
e
,
children
:
n
};
for
(
var
s
=
0
;
s
<
n
.
length
;
s
++
)
a
(
n
[
s
],
r
);
return
o
.
root
.
updateDepthAndHeight
(
0
),
o
},
i
.
fromGraph
=
function
(
e
){
function
n
(
t
){
for
(
var
i
=
e
.
getNodeById
(
t
.
id
),
a
=
0
;
a
<
i
.
outEdges
.
length
;
a
++
){
var
r
=
i
.
outEdges
[
a
],
s
=
o
[
r
.
node2
.
id
];
t
.
children
.
push
(
s
),
n
(
s
)}}
for
(
var
a
=
{},
o
=
{},
r
=
0
;
r
<
e
.
nodes
.
length
;
r
++
){
var
s
,
l
=
e
.
nodes
[
r
];
0
===
l
.
inDegree
()?(
a
[
l
.
id
]
=
new
i
(
l
.
id
),
s
=
a
[
l
.
id
].
root
):
s
=
new
t
(
l
.
id
),
s
.
data
=
l
.
data
,
o
[
l
.
id
]
=
s
}
var
h
=
[];
for
(
var
m
in
a
)
n
(
a
[
m
].
root
),
a
[
m
].
root
.
updateDepthAndHeight
(
0
),
h
.
push
(
a
[
m
]);
return
h
},
i
});
\ No newline at end of file
\ No newline at end of file
apps/static/js/plugins/echarts/echarts-all.js
View file @
3603b33a
This source diff could not be displayed because it is too large. You can
view the blob
instead.
apps/static/js/plugins/highcharts/modules/heatmap.src.js
View file @
3603b33a
...
@@ -570,7 +570,7 @@ seriesTypes.heatmap = extendClass(seriesTypes.scatter, merge(colorSeriesMixin, {
...
@@ -570,7 +570,7 @@ seriesTypes.heatmap = extendClass(seriesTypes.scatter, merge(colorSeriesMixin, {
y1
=
Math
.
round
(
yAxis
.
translate
(
point
.
y
-
yPad
,
0
,
1
,
0
,
1
)),
y1
=
Math
.
round
(
yAxis
.
translate
(
point
.
y
-
yPad
,
0
,
1
,
0
,
1
)),
y2
=
Math
.
round
(
yAxis
.
translate
(
point
.
y
+
yPad
,
0
,
1
,
0
,
1
));
y2
=
Math
.
round
(
yAxis
.
translate
(
point
.
y
+
yPad
,
0
,
1
,
0
,
1
));
// Set plotX and plotY for use in K-D-Tree and more
// Set plotX and plotY for use in K-D-Tree
View
and more
point
.
plotX
=
(
x1
+
x2
)
/
2
;
point
.
plotX
=
(
x1
+
x2
)
/
2
;
point
.
plotY
=
(
y1
+
y2
)
/
2
;
point
.
plotY
=
(
y1
+
y2
)
/
2
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment