Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
chart-project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
czj
chart-project
Commits
037b9a5a
提交
037b9a5a
authored
12月 04, 2023
作者:
祖铭松
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: update tip
上级
c2b586b3
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
51 行增加
和
7 行删除
+51
-7
package-lock.json
package-lock.json
+0
-0
chart.vue
src/components/CircularHeatmap/components/chart.vue
+50
-6
index.vue
src/views/home/index.vue
+1
-1
没有找到文件。
package-lock.json
浏览文件 @
037b9a5a
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/components/CircularHeatmap/components/chart.vue
浏览文件 @
037b9a5a
<
template
>
<div
ref=
"chartRef"
></div>
<div
ref=
"chartRef"
class=
"chart-box"
>
<div
class=
"tip"
></div>
</div>
</
template
>
<
script
setup
>
...
...
@@ -96,7 +98,7 @@ const generateChart = (data) => {
.
attr
(
'width'
,
width
)
.
attr
(
'height'
,
height
+
width
/
5
)
.
attr
(
'viewBox'
,
[
-
width
/
2
,
-
height
/
2
,
width
,
height
])
.
attr
(
'style'
,
'max-width: 100%; height: auto; font: 10px sans-serif'
);
.
attr
(
'style'
,
'max-width: 100%; height: auto; font: 10px sans-serif
;
'
);
let
dataMaxNumber
=
null
;
const
dataMaxArr
=
[];
...
...
@@ -108,7 +110,8 @@ const generateChart = (data) => {
let
fcolors
=
color
(
maxNumber
,
distinct_values
);
dataMaxArr
.
push
(
maxNumber
);
svg
.
append
(
'g'
)
const
rectA
=
svg
.
append
(
'g'
)
.
attr
(
'stroke'
,
'none'
)
.
attr
(
'stroke-width'
,
1
)
.
attr
(
'stroke-linejoin'
,
'round'
)
...
...
@@ -123,7 +126,8 @@ const generateChart = (data) => {
.
attr
(
'd'
,
arcCustom
(
i
,
cleaned
.
length
))
.
attr
(
'transform'
,
'rotate(90)'
);
svg
.
append
(
'g'
)
const
rectB
=
svg
.
append
(
'g'
)
.
attr
(
'stroke'
,
'none'
)
.
attr
(
'stroke-width'
,
1
)
.
attr
(
'stroke-linejoin'
,
'round'
)
...
...
@@ -136,7 +140,9 @@ const generateChart = (data) => {
.
attr
(
'fill'
,
(
d
)
=>
fcolors
(
d
.
data
.
value
))
.
attr
(
'd'
,
arcCustom
(
i
,
cleaned
.
length
))
.
attr
(
'transform'
,
'rotate(130)'
);
svg
.
append
(
'g'
)
const
rectC
=
svg
.
append
(
'g'
)
.
attr
(
'stroke'
,
'none'
)
.
attr
(
'stroke-width'
,
1
)
.
attr
(
'stroke-linejoin'
,
'round'
)
...
...
@@ -149,7 +155,12 @@ const generateChart = (data) => {
.
attr
(
'fill'
,
(
d
)
=>
fcolors
(
d
.
data
.
value
))
.
attr
(
'd'
,
arcCustom
(
i
,
cleaned
.
length
))
.
attr
(
'transform'
,
'rotate(155)'
);
setTips
(
rectA
);
setTips
(
rectB
);
setTips
(
rectC
);
}
dataMaxNumber
=
Math
.
round
(
Math
.
max
.
apply
(
null
,
dataMaxArr
));
// text
...
...
@@ -427,6 +438,35 @@ const setSideLabel = (config, svg) => {
return
svg
.
node
();
};
const
setTips
=
(
rect
)
=>
{
const
tips
=
d3
.
select
(
'.tip'
)
.
style
(
'visibility'
,
'hidden'
)
.
style
(
'position'
,
'relative'
)
.
style
(
'left'
,
'0px'
)
.
style
(
'top'
,
'0px'
)
.
style
(
'background-color'
,
'rgba(0, 0, 0, .8)'
)
.
style
(
'color'
,
'#fff'
)
.
style
(
'border-radius'
,
'5px'
)
.
style
(
'width'
,
'80px'
)
.
style
(
'text-align'
,
'center'
)
.
style
(
'height'
,
'20px'
)
.
style
(
'padding'
,
'5px'
);
rect
.
on
(
'mouseover'
,
(
event
,
d
)
=>
{
tips
.
style
(
'visibility'
,
'visible'
);
})
.
on
(
'mousemove'
,
function
(
event
,
d
)
{
tips
.
style
(
'visibility'
,
'visible'
)
.
style
(
'left'
,
event
.
offsetX
+
15
+
'px'
)
.
style
(
'top'
,
event
.
offsetY
+
50
+
'px'
)
.
html
(
`
${
d
.
data
.
value
}
`
);
})
.
on
(
'mouseleave'
,
function
()
{
tips
.
style
(
'visibility'
,
'hidden'
);
});
};
// 数据处理
const
getChartData
=
(
data
)
=>
{
const
sectionCount
=
32
;
// 整个圆分为32段
...
...
@@ -456,4 +496,8 @@ onUnmounted(() => {
});
</
script
>
<
style
scoped
></
style
>
<
style
scoped
>
.chart-box
{
position
:
relative
;
}
</
style
>
src/views/home/index.vue
浏览文件 @
037b9a5a
...
...
@@ -19,7 +19,7 @@ import ClusterHeatmap from '../../components/ClusterHeatmap/index.vue';
import
CircularHeatmap
from
'../../components/CircularHeatmap/index.vue'
;
import
Test
from
'../../components/Test/index.vue'
;
const
chartCurrent
=
ref
(
0
);
const
chartCurrent
=
ref
(
7
);
const
chartList
=
shallowRef
([
{
title
:
'线性拟合图'
,
value
:
1
,
comName
:
LinearFitting
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论