Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

wpf graph scale with dynamic ticks

Solved!
Go to solution

I need to increase number of major divisions to at least 10, but such that min and max will still be dynamic, e.g. grid would move along with the plot.

 

If I force <ni:RangeLabeledDivisions TickVisibility="Hidden" Mode="Count: 11">, then number of cells is the same, but plot is not moved independent of the grid, and grid labels show non-pretty numbers.

If I don't force mode, then grid behaves very well, but it uses about 3.5 divisions

0 Kudos
Message 1 of 2
(6,811 Views)
Solution
Accepted by eugenem

Major tick values are controlled by the GetDivisions method on RangeDivisionsMode, which receives an estimate of the number of divisions that will fit on screen. A simple workaround to increase the number of auto-generated divisions would be to pass a different estimate to the Auto implementation:


    public sealed class CustomDivisionsMode : RangeDivisionsMode {
        public override string Name {
            get { return "Custom"; }
        }
        public override bool RequiresDivisionsEstimate {
            get { return Auto.RequiresDivisionsEstimate; }
        }
        public override IList<TData> GetDivisions<TData>( IRangeDataMapper<TData> mapper, int divisionsEstimate ) {
            return Auto.GetDivisions<TData>( mapper, divisionsEstimate * 2 );
        }
        public override IList<TData> GetSubdivisions<TData>( IRangeDataMapper<TData> mapper, IList<TData> dependentDivisions ) {
            return Auto.GetSubdivisions<TData>( mapper, dependentDivisions );
        }
    }

~ Paul H
0 Kudos
Message 2 of 2
(6,803 Views)