Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

LogarithmBase10 not working properly

Solved!
Go to solution

I replace ni WIN graph in WPF graph.

I use in LogarithmBase10 in some graphs (you can see it in the example project).

 

When the range start from 0 it's OK, but if I change the range to another number (70
for example) the divisions are not displayed properly [The divisions are overcrowded].

 

You can change the range and sometimes it's overcrowded and sometimes it's OK (depending on the start number).

 

Capture.PNG

 

I must say: in WIN graph it does not happen.

 

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

First, just to clarify: by "WIN" you are referring to "Windows Forms"?


I was able to reproduce the issue using your example. This appears to be a problem with how we generate auto divisions for logarithmic ranges. As a workaround, you can set the Mode on the MinorDivisions to the custom implementation below:


    public class CustomLogarithmicRangeDivisionsMode : RangeDivisionsMode {
        protected override IList<TData> GetDivisionsCore<TData>( IRangeDataMapper<TData> dataMapper, int divisionsEstimate ) {
            return Auto.GetDivisions( dataMapper, divisionsEstimate );
        }

        protected override IList<TData> GetSubdivisionsCore<TData>( IRangeDataMapper<TData> dataMapper, IList<TData> dependentDivisions ) {
            // (Note: this example assumes you supply the graph with "double" values)
            const int LogarithmBase = 10;
            double firstDivision = (double)(object)dependentDivisions[0];
            double lastDivision = (double)(object)dependentDivisions[dependentDivisions.Count - 1];
            double previousPower = Math.Pow( LogarithmBase, Math.Floor( Math.Log( firstDivision, LogarithmBase ) ) );

            var subdivisions = new List<TData>();
            double division = previousPower;
            while( division < lastDivision ) {
                for( int i = 1; i < LogarithmBase; ++i ) {
                    double subdivision = i * division;
                    subdivisions.Add( (TData)(object)subdivision );
                }

                division *= LogarithmBase;
            }

            return subdivisions;
        }
    }

~ Paul H
0 Kudos
Message 2 of 3
(3,457 Views)

Hi all,

 

This issue is fixed in Measurement Studio 2019.

 

Cheers,

Ryan Curtis

Product Support Engineer

Automated Test Software R&D

0 Kudos
Message 3 of 3
(2,136 Views)