Skip to content

Commit 9da2a41

Browse files
authored
Merge pull request #194 from vueblocks/barPieChart
fix: 优化悬浮图的默认位置信息,确保其内容不会被遮挡或超出图表容器
2 parents 7f8489e + 5768905 commit 9da2a41

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

docs/component-extension.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<script>
1313
module.exports = {
1414
created () {
15-
1615
this.chartData = {
1716
dimensions: {
1817
name: 'date',
@@ -739,13 +738,13 @@
739738
show: true
740739
},
741740
color: ['#426fff', '#40adff', '#3fdace', '#18bdb0', '#ffda3e', '#ffa900', '#83dd89', '#bedf65', '#956bfd', '#f67bb2'],
742-
toFix: 3,
741+
toFix: 2,
743742
contentSize: {
744-
width: '500px',
745-
height: '200px'
743+
width: '300px',
744+
height: '130px'
746745
},
747746
legendShow: {
748-
value: true,
747+
value: false,
749748
percent: true
750749
}
751750
}

src/packages/barpie/chart.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,15 @@ class BarpieChart extends BaseChart {
113113
axisPointer: { // 坐标轴指示器,坐标轴触发有效
114114
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
115115
},
116-
position: function (pos, params, dom, rect, size) {
117-
// 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。
118-
let obj = { top: pos[1] - 200 }
119-
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5
120-
return obj
121-
},
122116
show: true,
123117
enterable: true,
124118
hideDelay: 500,
125119
backgroundColor: 'rgb(255,255,255,0.94)',
126120
textStyle: {
127121
color: 'black'
128122
},
123+
transitionDuration: 0.4,
124+
confine: true,
129125
...tooltipOptions,
130126
formatter: (params) => {
131127
let dax = params[0].dataIndex

0 commit comments

Comments
 (0)