Image
extends Mark
The Image class represents an image mark. To create an Image object, use the mark method in the Scene class, for example:
let img = scene.mark("image", {x: 50, y: 100, width: 20, height: 20 src: "icon.png"});
Properties
property | explanation | type | default value |
---|---|---|---|
x | the x coordinate of the left border of the image | Number | 0 |
y | the y coordinate of the top border of the image | Number | 0 |
src | the url of the image content | String | "" |
width | the width of the image | Number | 100 |
height | the height of the image | Number | 100 |
bounds | the bounding rectangle of the image | Rectangle |
Properties inherited from Mark
property | explanation | type | default value |
---|---|---|---|
id | the unique id of the image | String | |
type | the type of the image | String | “image” |
dataScope | the data scope of the image | DataScope | undefined |
opacity | the opacity value of the image (between 0 and 1) | Number | 1 |
visibility | whether the image is visible (“visible” or “hidden”) | String | “visible” |
Methods inherited from Mark
method | explanation | return type |
---|---|---|
contains(x, y) | whether this mark contains a point x (Number): x coordinate of the point y (Number): y coordinate of the point | Boolean |
getScene() | returns the scene in which this mark resides | Scene |
duplicate() | returns a copy of this mark | Text |