highcharts - 高亮图表中的突出显示区域

标签 highcharts

我需要选择列附近的区域。 如何在单击时(如将鼠标悬停在其上时)使区域和列突出显示。

这是我的例子: https://jsfiddle.net/alexserden/wq6j0tnp/9/

$(function () {
    let chart = Highcharts.chart('bar', {
        tooltip: {
            shared: true,
            hideDelay:100,
            useHTML: true,
            outside: true,
            style: {
                fontSize: "13px",
                color: '#505050'
            }
        },
        credits: {
            enabled: false
        },
        plotOptions: {
            column: {
                dataLabels: {
                    enabled: false,
                    style: {
                        fontSize: '13px',
                        fontWeight: 'bold',
                        textOutline: undefined,
                        color: '#505050'
                    }
                }
            },
            ...
        },
        ...
    }
});

最佳答案

您需要为点击添加事件处理程序:

                series: {
                    cursor: 'pointer',

                    marker: {
                        enabled: false
                    },
                    point: {
                      events: {
                          click: function () {
                              // Handle selection
                          }
                      },
                    }
                }

在此事件中,您需要处理区域选择,有一个类似的帖子 here 。所选区域是一个类别。 (API reference)

点击事件的API文档:https://api.highcharts.com/highcharts/plotOptions.area.point.events.click

关于highcharts - 高亮图表中的突出显示区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60641293/

相关文章:

javascript - Highcharts 3D 散点不在工具提示中显示名称

javascript - 将 Highcharts 与 Rails 6 结合使用

javascript - 隐藏 xAxis highchart 上的特定列

javascript - 在 highcharts 中突出显示一系列中的一个栏?

javascript - JSHint 和 grunt.js - Highcharts 未定义

javascript - Highcharts:使用 boost 在大量折线图中快速、实时地更新数据

javascript - 使用 jQuery for Highcharts 迭代 JSON 响应

javascript - 使用 Highcharts 创建 marimekko 图表

R高宪章: Polar graph having conditional colors

highcharts - 后台渲染图表