2016-10-17 29 views
1

我有一个图形,需要在X轴上缩放和平移。它有一系列标记的数据点,并且想法是放大时可以放大并水平移动图形。 我正在使用PinchZoomModifier和TouchPanModifier来实现这一点,它的工作原理大部分都是正确的。 但是不应该可以缩小图表来查看我的数据点范围之外的内容,因为它在我的上下文中没有意义。我怎样才能做到这一点?限制在SciChart中缩小

回答

0

我不知道你的目标是什么平台,但我假设WPF(基于以前的问题历史记录)。

您可以通过使用Clipping the Axis.VisibleRange on Zoom and Pan的技术之一来限制缩放。

所有的SciChart平台都有相似的方法来限制或限制VisibleRange。例如,SciChart iOS has the VisibleRangeLimit APISciChart Android has the MinimalZoomConstrain API

披露:我对scichart的高科技领先技术项目

+1

你好,对不起,这个问题,我解决了在这个问题的同时,我忘了关闭这个问题。 – Shaggydog

0

就可以解决这个问题,压倒一切的SCIPinchZoomModifier

class CustomZoomModifier: SCIPinchZoomModifier { 

    var maxValue = 3.0 
    var minValue = -1.0 
    var currentXZoom = 0.0 
    var currentYZoom = 0.0 

    override func performZoom(at mousePoint: CGPoint, xValue: Double, yValue: Double) { 
    var newXValue = 0.0 
    var newYvalue = 0.0 
    if xValue + currentXZoom <= maxValue && xValue + currentXZoom >= minValue { 
     newXValue = xValue 
     currentXZoom += xValue 
    } 
    if yValue + currentYZoom <= maxValue && yValue + currentYZoom >= minValue { 
     newYvalue = yValue 
     currentYZoom += yValue 
    } 

    if newXValue != 0.0 || newYvalue != 0.0 { 
     super.performZoom(at: mousePoint, xValue: newXValue, yValue: newYvalue) 
    } 
    } 
}