Skip to content

Commit

Permalink
Merge pull request #194 from vueblocks/barPieChart
Browse files Browse the repository at this point in the history
fix: 优化悬浮图的默认位置信息,确保其内容不会被遮挡或超出图表容器
  • Loading branch information
xiaojingha authored Dec 15, 2023
2 parents 7f8489e + 5768905 commit 9da2a41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
9 changes: 4 additions & 5 deletions docs/component-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<script>
module.exports = {
created () {

this.chartData = {
dimensions: {
name: 'date',
Expand Down Expand Up @@ -739,13 +738,13 @@
show: true
},
color: ['#426fff', '#40adff', '#3fdace', '#18bdb0', '#ffda3e', '#ffa900', '#83dd89', '#bedf65', '#956bfd', '#f67bb2'],
toFix: 3,
toFix: 2,
contentSize: {
width: '500px',
height: '200px'
width: '300px',
height: '130px'
},
legendShow: {
value: true,
value: false,
percent: true
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/packages/barpie/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,15 @@ class BarpieChart extends BaseChart {
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
},
position: function (pos, params, dom, rect, size) {
// 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。
let obj = { top: pos[1] - 200 }
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5
return obj
},
show: true,
enterable: true,
hideDelay: 500,
backgroundColor: 'rgb(255,255,255,0.94)',
textStyle: {
color: 'black'
},
transitionDuration: 0.4,
confine: true,
...tooltipOptions,
formatter: (params) => {
let dax = params[0].dataIndex
Expand Down

0 comments on commit 9da2a41

Please sign in to comment.