I have a chart with a range of 0..1000(xAxis)
Secondly i call;
var xCalc = this.XAxis.GetCurrentCoordinateCalculator();
double xDataValue = xCalc.GetCoordinate(500);
xDataValue is for example equal 500;
Next step:
I change the range via:
XAxis.VisibleRange.SetMinMax(1000,2000)
// Secondly i call;
var xCalc = this.XAxis.GetCurrentCoordinateCalculator();
double xDataValue = xCalc.GetCoordinate(1500);
xDataValue shall also be equal 500 or? (but it is negative -XXX)???
I call
SciChart.XAxis.VisibleRange.SetMinMax(min, max);
in my ChartViewModel and
var xCalc = this.XAxis.GetCurrentCoordinateCalculator();
double xDataValue = xCalc.GetCoordinate(1500);
in my ChartModifier..
- Daniel Hartl asked 9 years ago
- last edited 9 years ago
- You must login to post comments
Hi Daniel,
The method Axis.GetCurrentCoordinateCalculator() returns the CoordinateCalculator instance for the current axis and visible range, but … this instance is only updated when the Axis is redrawn (when a new render pass occurs). We do this for performance reasons – by caching the CoordinateCalculator instance.
So its possible that you are getting the CoordinateCalculator but before it has been updated.
Can you try this? Try calling AxisBase.OnBeginRenderPass(). This will flush the CoordinateCalculator instance and ensure a new one is created.
// Get CoordinateCalculator instance
var xCalc = this.XAxis.GetCurrentCoordinateCalculator();
double xDataValue = xCalc.GetCoordinate(500);
// Change VisibleRange
XAxis.VisibleRange.SetMinMax(1000,2000)
var xCalc2 = this.XAxis.GetCurrentCoordinateCalculator();
// Ensure creation of new coordinate calculator
this.XAxis.OnBeginRenderPass();
var xCalc3 = this.XAxis.GetCurrentCoordinateCalculator();
double xDataValue = xCalc3.GetCoordinate(1500);
// Some assertions
Debug.Assert(ReferenceEquals(xCalc, xCalc2) == true);
Debug.Assert(ReferenceEquals(xCalc, xCalc3) == false);
Best regards,
Andrew
- Andrew Burnett-Thompson answered 9 years ago
- last edited 9 years ago
-
Thanks!!
-
Did it work? Great!
- You must login to post comments
Please login first to submit.