XYScaleView:
Filter:
Classes (extension) | GUI > Views

XYScaleView : ValuesView : View : QObject : Object
ExtensionExtension

An XY control widget

A simple X-Y plotter interface

Description

A View for interacting with two values on an X/Y plot. Each axis can be mapped to an independent ControlSpec, and the appearance can be customized.

This class also serves as a simple model for subclassing ValuesView, so you can use the class source file as a reference for designing your own UI to visualize and interact with multiple values.

Class Methods

XYScaleView.new(parent, bounds, specs, initVals, moveRelative: false)

Create a new XYScaleView.

Arguments:

parent

A Window or View, in which to embed this view. If nil, a window will be created to hold the view.

bounds

A Rect describing the bounds of this view within its parent. If parent is nil, the Rect specifies the dimensions of the newly created Window and its location on the screen.

specs

An Array of ControlSpecs that will control the range and warping of your values. If the array size differs from the number of initVals, it's assumed that values' index wrap around the array of specs. If nil, a \unipolar spec is created for each of the initVals.

initVals

An Array of initial -values when the view is first drawn. The size of the array determines how many values this view represents

moveRelative

A Boolean specifying whether the position moves relative to the mouse or jumps to the value where pressed.

Returns:

Inherited class methods

Instance Methods

.fixSquare

.fixSquare = bool

Get/set the Boolean specifying whether the view canvas should be fixed to a square aspect ratio, or fill the full view.

Arguments:

bool

A Boolean.

.moveRelative

.moveRelative = value

Get/set the Boolean specifying whether the position moves relative to the mouse or jumps to the value where pressed.

.background

.background = color

From superclass: View

Get/set the background color, not to be confused with the -backgrnd drawing layer.

Arguments:

color

A Color.

Drawing layers

.backgrnd

The drawing layer representing the canvas "background" (which isn't the same as the view's -background)

propertydefaultdescription
showtrueshow the backgrnd layer or not
strokefalsestroke the boarder of the view or not (drawn last, on top)
strokeWidth2width of stroke, in pixels

unless < 1, then relative to smallest view dimension

strokeColorColor.blackcolor of the boarder stroke
filltruefill the background or not
fillColorColor(0.9, 0.9, 0.9)color of the background

.range

The drawing layer responsible for drawing the range illustration of each axis.

propertydefaultdescription
showtrueshow the range layer or not
strokeWidth0.03width of stroke, in pixels

unless < 1, then relative to smallest view dimension

strokeXColorColor.blue.alpha_(0.5)color of the x axis stroke
strokeYColorColor.red.alpha_(0.5)color of the y axis stroke
showRangeLabelstrueshow the text of range bounds or not
fontName"Helvetica"font name string
fontSize0.07font size of the axis range text in pixels

unless < 1, then relative to smallest view dimension

.levels

The drawing layer responsible for drawing the current values of X and Y.

propertydefaultdescription
showtrueshow the levels layer or not
showPointtrueshow a point where the values cross on the plotter or not
pointSizetrueradius of the point in pixels

unless < 1, then relative to smallest view dimension

pointColornilcolor of the point

if nil, blends strokeXColor and strokeYColor

showCrosshairstrueshow crosshairs of the point location
strokeWidth0.01width of stroke, in pixels

unless < 1, then relative to smallest view dimension

strokeXColorColor.blue.alpha_(0.5)color of the x value
strokeYColorColor.red.alpha_(0.5)color of the y value
showTexttrueshow the text of the values or not
fontName"Helvetica"font name string
fontSize0.07font size of the axis range text in pixels

unless < 1, then relative to minimum view dimension

Inherited instance methods

Examples