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 |
|---|---|---|---|
| height | the height of the image | Number | 100 |
| src | the url of the image content | String | |
| width | the width of the image | Number | 100 |
| 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 |
Properties inherited from Mark
| property | explanation | type | default value |
|---|---|---|---|
bounds ![]() | the bounding rectangle of the image | Rectangle | |
| dataScope | the data scope of the image | DataScope | undefined |
| fillColor | the fill color of the image | Color | undefined |
id ![]() | the unique id of the image | String | |
| opacity | the opacity value of the image (between 0 and 1) | Number | 1 |
| strokeColor | the stroke color of the image | Color | undefined |
| strokeDash | the dashes and gaps for the image stroke | String | undefined |
| strokeWidth | the stroke width of the image in pixels | Number | undefined |
type ![]() | the type of the image | String | “image” |
| visibility | whether the image is visible (“visible” or “hidden”) | String | “visible” |
Methods
| method | explanation | return type |
|---|---|---|
| resize(width, height) | change the width and height of the image width (Number): width height (Number): height | void |
