首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >X方向上的HighCharts平移不起作用

X方向上的HighCharts平移不起作用
EN

Stack Overflow用户
提问于 2021-10-19 13:33:01
回答 2查看 51关注 0票数 -1

我正在使用highcharts作为我的图表。我想启用x方向的平移,但我发现即使启用了它也无法工作。请查找使用的代码片段

代码语言:javascript
复制
let options = HIOptions()
    
chart = HIChart()
chart.type = "column"
chart.panning = HIPanning()
chart.panning.enabled = true
chart.panning.type = "x"
chart.pinchType = "x"
chart.events = HIEvents()
chart.events.load = HIFunction(jsFunction: "function() { var proceed = this.pointer.pinch; this.pointer.pinch = function(e) { if (e.touches.length === 1 && e.type === 'touchmove') { this.chart.pan(e, this.chart.options.panning); } else { proceed.call(this, e); if (e.type === 'touchstart') { this.chart.mouseDownX = this.pinchDown[0].chartX; this.chart.mouseDownY = this.pinchDown[0].chartY; } } } }")
options.chart = chart
options.credits.enabled = false

感谢您在启用平移时提供的任何帮助。

EN

回答 2

Stack Overflow用户

发布于 2021-10-20 11:49:16

让我们尝试使用以下配置:

代码语言:javascript
复制
let options = HIOptions()
        
let chart = HIChart()
chart.panning = HIPanning()
chart.panning.enabled = true
chart.panning.type = "x"
chart.pinchType = "x"
chart.events = HIEvents()
chart.events.load = HIFunction(jsFunction: "function() { this.pointer.pinchTranslateDirection = function(horiz, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch, forcedScale) { return Highcharts.Pointer.prototype.pinchTranslateDirection.call(this.pointer, horiz, pinchDown, [touches[0]], transform, selectionMarker, clip, lastValidTouch, forcedScale) }; this.showResetZoom = function() {}; }")
options.chart = chart

接口参考:https://api.highcharts.com/ios/highcharts/Classes/HIPanning.html#//api/name/type

票数 0
EN

Stack Overflow用户

发布于 2021-10-21 16:13:55

我可以在添加scrollableArea后滚动以下代码片段

代码语言:javascript
复制
let options = HIOptions()
    
chart = HIChart()
chart.type = "column"
chart.panning = HIPanning()
chart.panning.enabled = true
chart.panning.type = "x"
chart.pinchType = "x"
chart.events = HIEvents()
chart.events.load = HIFunction(jsFunction: "function() { var proceed = this.pointer.pinch; this.pointer.pinch = function(e) { if (e.touches.length === 1 && e.type === 'touchmove') { this.chart.pan(e, this.chart.options.panning); } else { proceed.call(this, e); if (e.type === 'touchstart') { this.chart.mouseDownX = this.pinchDown[0].chartX; this.chart.mouseDownY = this.pinchDown[0].chartY; } } } }")
options.chart = chart
options.credits.enabled = false

let chart = HIChart()
chart.scrollablePlotArea = HIScrollablePlotArea()
chart.scrollablePlotArea.minWidth = 700
chart.scrollablePlotArea.scrollPositionX = 0
options.chart = chart
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69631822

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档