Profile Picture

Custom Major Ticks on NLogarithmicScaleConfigurator

Posted By Michael Hayford 13 Years Ago
Author
Message
Michael Hayford
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1
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

Attachments
LogLegend.PNG (59 views, 21.00 KB)
LinearLegend.PNG (62 views, 21.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Michael,

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



Best Regards,
Nevron Support Team



Michael Hayford
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1
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

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

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...



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic