Hatch

Element

Hatches are collections of short line segments used to mark congruent lines or curves.

Usage (signatures)
board.create('hatch', [line, numberofhashes]);

The distance of the hashes can be controlled with the attribute ticksDistance.

Parameters
Name Type Description
line Line | curve

The line or curve the hatch marks are going to be attached to.

numberofhashes Number

Number of dashes.

Examples
// Create an axis providing two coords pairs.
  var p1 = board.create('point', [0, 3]);
  var p2 = board.create('point', [1, 3]);
  var l1 = board.create('line', [p1, p2]);
  var t = board.create('hatch', [l1, 3]);
// Alter the position of the hatch

var p = board.create('point', [-5, 0]);
var q = board.create('point', [5, 0]);
var li = board.create('line', [p, q]);
var h = board.create('hatch', [li, 2], {anchor: 0.2, ticksDistance:0.4});

// Alternative hatch faces

var li = board.create('line', [[-6,0], [6,3]]);
var h1 = board.create('hatch', [li, 2], {tickEndings: [1,1], face:'|'});
var h2 = board.create('hatch', [li, 2], {tickEndings: [1,1], face:'>', anchor: 0.3});
var h3 = board.create('hatch', [li, 2], {tickEndings: [1,1], face:'<', anchor: 0.7});

Attributes

Own

ticksDistance

Description

The default distance (in user coordinates, not pixels) between two hatch symbols.

Type
Number
Default Value
0.2
Source
options.js, line 3798

Inherited

Members

Own

none

Inherited

Methods

Own

none

Inherited

Events

Own

none

Inherited

Throws

If the element cannot be constructed with the given parent objects an exception is thrown.

Type
Exception

Details

Type
JXG.Ticks
Source
base/ticks.js, line 1775

Extends