10-24-2017 04:24 AM
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:
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?
Solved! Go to Solution.
10-24-2017 11:00 AM
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 );
07-09-2019 11:01 AM
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"