Re: NSRuler and non linear measurements
Re: NSRuler and non linear measurements
- Subject: Re: NSRuler and non linear measurements
- From: Quincey Morris <email@hidden>
- Date: Fri, 25 Feb 2011 09:34:46 -0800
On Feb 25, 2011, at 07:25, Carlos Eduardo Mello wrote:
> (Sorry if you are receiving this message again, but since i got zero response the first time, i imagined it might not have been delivered...)
It was delivered, but no one had an answer. Or, not a solution, anyway.
> I am using a vertical NSRuler with my CustomView-inside-ScrollView set up. I read every piece of documentation there is (guides, reference) and searched the list archives and google but couldn't find anything to help me customize my rulers to be associated with data that does not scale linearly. I mean, I need to build a frequency ruler that shows hash marks at logarithmic increments and (apparently) 'registerUnitName:' won't do the trick, as it seems to perform a constant linear conversion between my unit and postscript points.
>
> - Is it possible to somehow inform NSRuler that it needs to increment the maks at log2(y) instead conversionFactor (y)?
It's NSRulerView, BTW, not NSRuler.
Nope. You might be able to subclass NSRulerView, though, and draw the hash marks yourself. The information you need is right there in the documentation. Look at the class references for -[NSRulerView drawHashMarksAndLabelsInRect:] and +[NSScrollView setRulerViewClass] or -[NSScrollView setHorizontal/VerticalRulerView].
> - Do i need to draw the ruler and control its behaviour myself?
Possibly. What you asked for is *perhaps* an abuse of NSRulerView. It's designed for things like page layout rulers on scrolling text views, and is therefore canonically for measuring the container (e.g. the page and its geometry) more than the contents (the words on the page). Putting that a different way, it's perhaps more for measuring how far a view has scrolled than for labeling the axes of a graph. In that sense, you might be better off drawing your logarithmic scale inside the scroll view's "document" view.
It's a gray area, though. IRL, logarithmic graph paper exists without needing a revision of the laws of physics. :)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden