10-28-2014 11:02 AM
Here is a complete implementation of the custom divisions mode, which wraps another mode to add the duplicating behavior. Just pass the interval mode as the constructor parameter for the custom mode:
AxisX.MajorDivisions.Mode = new CustomDivisionsMode(
RangeDivisionsMode.CreateIntervalMode(0, AxisX.Range.Maximum > 20 ? Math.Round( AxisX.Range.Maximum / 10 ) : 1)
);
10-28-2014 11:21 AM
Thanks! This seems to work.
But I think that creating new modes all the time is not such a good idea. How can I update this class to support dynamic interval change?
Snippet
void AxisX_RangeChanged(object sender, EventArgs e) { if ((string)editXMin.MinValue == "0" && AxisX.Range.Minimum < 0) AxisX.Range = new Range<double>(0, AxisX.Range.Maximum - AxisX.Range.Minimum); RaisePropertyChanged(new string[] { "AxisXMin", "AxisXMax" }); if (AxisX.MajorDivisions.Mode.Name == "Interval") AxisX.MajorDivisions.Mode = new CustomDivisionsModeForInterval(RangeDivisionsMode.CreateIntervalMode(0, AxisX.Range.Maximum - AxisX.Range.Minimum > 20 ? Math.Round((AxisX.Range.Maximum - AxisX.Range.Minimum) / 10) : 1)); }
10-28-2014 01:12 PM
You could update the custom divisions mode to remove the inner mode parameter, and instead create the two interval modes ahead of time. Based on the range of the data mapper passed in to GetDivisions
, you could choose which interval mode to use as needed (instead of assigning a new mode in the range change handler). That way you would only need to assign Mode
once.
10-29-2014 03:36 AM
I've lost you here. How does it help me to deal with axis updates due to zoom? This requires a lot of different intervals, not just two.
10-29-2014 09:55 AM
I was just referring to how you could update the existing code, which lists only two intervals (1 when Maximum
is below 20, and Round( Maximum / 10 )
otherwise). You are not limited to those particular values in your implementation; GetDivisions
can return any values you want based on the current range.
08-11-2015 01:15 PM
Just wanted to let you know we have fixed the grid line alignment issue in the Measurement Studio 2015 release.