This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I am trying to programatically achieve panning and I am not sure I am doing it right. the follwoing code is in the viewmodel. var e = args as ChartMouseEventArgs; if (e != null) { if (this.PreviousXAxisPos == 0.0 && this.PreviousYAxisPos == 0.0) { this.PreviousXAxisPos = e.LogicalPoint.X; this.PreviousYAxisPos = e.LogicalPoint.Y; return; }
} if (this.IsYAxis) { this.ActualMaximum += deltaY; this.Maximum += deltaY; this.ActualMinimum += deltaY; this.Minimum += deltaY; } else { this.ActualMaximum += deltaX; this.Maximum += deltaX; this.ActualMinimum += deltaX; this.Minimum += deltaX; } It does not seem to work and I am not sure why. My bindings seem to work. Any ideas or is there any other way to achieve panning? Thanks Peter I just read the documentation and saw that panning is achieved holding the ctrl key. Is would like to change that and use the mouse wheel click to achieve it but the MouseMode is readonly and I cannot set it to ChartMouseMode.Pan. |
|
|
Hello Peter Here is some example code of how I achieved panning with the middle mouse button:
This code is not in a viewmodel, instead it is in the code-behind of a Page. You should be able to adopt it to your needs though. The most important thing to note is the use of the ChartAxis.Pan method which you should find very useful. Another thing to note is that you don't need to set the _previousPoint as the mouse is moving. You don't need to worry about the MouseMode property, this is just for finding out what the built-in behaviour of the chart is currently doing. I also noticed that in your code you are also setting the Maximum and Minimum properties of the axes. This would cause the panning to extend the maximum and minimum bounds of the chart into areas where there is no data. Is this effect desired? If so, you'd need to change the Minimum and Maximum properties before you call the Pan methods. Let me know if you have any more questions about this panning implementation. -Jason |
|
|
It works! Thanks Jason |
|