Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
chart-project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
czj
chart-project
Commits
ce04e1f5
提交
ce04e1f5
authored
12月 07, 2023
作者:
祖铭松
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 完善聚类热图
上级
db3a435b
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
47 行增加
和
26 行删除
+47
-26
chart.vue
src/components/ClusterHeatmapSecond/components/chart.vue
+32
-10
index.js
src/components/ClusterHeatmapSecond/utils/index.js
+15
-16
没有找到文件。
src/components/ClusterHeatmapSecond/components/chart.vue
浏览文件 @
ce04e1f5
...
@@ -17,10 +17,10 @@ import {
...
@@ -17,10 +17,10 @@ import {
setMaxMinNumber
,
setMaxMinNumber
,
setHeatmap
,
setHeatmap
,
setLegend
,
setLegend
,
set
Basi
sLegend
,
set
Consensu
sLegend
,
setAxisTitle
,
setAxisTitle
,
setLabel
,
setLabel
,
set
Basi
sHeatmap
set
Consensu
sHeatmap
}
from
'../utils/index'
;
}
from
'../utils/index'
;
const
chartRef
=
ref
(
null
);
const
chartRef
=
ref
(
null
);
...
@@ -44,6 +44,8 @@ const generateChart = () => {
...
@@ -44,6 +44,8 @@ const generateChart = () => {
let
margin
=
50
;
let
margin
=
50
;
let
radius
=
3
;
let
radius
=
3
;
let
dendWidth
=
0
;
let
dendWidth
=
0
;
let
xRatio
=
330
;
let
yRatio
=
500
;
let
xAxisLength
=
chartData
[
0
].
values
.
length
;
let
xAxisLength
=
chartData
[
0
].
values
.
length
;
const
heatWidth
=
2
*
radius
*
xAxisLength
;
const
heatWidth
=
2
*
radius
*
xAxisLength
;
...
@@ -75,6 +77,8 @@ const generateChart = () => {
...
@@ -75,6 +77,8 @@ const generateChart = () => {
xAxisLength
,
xAxisLength
,
heatWidth
,
heatWidth
,
heatHeight
,
heatHeight
,
xRatio
,
yRatio
,
...
ret
...
ret
};
};
...
@@ -88,6 +92,7 @@ const generateChart = () => {
...
@@ -88,6 +92,7 @@ const generateChart = () => {
for
(
let
i
=
0
;
i
<
chartDataArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
chartDataArr
.
length
;
i
++
)
{
setRankChart
(
configObj
,
chartDataArr
[
i
],
i
);
setRankChart
(
configObj
,
chartDataArr
[
i
],
i
);
setConsensus
(
configObj
,
chartDataArr
[
i
],
i
);
}
}
svgInstance
.
value
=
svg
.
node
();
svgInstance
.
value
=
svg
.
node
();
...
@@ -98,8 +103,8 @@ const generateChart = () => {
...
@@ -98,8 +103,8 @@ const generateChart = () => {
const
setRankChart
=
(
config
,
chartData
,
index
)
=>
{
const
setRankChart
=
(
config
,
chartData
,
index
)
=>
{
const
title
=
`rank =
${
index
+
2
}
`
;
const
title
=
`rank =
${
index
+
2
}
`
;
let
xRatio
=
350
;
let
xRatio
=
config
.
xRatio
;
let
yRatio
=
500
;
let
yRatio
=
config
.
yRatio
;
if
(
index
<=
2
)
{
if
(
index
<=
2
)
{
xRatio
=
index
*
xRatio
;
xRatio
=
index
*
xRatio
;
yRatio
=
0
;
yRatio
=
0
;
...
@@ -109,7 +114,7 @@ const setRankChart = (config, chartData, index) => {
...
@@ -109,7 +114,7 @@ const setRankChart = (config, chartData, index) => {
let
xAxisLength
=
chartData
[
0
].
values
.
length
;
let
xAxisLength
=
chartData
[
0
].
values
.
length
;
// 位置
// 位置
const
position
=
{
const
position
=
{
title
:
[
config
.
margin
+
xRatio
,
0
+
yRatio
],
title
:
[
config
.
margin
+
xRatio
,
yRatio
],
heatmap
:
[
10
+
xRatio
,
config
.
margin
+
yRatio
],
heatmap
:
[
10
+
xRatio
,
config
.
margin
+
yRatio
],
legend
:
[
xAxisLength
*
(
config
.
radius
*
2
)
+
70
+
xRatio
,
config
.
margin
+
yRatio
],
legend
:
[
xAxisLength
*
(
config
.
radius
*
2
)
+
70
+
xRatio
,
config
.
margin
+
yRatio
],
axisLabel
:
[
xAxisLength
*
(
config
.
radius
*
2
)
+
12
+
xRatio
,
config
.
margin
+
yRatio
]
axisLabel
:
[
xAxisLength
*
(
config
.
radius
*
2
)
+
12
+
xRatio
,
config
.
margin
+
yRatio
]
...
@@ -146,8 +151,25 @@ const setRankChart = (config, chartData, index) => {
...
@@ -146,8 +151,25 @@ const setRankChart = (config, chartData, index) => {
setLabel
(
configObj
);
setLabel
(
configObj
);
};
};
const
setConsensus
=
(
config
)
=>
{
const
setConsensus
=
(
config
,
data
,
index
)
=>
{
const
chartData
=
chartMockData
.
slice
(
0
,
2
);
const
chartData
=
data
.
slice
(
0
,
2
);
const
title
=
'consensus'
;
let
xRatio
=
config
.
xRatio
;
let
yRatio
=
config
.
yRatio
;
if
(
index
<=
2
)
{
xRatio
=
index
*
xRatio
;
yRatio
=
0
;
}
else
if
(
index
==
3
)
{
xRatio
=
0
;
}
let
xAxisLength
=
chartData
[
0
].
values
.
length
;
// 位置
const
position
=
{
title
:
[
xAxisLength
*
(
config
.
radius
*
2
)
+
170
+
xRatio
,
60
+
yRatio
],
heatmap
:
[
10
+
xRatio
,
config
.
margin
-
20
+
yRatio
],
legend
:
[
xAxisLength
*
(
config
.
radius
*
2
)
+
120
+
xRatio
,
config
.
margin
+
20
+
yRatio
],
axisLabel
:
[
xAxisLength
*
(
config
.
radius
*
2
)
+
12
+
xRatio
,
config
.
margin
+
yRatio
]
};
// max/min number
// max/min number
const
{
maxNumber
,
minNumber
}
=
setMaxMinNumber
(
chartData
);
const
{
maxNumber
,
minNumber
}
=
setMaxMinNumber
(
chartData
);
// root config
// root config
...
@@ -155,12 +177,12 @@ const setConsensus = (config) => {
...
@@ -155,12 +177,12 @@ const setConsensus = (config) => {
// color config
// color config
const
colors
=
[
'#9D9FFF'
,
'#F57BFF'
,
'#3AB1FF'
,
'#D38BFF'
,
'#00C745'
,
'#F4952C'
];
const
colors
=
[
'#9D9FFF'
,
'#F57BFF'
,
'#3AB1FF'
,
'#D38BFF'
,
'#00C745'
,
'#F4952C'
];
const
color
=
setColor
(
minNumber
,
maxNumber
,
colors
);
const
color
=
setColor
(
minNumber
,
maxNumber
,
colors
);
const
configObj
=
{
...
config
,
root
,
orderingx
,
maxNumber
,
minNumber
,
color
};
const
configObj
=
{
...
config
,
root
,
orderingx
,
maxNumber
,
minNumber
,
color
,
title
,
position
};
const
heatmapRect
=
set
Basi
sHeatmap
(
configObj
);
const
heatmapRect
=
set
Consensu
sHeatmap
(
configObj
);
// tips
// tips
setTips
(
heatmapRect
);
setTips
(
heatmapRect
);
// legend
// legend
config
.
show_legend
&&
set
Basi
sLegend
(
configObj
);
config
.
show_legend
&&
set
Consensu
sLegend
(
configObj
);
};
};
onMounted
(()
=>
{
onMounted
(()
=>
{
...
...
src/components/ClusterHeatmapSecond/utils/index.js
浏览文件 @
ce04e1f5
...
@@ -142,15 +142,15 @@ export const setHeatmap = (config) => {
...
@@ -142,15 +142,15 @@ export const setHeatmap = (config) => {
.
attr
(
'fill'
,
config
.
color
());
.
attr
(
'fill'
,
config
.
color
());
};
};
//
Basi
s heatmap
//
Consensu
s heatmap
export
const
set
Basi
sHeatmap
=
(
config
)
=>
{
export
const
set
Consensu
sHeatmap
=
(
config
)
=>
{
return
config
.
svg
return
config
.
svg
.
append
(
'g'
)
.
append
(
'g'
)
.
attr
(
'transform'
,
`translate(
${
config
.
margin
+
0
}
,
${
config
.
margin
}
)`
)
.
attr
(
'transform'
,
`translate(
${
config
.
position
.
heatmap
[
0
]}
,
${
config
.
position
.
heatmap
[
1
]
}
)`
)
.
selectAll
(
'g'
)
.
selectAll
(
'g'
)
.
data
(
config
.
root
.
leaves
())
.
data
(
config
.
root
.
leaves
())
.
join
(
'g'
)
.
join
(
'g'
)
.
attr
(
'transform'
,
(
d
,
i
)
=>
`translate(0,
${
130
+
config
.
radius
*
2
*
i
}
)`
)
.
attr
(
'transform'
,
(
d
,
i
)
=>
`translate(0,
${
config
.
radius
*
2
*
i
}
)`
)
.
selectAll
(
'rect'
)
.
selectAll
(
'rect'
)
.
data
((
d
)
=>
d
.
data
.
values
.
map
((
e
,
i
)
=>
d
.
data
.
values
[
config
.
orderingx
[
i
]]))
.
data
((
d
)
=>
d
.
data
.
values
.
map
((
e
,
i
)
=>
d
.
data
.
values
[
config
.
orderingx
[
i
]]))
.
join
(
'rect'
)
.
join
(
'rect'
)
...
@@ -161,7 +161,6 @@ export const setBasisHeatmap = (config) => {
...
@@ -161,7 +161,6 @@ export const setBasisHeatmap = (config) => {
.
attr
(
'fill'
,
config
.
color
());
.
attr
(
'fill'
,
config
.
color
());
};
};
// legend
// legend
export
const
setLegend
=
(
config
)
=>
{
export
const
setLegend
=
(
config
)
=>
{
const
legendData
=
[...
Array
.
from
({
length
:
config
.
maxNumber
},
(
item
,
i
)
=>
i
)];
const
legendData
=
[...
Array
.
from
({
length
:
config
.
maxNumber
},
(
item
,
i
)
=>
i
)];
...
@@ -184,28 +183,28 @@ export const setLegend = (config) => {
...
@@ -184,28 +183,28 @@ export const setLegend = (config) => {
);
);
};
};
//
Basi
s legend
//
Consensu
s legend
export
const
set
Basi
sLegend
=
(
config
)
=>
{
export
const
set
Consensu
sLegend
=
(
config
)
=>
{
const
legendData
=
[...
Array
.
from
({
length
:
config
.
maxNumber
},
(
item
,
i
)
=>
i
)];
const
legendData
=
[...
Array
.
from
({
length
:
config
.
maxNumber
},
(
item
,
i
)
=>
i
)];
const
textX
=
0
+
config
.
xAxisLength
*
(
config
.
radius
*
2
)
+
180
config
.
svg
.
append
(
'text'
)
config
.
svg
.
append
(
'text'
)
.
attr
(
'x'
,
textX
)
.
attr
(
'x'
,
config
.
position
.
title
[
0
]
)
.
attr
(
'y'
,
config
.
height
/
3
-
110
)
.
attr
(
'y'
,
config
.
position
.
title
[
1
]
)
.
attr
(
'fill'
,
'#333333'
)
.
attr
(
'fill'
,
'#333333'
)
.
attr
(
'font-size'
,
'20px'
)
.
attr
(
'fill'
,
config
.
titleConfig
.
color
)
.
attr
(
'font-size'
,
`
${
config
.
titleConfig
.
fontSize
}
px`
)
.
attr
(
'font-family'
,
`
${
config
.
titleConfig
.
fontFamily
}
`
)
.
attr
(
'font-family'
,
`
${
config
.
titleConfig
.
fontFamily
}
`
)
.
attr
(
'font-style'
,
'normal'
)
.
attr
(
'font-style'
,
`
${
config
.
titleConfig
.
fontStyle
}
`
)
.
attr
(
'font-weight'
,
'bold'
)
.
attr
(
'font-weight'
,
`
${
config
.
titleConfig
.
fontWeight
}
`
)
.
style
(
'text-anchor'
,
'middle'
)
.
style
(
'text-anchor'
,
'middle'
)
.
text
(
'
basi
s'
);
.
text
(
'
consensu
s'
);
config
.
svg
.
append
(
'g'
)
config
.
svg
.
append
(
'g'
)
.
attr
(
'transform'
,
`translate(
${
config
.
position
.
legend
[
0
]}
,
${
config
.
position
.
legend
[
1
]}
)`
)
.
selectAll
()
.
selectAll
()
.
data
(
legendData
)
.
data
(
legendData
)
.
join
(
'g'
)
.
join
(
'g'
)
.
attr
(
'transform'
,
(
d
,
i
,
nodes
)
=>
`translate(
${
0
+
config
.
xAxisLength
*
(
config
.
radius
*
2
)
+
160
}
,
${
config
.
height
/
3
+
(
nodes
.
length
/
2
-
i
-
1
)
*
21
-
50
}
)`
)
.
attr
(
'transform'
,
(
d
,
i
,
nodes
)
=>
`translate(
0,
${
i
*
21
}
)`
)
.
call
((
g
)
=>
g
.
append
(
'rect'
).
attr
(
'width'
,
15
).
attr
(
'height'
,
15
).
attr
(
'fill'
,
config
.
color
()))
.
call
((
g
)
=>
g
.
append
(
'rect'
).
attr
(
'width'
,
15
).
attr
(
'height'
,
15
).
attr
(
'fill'
,
config
.
color
()))
.
call
((
g
)
=>
.
call
((
g
)
=>
g
g
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论