Logarithmic scales and values less than 1

Gauge for WPF Forum

Posted 12 years ago by Cheetah
Version: 11.1.0545
I'm trying to mock up a UI that will use a circular gauge using a logarithmic scale that primarily shows values less than 1 (but still greater than zero). I've found that if I set the range to 1e-8 to 760, and needle(s) at values like 1e-5 or 1e-6, the needles position correctly, but the tick marks and labels stop at 1, leaving most of the gauge unlabeled.

Is this a bug, or am I doing something wrong?

My minimalist mockup at the moment is this:
<gauge:CircularGauge Width="100" Height="100">
            <gauge:CircularTickSet Minimum="1e-8" Maximum="760" IsLogarithmic="True" LogarithmicBase="10"
                    <gauge:CircularTickMarkMajor />
                    <gauge:CircularTickLabelMajor />
                    <gauge:CircularPointerNeedle Value="1e-7" />

Comments (3)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Logarithmic scales do not work well with fractional values. In your example above, the start value will be 1e-8, and the end value will be 760. In addition, it will use powers of 10 to "step" between them. So you will end up with major ticks of 1e-8, 1 + 1e-8, 10 + 1e-8, 100 + 1e-8, 760.

You see the values 1, 10, 100, 760, because the numbers are rounded by default. You can disable this by setting RoundMode to None on the CircularTickLabelMajor, so you can see that they are actually fractional numbers. You also don't see the first tick at 1e-8, because the CircularScale sweep angle is 360, so the first and last tick marks are merged (thus the minimum label is not rendered). If you set the SweepAngle to say 330, you'd see the tick for 1e-8 as well.

Actipro Software Support

Posted 12 years ago by Cheetah
I changed the sweep angle, and I can get it to show the minimum value, but it doesn't show any of the ticks in between that and 1.

I was hoping to get ticks at 1e-8, 1e-7, ... 1e-2, 1e-1, 1, 10, 100, 760.

I realize that the label text gets a bit long in that case, but those are the values I need to display (pressures in Torr from a vacuum system that is sometimes vented up to atmosphere, hence the top value of 760).

I guess I could just create custom classes derived from CircularTick(Label/Mark)Base?
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

You could certainly create your own custom tick types. In fact you could derive a custom class from CircularTickMarkMajor and/or CircularTickLabelMajor, and simply override the GetValues method (and you may need to set IsLogrithmic to false).
protected override DoubleCollection GetValues() {
    var values = new DoubleCollection();
    for (int i = -8; i <= 2; i++)
        values.Add(Math.Pow(10, i));
    return values;
The real problem is that it renders to scale, and as such the values below 1 will be indistinguishable. What you'd really need is a variable scale, which we do not currently support. I've added this forum post to our TODO item for that feature, so you will be notified when it is added.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.