<i id='oNZRy'><tr id='oNZRy'><dt id='oNZRy'><q id='oNZRy'><span id='oNZRy'><b id='oNZRy'><form id='oNZRy'><ins id='oNZRy'></ins><ul id='oNZRy'></ul><sub id='oNZRy'></sub></form><legend id='oNZRy'></legend><bdo id='oNZRy'><pre id='oNZRy'><center id='oNZRy'></center></pre></bdo></b><th id='oNZRy'></th></span></q></dt></tr></i><div id='oNZRy'><tfoot id='oNZRy'></tfoot><dl id='oNZRy'><fieldset id='oNZRy'></fieldset></dl></div>

    <legend id='oNZRy'><style id='oNZRy'><dir id='oNZRy'><q id='oNZRy'></q></dir></style></legend>

  1. <tfoot id='oNZRy'></tfoot>
  2. <small id='oNZRy'></small><noframes id='oNZRy'>

        <bdo id='oNZRy'></bdo><ul id='oNZRy'></ul>
    1. Chart.JS - 极地区域 - 图例悬停样式和边距

      Chart.JS - Polar area - Legend hover style and margin(Chart.JS - 极地区域 - 图例悬停样式和边距)

      <small id='zKXHA'></small><noframes id='zKXHA'>

      • <bdo id='zKXHA'></bdo><ul id='zKXHA'></ul>

              <tbody id='zKXHA'></tbody>

              <i id='zKXHA'><tr id='zKXHA'><dt id='zKXHA'><q id='zKXHA'><span id='zKXHA'><b id='zKXHA'><form id='zKXHA'><ins id='zKXHA'></ins><ul id='zKXHA'></ul><sub id='zKXHA'></sub></form><legend id='zKXHA'></legend><bdo id='zKXHA'><pre id='zKXHA'><center id='zKXHA'></center></pre></bdo></b><th id='zKXHA'></th></span></q></dt></tr></i><div id='zKXHA'><tfoot id='zKXHA'></tfoot><dl id='zKXHA'><fieldset id='zKXHA'></fieldset></dl></div>

              • <legend id='zKXHA'><style id='zKXHA'><dir id='zKXHA'><q id='zKXHA'></q></dir></style></legend><tfoot id='zKXHA'></tfoot>
              • 本文介绍了Chart.JS - 极地区域 - 图例悬停样式和边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                大家好,

                希望这是一个简单的过程.我已经设置了一个带有 onclick 事件的图例,但是当我将鼠标悬停在标签上时,我希望鼠标光标变为指针"(参见上面的图表截图).目前很难判断标签是链接,因为当我将鼠标悬停在它们上面时鼠标光标不会改变.

                Hopefully this is an easy one. I've set up a legend with an onclick event but would like the mouse cursor to change to "pointer" when I hover over the labels (see chart screenshot above). Currently it's hard to tell that the labels are links because the mouse cursor doesn't change when I hover over them.

                另外,我如何在图例和图表之间添加一些边距/填充(图例下方的空间).

                Also how do I add some margin/padding between the legend and chart (space below the legend).

                非常感谢!

                推荐答案

                您可以使用 legend onHover 配置选项(将指针样式更改为 pointer)和 自定义工具提示配置选项(将指针样式改回 default).

                You can achieve the desired behavior using a combination of the legend onHover config option (to change the pointer style to pointer) and the custom tooltips config option (to change the pointer style back to default).

                这是一个演示有效解决方案的示例配置.我不确定你是否使用 jQuery,所以我决定不使用它.随意更改.

                Here is an example config demonstrating a working solution. I wasn't sure if you were using jQuery or not so I decided not to use it. Feel free to change accordingly.

                options: {
                  legend: {
                    position: 'top',
                    labels: {
                      fontColor: 'rgb(255, 99, 132)'
                    },
                    onHover: function(event, legendItem) {
                      document.getElementById("canvas").style.cursor = 'pointer';
                    }
                  },
                  tooltips: {
                    custom: function(tooltip) {
                      if (!tooltip.opacity) {
                        document.getElementById("canvas").style.cursor = 'default';
                        return;
                      }
                    }
                  }
                }
                

                这篇关于Chart.JS - 极地区域 - 图例悬停样式和边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                ChartJS Version 3 - common legend for multiple line charts(ChartJS 版本 3 - 多个折线图的常用图例)
                Chart.js yAxes Ticks stepSize not working (fiddle)(Chart.js yAxes Ticks stepSize 不起作用(小提琴))
                How to hide value in Chart JS bar(如何在 Chart JS 栏中隐藏值)
                Show data values in Chart.js bars (version 3)(在 Chart.js 条形图中显示数据值(版本 3))
                Chart.js show x-axis data from right to left(Chart.js 从右到左显示 x 轴数据)
                ChartJS - Finding the minimum and maximum labels that are inside a pan (When zooming)(ChartJS - 查找平底锅内的最小和最大标签(缩放时))
                <tfoot id='lIRbZ'></tfoot>

              • <i id='lIRbZ'><tr id='lIRbZ'><dt id='lIRbZ'><q id='lIRbZ'><span id='lIRbZ'><b id='lIRbZ'><form id='lIRbZ'><ins id='lIRbZ'></ins><ul id='lIRbZ'></ul><sub id='lIRbZ'></sub></form><legend id='lIRbZ'></legend><bdo id='lIRbZ'><pre id='lIRbZ'><center id='lIRbZ'></center></pre></bdo></b><th id='lIRbZ'></th></span></q></dt></tr></i><div id='lIRbZ'><tfoot id='lIRbZ'></tfoot><dl id='lIRbZ'><fieldset id='lIRbZ'></fieldset></dl></div>

                        <legend id='lIRbZ'><style id='lIRbZ'><dir id='lIRbZ'><q id='lIRbZ'></q></dir></style></legend>
                          <bdo id='lIRbZ'></bdo><ul id='lIRbZ'></ul>
                        • <small id='lIRbZ'></small><noframes id='lIRbZ'>

                            <tbody id='lIRbZ'></tbody>