Hover on areas not on point in Highchart-polygon

我与影子孤独终老i 提交于 2019-12-11 09:58:23

问题


I have one chart and i want to include hover on area but i found it works only on point only.

        series: [{
            name: 'Target',
            type: 'polygon',
            data: [[153, 42], [149, 46], [149, 55], [152, 60]], 
            color: Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.5).get(),
            enableMouseTracking: true

        }],
        tooltip: {
            headerFormat: '<b>{series.name}</b><br>',
            pointFormat: '{point.x} cm, {point.y} kg'
        }

http://jsfiddle.net/onhfLqdm/3/

As area is bounded by points so how can i hover area instead of points?


回答1:


Update On hover on each polygon asker wants to show data coming from json.To do so in a div out of container please view this fiddle

In Tooltip One more option to show some info coming from json ,tooltip can be used.Put your data using some name like "someText" (as in my fiddle )and get it in formatter function of tooltip using

  this.options.someText 

See this fiddle for data in tooltiip

Old Answer:

 plotOptions: {
        series: {

            events: {
                mouseOver: function () {
                     $("#polygon").html('Moused over Event')
                        .css('color', 'green');
                },
                mouseOut: function () {
                    $("#polygon").html('Moused out Event')
                        .css('color', 'red');
                }
            }
        }
    }

Fiddle link is here



来源:https://stackoverflow.com/questions/33169710/hover-on-areas-not-on-point-in-highchart-polygon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!