Disabling Handlebars in HighStock charts navigator

妖精的绣舞 提交于 2019-12-02 16:58:44

问题


I've searched through the API and there are lots of examples on disabling and styling both the scroll bar and the navigator. I want to keep both intact but disable the handlebars from being draggable. I tried playing with the styles on this fiddle:

http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/stock/navigator/handles/

navigator: {
        handles: {
            backgroundColor: 'yellow',
            borderColor: 'red'
        }
    }

but only the backgroundColor and borderColor are accessible attributes according to the API.


回答1:


You can use setExtremes:

http://jsfiddle.net/B7vCR/3/

xAxis: {
                minRange:6 * 30 * 24 * 3600 * 1000,
                events: {
                    afterSetExtremes: function(e) {
                        var maxDistance = 10 * 30 * 24 * 3600 * 1000; //8 months time
                        var xaxis = this;
                        if ((e.max - e.min) > maxDistance) {
                            var min = e.max - maxDistance;
                            var max = e.max;
                            window.setTimeout(function() {
                                xaxis.setExtremes(min, max);
                            }, 1);
                        }
                    }
                }
            },


来源:https://stackoverflow.com/questions/15125572/disabling-handlebars-in-highstock-charts-navigator

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