Two widgets show a picture uploaded into the dashboard: Image for pictures made of pixels, such as a photo or a logo, and SVG for drawings, such as a plant diagram or a whole screen's background. Both keep the file inside the dashboard itself, so it travels with every export and transfer of the dashboard, and both fit it into their box the same way.
| Widget | Palette tile | Stored type | Shows | Typical use |
|---|---|---|---|---|
| Image | Image | Image |
An uploaded picture, stored as PNG | A logo, a photo of the equipment |
| SVG | SVG | SVG |
An uploaded SVG drawing, stored as text | The screen's background, a process diagram |
Both widgets also have the properties every widget shares: see Properties every widget shares. Their own three settings sit in the Image block of the setup panel: a preview, a file picker, and two choice boxes without captions for the fit.
How a picture fits its box
When the picture and the box have different proportions, two settings decide what happens. scale chooses between
fitting and covering, and aspectRatio chooses where the picture sits:
scale |
The picture |
|---|---|
meet (default) |
Fits inside the box whole. The box shows empty bands where their proportions differ |
slice |
Covers the whole box. What overflows is cut off |
aspectRatio |
Where the picture sits |
|---|---|
xMidYMid (default) |
Centred both ways |
xMinYMin … xMaxYMax |
xMin, xMid or xMax pins it to the left, the middle or the right; YMin, YMid or YMax to the top, the middle or the bottom. With meet this places the picture in its band; with slice it chooses the part that stays |
none |
Fills the box exactly, stretched or squeezed to its proportions. scale does not matter |
The choice boxes list the names in capitals, XMIDYMID or MEET, and in English only. The first sets aspectRatio,
the second scale. Changing them, or the file, can be undone and enables Save, like any other edit.
Image
An image shows a picture made of pixels. Pick the file in the Image block: PNG, JPEG, GIF, BMP and the other formats Java can read. The picture is converted to PNG and stored in the dashboard as text, so a photo usually takes more room than the file it came from. An animated GIF keeps its first frame. Until a file is chosen, the widget shows a placeholder picture, in the editor and in the viewer.
- Size and place come from the box: a new image is 80 × 32 px, centred on the point where it was dropped. The
offsets
dX,dY,dWidthanddHeightmove and resize it in the viewer. - Every repaint encodes the picture again. A view repaints each time a variable it shows changes, and every repaint turns the picture into PNG once more. A large picture on a busy screen therefore costs the server work at every change. Keep Image for small pictures, such as a logo, and use an SVG for large pictures and backgrounds.
Properties
| Key | Editor label (English) | Formula or value | Result type | Default | Meaning |
|---|---|---|---|---|---|
image |
Image: the file picker | Value | A PNG picture, stored as Base64 text | Empty: a placeholder picture | The picture to show |
aspectRatio |
Image: the first choice box, without a caption | Value | none, xMinYMin, xMidYMin, xMaxYMin, xMinYMid, xMidYMid, xMaxYMid, xMinYMax, xMidYMax or xMaxYMax |
xMidYMid |
Where the picture sits in the box; none stretches it to the box |
scale |
Image: the second choice box, without a caption | Value | meet or slice |
meet |
meet fits the whole picture inside the box; slice covers the box and cuts off the rest |
Styling
- Element: one SVG
<image>.stylesapplies to it. - Default styles:
{}, none. - Keys that work:
opacityandcursor. - Keys to avoid:
fillandstroke, which do not colour a picture, andx,y,widthandheight, which some browsers take as the image's geometry and draw instead of its box.
The widget reads no style key itself.
Styled example. A camera snapshot, dimmed while the camera is offline:
Styles {opacity:if(CAM_1_ONLINE,1,0.4)}
SVG
An SVG widget shows a drawing. Pick a file whose name ends in .svg in the Image block; any other file is ignored.
The drawing is stored in the dashboard as the text of the file. Until a file is chosen, the widget shows a placeholder
picture.
- It is shown as a picture. Scripts and links inside the drawing do nothing, and it cannot load other files. Text in it is drawn with the fonts of the viewer's device, so convert text to paths in the drawing program when its look matters.
- Styles are never applied. The setup panel offers no Styles field, and a
stylesstored in the record changes nothing. Change the look in the drawing itself, draw shapes over it, and show or hide it withvisible. The offsetsdX,dY,dWidthanddHeightdo move and resize it in the viewer. - A drawing stays sharp at every zoom, and repainting it costs little, which makes it the widget for large pictures.
- Use it as the background. A drawing of the whole screen goes last in the widget list, because the first
widget is drawn on top and the last underneath everything. Make its box the size of the canvas, and draw it in the
canvas's proportions: a drawing of 1920 × 1080 on a canvas of 1920 × 1080 fills it with
meet, without bands. See How dashboards draw and refresh for the paint order and the canvas size.
Properties
| Key | Editor label (English) | Formula or value | Result type | Default | Meaning |
|---|---|---|---|---|---|
image |
Image: the file picker | Value | SVG text | Empty: a placeholder picture | The drawing to show |
aspectRatio |
Image: the first choice box, without a caption | Value | none, xMinYMin, xMidYMin, xMaxYMin, xMinYMid, xMidYMid, xMaxYMid, xMinYMax, xMidYMax or xMaxYMax |
xMidYMid |
Where the drawing sits in the box; none stretches it to the box |
scale |
Image: the second choice box, without a caption | Value | meet or slice |
meet |
meet fits the whole drawing inside the box; slice covers the box and cuts off the rest |
Styling
- Element: one SVG
<image>.stylesis never applied to it. - Default styles:
{}, none. - Keys that work: none.
- Keys to avoid: all of them; they have no effect.
The widget reads no style key itself.
Styled example. A drawing cannot be styled, but a shape can be drawn over it. A red frame around the whole background while the plant is in alarm is a Rectangle with the canvas's box, placed before the SVG in the list so that it is drawn over it:
Styles {fill:"none",stroke:if(PLANT_ALARM,"#DC2626","none"),stroke_width:8}
Next steps
This page describes Data Orchester Dashboards 1.9.4.