Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Interval mode hide the edge values

Solved!
Go to solution

I have a graph whose Y axis shows the axis in multiples of 30, 60, or 90, etc. [project attached]
I use a dynamic interval mode by a converter.

When the edge values are in multiples the graph is displayed well, but when they are not multiples they are not displayed.

For example, when the minimum is 10 and the maximum is 100, it is presented as follows:

 

Capture.PNG

 

I would like the edge values to be displayed anyway, and the values in the middle will relate to the rule.
In the example I would expect to be displayed 10 then 30 - 60 - 90 - 100.
How can I do this?

0 Kudos
Message 1 of 3
(2,432 Views)
Solution
Accepted by topic author hodaya273

The graph will only display the divisions returned by the RangeDivisionsMode on the scale. To always include the minimum and maximum for the range, you just need a custom divisions mode to include that in the divisions returned to the graph:

 

public class IncludeExtremesDivisionsMode : RangeDivisionsMode {

    private readonly RangeDivisionsMode innerMode;

    public IncludeExtremesDivisionsMode( RangeDivisionsMode innerMode ) {
        this.innerMode = innerMode;
    }

    protected override IList<TData> GetDivisionsCore<TData>( IRangeDataMapper<TData> dataMapper, int divisionsEstimate ) {
        var innerDivisions = this.innerMode.GetDivisions<TData>( dataMapper, divisionsEstimate );
        var range = dataMapper.Range;

        var divisions = new List<TData> { range.Minimum };
        divisions.AddRange( innerDivisions );
        divisions.Add( range.Maximum );

        return divisions;
    }

    protected override IList<TData> GetSubdivisionsCore<TData>( IRangeDataMapper<TData> dataMapper, IList<TData> dependentDivisions ) {
        return this.innerMode.GetSubdivisions<TData>( dataMapper, dependentDivisions );
    }

}

 

And in your converter, you can change your last line to:

return new IncludeExtremesDivisionsMode( divisionsMode );
~ Paul H
0 Kudos
Message 2 of 3
(2,405 Views)

Just wanted to let you know that Measurement Studio 2019 separated the “with extremes” behavior for use with any range divisions mode.

 

In code:

 

majorDivisions.Mode = RangeDivisionsMode.CreateWithExtremes( RangeDivisionsMode.CreateIntervalMode(0.0, 30.0) );

 

 

Or in XAML:

 

Mode="WithExtremes: Interval: 0.0, 30.0"

 

 

~ Paul H
0 Kudos
Message 3 of 3
(1,896 Views)