快速移动光标时在悬停时未绘制垂直线

时间:2019-02-04 12:41:22

标签: javascript vue.js chart.js

我使用onHover: function () { if (this.chart.tooltip._active && this.chart.tooltip._active.length) { var activePoint = this.chart.tooltip._active[0], ctx = this.chart.ctx, x = activePoint.tooltipPosition().x, topY = this.chart.scales["y-axis-0"].top, bottomY = this.chart.scales["y-axis-0"].bottom; ctx.save(); ctx.beginPath(); ctx.moveTo(x, topY); ctx.lineTo(x, bottomY); ctx.lineWidth = 1; ctx.setLineDash([3, 3]); ctx.strokeStyle = "#45171d"; ctx.stroke(); ctx.restore(); } } 库,当我在悬停时没有快速移动光标时,垂直线没有显示,但是当我缓慢移动光标时,它是完美的。您能帮我解决这个问题吗

.flex-container-text {
  display: flex;
  width: 400px;
}

.flex-container-text p {
  white-space: nowrap;
  text-overflow: ellipsis;
  flex-shrink: 1;
  overflow:hidden;
  max-width: 150px;
  border:1px solid red;
  width:auto;
  display:inline-block;
}

1 个答案:

答案 0 :(得分:0)

已解决 我重写了config.hover.animationDuration pro