XYGrid class
Draws a grid in form of horizontal or vertical lines, or both. The grid is particularly useful when employed in conjunction with the Axis class to form a coordinate grid positioned at the tick marks of an axis. Usage:
- Construct a grid: xyGrid = XYGrid(args)
- Result: The grid was drawn into the SvgSvgElement gridContainer using Svg.
- Set the desired position of gridContainer by setting its "x" and "y" Svg attributes. For convenience, do it with SVG.setAttr(). x and y must be relative to the container in which gridContainer will be embedded (plotArea in next step 4).
- Append gridContainer to the desired SvgSvgElement type container of your particluar page layout: plotArea.append(xyGrid.gridContainer)
Constructors
-
XYGrid(List<
int> xValues, List<int> yValues, int xLength, int yLength, Map<AxA, String> gridAttr) -
Constructs a grid consisting of lines of length
xLength
andyLength
, in pixels, parallel to x and y, respectively.xValues
andyValues
define the x and y positions of the grid lines in pixels relative to their container gridContainer.xValues.length
andyValues.length
define the number of grid lines parallel to y and x, respectively. IfxValues
is null or empty no lines parallel to y will be drawn. IfyValues
is null or empty no lines parallel to x will be drawn.gridAttr
: If null, GRID_DEFAULT_ATTRIBUTES are used. Otherwise you can define here colors, dashes and more. The attributes specified here override the respective defaults.
Properties
-
attributes
↔ Map<
AxA, String> -
read / write
- gridContainer ↔ SvgSvgElement
-
The axis is drawn into this container by the constructor. You will have
to place it according to your desired app layout to make it visible in
your app.
read / write
- xLength ↔ int
-
read / write
-
xValues
↔ List<
int> -
read / write
- yLength ↔ int
-
read / write
-
yValues
↔ List<
int> -
read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
buildActiveGrid(
) → void - Draws the grid into a temporary container, and when done, replaces gridContainer (possibly already containing a grid) by the new temporary container containing the new grid.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Properties
-
GRID_DEFAULT_ATTRIBUTES
→ Map<
AxA, String> -
final