如何始终显示工具提示?我正在使用vue-chartjs v3.4

时间:2019-04-10 06:16:13

标签: vue-chartjs

我需要始终显示工具提示

我尝试过 How to show tooltips always on Chart.js 2 I want to show the value of label inside the pie graph. (vue-chartjs / pieceLabel)

import { Line } from 'vue-chartjs'

export default {
  extends: Line,
  props: {
    linechartData: {
      type: Array | Object,
      required: true
    },
    linechartLabels: {
      type: Array,
      required: true
    }
  },
  data () {
    return {
      options: {
        title: {
          display: true,
          text: 'MONTHLY FEEDBACKS RECEIVED (LAST 12 MONTHS)'
        },
        scales: {
          yAxes: [{
            ticks: {
              beginAtZero: true
            },
            gridLines: {
              display: true
            }
          }],
          xAxes: [{
            gridLines: {
              display: true
            },
            display: false
          }]
        },
        legend: {
          display: false
        },
        responsive: true,
        maintainAspectRatio: false
      }
    }
  },
  mounted () {
    this.renderChart({
      labels: this.linechartLabels,
      datasets: [{
        borderColor: '#027be3',
        pointBackgroundColor: 'rgb(38, 166, 154, 0.5)',
        borderWidth: 1,
        pointBorderColor: '#249EBF',
        backgroundColor: 'rgb(38, 166, 154, 0.5)',
        data: this.linechartData
      }]
    }, this.options)
  }
}

我希望工具提示始终默认显示

0 个答案:

没有答案