Nevron Forum

Custom Major Ticks on NLogarithmicScaleConfigurator

https://www.nevron.com/Forum/Topic5712.aspx

By Michael Hayford - Friday, October 14, 2011

I have a problem I'm trying to solve and haven't come up with the right set of property settings. I have a NLogarithmicScaleConfigurator and I want to set major tick marks are specific values, including the beginning and end of the range. The beginning tick mark always shows up, but the ending one does sometimes and not others. This doesn't seem to be a problem with a NNumericScaleConfigurator. I've added two screen captures showing the problem.

Some of the relevant code I'm using is pasted below. I can send a test program if needed.

If logScale Then
scale = New NLogarithmicScaleConfigurator
scale.AutoMinorTicks = True
scale.MinorTickCount = 3
Else
scale = New NLinearScaleConfigurator
scale.AutoMinorTicks = False
End If

scale.AutoLabels = True

scale.InnerMinorTickStyle.Length = New NLength(0, NGraphicsUnit.Point)
scale.InnerMajorTickStyle.Length = New NLength(0, NGraphicsUnit.Point)

scale.OuterMinorTickStyle.Length = New NLength(2, NGraphicsUnit.Point)
scale.OuterMinorTickStyle.Offset = New NLength(0, NGraphicsUnit.Point)
scale.OuterMajorTickStyle.Length = New NLength(4, NGraphicsUnit.Point)
scale.OuterMajorTickStyle.Offset = New NLength(0, NGraphicsUnit.Point)

scale.MajorTickMode = MajorTickMode.CustomTicks
scale.CustomMajorTicks.Clear()
scale.CustomMinorTicks.Clear()
scale.LabelStyle.ContentAlignment = ContentAlignment.TopCenter
scale.LabelStyle.VisibilityMode = ScaleLabelVisibilityMode.Always
scale.InflateViewRangeBegin = False
scale.InflateViewRangeEnd = False
scale.DisplayFirstLabel = True
scale.DisplayLastLabel = True

' Prevent the labels from being staggered, which doesn't work very well.
scale.LabelFitModes = New LabelFitMode() {LabelFitMode.RemoveOverlap}
scale.CreateNewLevelForCustomLabels = False

Thanks for any insight or suggestions you could give me.

Mike
By Nevron Support - Monday, October 17, 2011

Hi Michael,

Can you post the exact values you pass for custom ticks - we were not able to reproduce the problem with random values...

By Michael Hayford - Tuesday, October 18, 2011

Here are the values I used:
-1.39794000867204
-0.176906939203039
1.04412613026596
2.26515919973496
3.07918124604763
Note that the LogScaleConfigurator needs to be passed the log of the values for the custom tick values. Maybe this is a problem?

Thanks

Mike
By Nevron Support - Wednesday, October 19, 2011

Hi Mike,

The log transformation may be causing rounding errors. You can try a different approach and that is to use non tranformed log scale:

logScale.TransformScale = false;

In this mode you have to pass the custom ticks as normal values. Let us know if the problem persists - the other workaround will be to use a small explicit view range inflate...