【问题标题】:Chart.js - Hide tooltip caretChart.js - 隐藏工具提示插入符号
【发布时间】:2017-08-08 23:35:35
【问题描述】:

我正在使用 chart.js 2.6.0。我想隐藏工具提示插入符号。我尝试在工具提示选项中使用 'caret: false' 但它不起作用。我怎样才能真正隐藏插入符号?

options: {
      tooltips: {
         caret: false,
      },
      scales: {
         yAxes: [{
            ticks: {
               beginAtZero: true,
            }
         }]
      }
   }

提前感谢您的帮助!

【问题讨论】:

    标签: jquery chart.js


    【解决方案1】:

    要隐藏工具提示的插入符号,您需要将 caretSize 属性设置为工具提示的 0图表选项,例如:

    options: {
       tooltips: {
          caretSize: 0
       },
       ...
    }
    

    【讨论】:

      【解决方案2】:

      我记得前段时间使用过它们。 基本上关闭它们是将 caretSize 设置为零。

      // Options
      {
          tooltips: {
              caretSize: 0
          }
      }
      

      这是来自repository的选项列表(虽然不完整)

      {
          enabled: true,
          custom: null,
          mode: 'nearest',
          position: 'average',
          intersect: true,
          backgroundColor: 'rgba(0,0,0,0.8)',
          titleFontStyle: 'bold',
          titleSpacing: 2,
          titleMarginBottom: 6,
          titleFontColor: '#fff',
          titleAlign: 'left',
          bodySpacing: 2,
          bodyFontColor: '#fff',
          bodyAlign: 'left',
          footerFontStyle: 'bold',
          footerSpacing: 2,
          footerMarginTop: 6,
          footerFontColor: '#fff',
          footerAlign: 'left',
          yPadding: 6,
          xPadding: 6,
          caretPadding: 2,
          caretSize: 5,
          cornerRadius: 6,
          multiKeyBackground: '#fff',
          displayColors: true,
          borderColor: 'rgba(0,0,0,0)',
          borderWidth: 0
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-08-25
        • 2023-03-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-21
        相关资源
        最近更新 更多