highchart select an area to show some info by clicking and drag mouse but not release

会有一股神秘感。 提交于 2019-12-13 06:03:44

问题


I am currently working on the highchart and I wish to implement a feature that when you click mouse and drag it over the chart, a tooltip will show up to indicate the start and end date (x-Axis) of your selection.

Currently, I can only find events.selection, but you need to release the mouse by triggering this event. Is there a way to achieve a "area selection" function without releasing mouse?

Any hint will be appreciated!

Thanks


回答1:


Update While I was looking for the plug-in I used( written by Torstein Hønsi) I got this fiddle http://jsfiddle.net/highcharts/AyUbx/

following code is an example how I used dragging/drop in plotOption

  plotOptions : {
                                    series : {
                                        cursor : 'ns-resize',
                                        point : {
                                            events : {

                                                drag : function(e) {

                                                    $('#drag')
                                                            .html(
                                                                    'Dragging <b>'
                                                                            + this.series.name
                                                                            + '</b>, <b>'
                                                                            + this.category
                                                                            + '</b> to <b>'
                                                                            + Highcharts
                                                                                    .numberFormat(
                                                                                            e.newY,
                                                                                            2)
                                                                            + '</b>');
                                                },
                                                drop : function() {
                                                    $('#drop')
                                                            .html(
                                                                    'In <b>'
                                                                            + this.series.name
                                                                            + '</b>, <b>'
                                                                            + this.category
                                                                            + '</b> was set to <b>'
                                                                            + Highcharts
                                                                                    .numberFormat(
                                                                                            this.y,
                                                                                            2)
                                                                            + '</b>');




                                                }
                                            }
                                        },
                                        stickyTracking : false
                                    },
                                    column : {
                                        stacking : 'normal'
                                    }
                                }



回答2:


refer this http://forum.highcharts.com/highcharts-usage/is-there-a-start-pan-zoom-event-t33369/

informative and useful discussion



来源:https://stackoverflow.com/questions/32528010/highchart-select-an-area-to-show-some-info-by-clicking-and-drag-mouse-but-not-re

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