Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Discrete ticks

Solved!
Go to solution

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)
    );

~ Paul H
0 Kudos
Message 11 of 16
(2,996 Views)

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));
        }

 

 

0 Kudos
Message 12 of 16
(2,994 Views)

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.

~ Paul H
0 Kudos
Message 13 of 16
(2,991 Views)

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.

0 Kudos
Message 14 of 16
(2,983 Views)

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.

~ Paul H
0 Kudos
Message 15 of 16
(2,977 Views)

Just wanted to let you know we have fixed the grid line alignment issue in the Measurement Studio 2015 release.

~ Paul H
0 Kudos
Message 16 of 16
(2,253 Views)