SVG Properties

From Mea Wiki
Jump to navigation Jump to search

SVG presentation objects can be used for graphical drawing that contain e.g. shapes, text and images. SVG drawings scale with the dashboard size.

Security note: SVG presentation objects can embed JavaScript code into the dashboards, which may cause information security issues, because the embedded code is executed when users open the dashboard. Thus the dashboard designer persons need to be trusted. Viewer users are not able to change dashboards and embed JavaScript code into dashboards.

Defining SVG code

Here is a simple SVG code, which draws a black square:

<svg viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect x="0" y="0" width="1" height="1" />
</svg>

Following definitions are mandatory in the SVG code for QPR MobileDashboard:

  • Whole SVG code needs to reside inside a single svg tag, i.e. the code must start with <svg ...> and end with </svg>.
  • SVG tag must have a viewBox attribute, which contains following four numbers separated by spaces: top left x coordinate, top left y coordinate, width, height. Note that SVG's coordinates are not pixels but SVG uses own coordinate system. Note also that the SVG can contain shapes that are outside the defined viewbox area. Usually it's practical to have the top left x and y coordinates set to zero and set the width and height so that there is a suitable granularity for the drawing.
  • SVG tag must have following namespace definitions: xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink". There may also be other namespace definitions if they are needed by SVG elements.

The SVG tag has an optional attribute preserveAspectRatio, which determines how the SVG drawing is scaled when aspect ratios of the SVG's and presentation object's drawing area don't match. It has a default value xMidYMid meet, which is used when the preserveAspectRatio is not defined. The default value means that the aspect ratio is not changed and the SVG is drawn in the middle of the presentation object's area. The value may be none, which means that the aspect ratio is allowed to change freely to fit the SVG to the presentation object's area (usually this is not used when the SVG contains text because the text will then become distorted). More information about preserveAspectRatio attribute: Mozilla MDN.

The SVG tag may also contain width and height attributes but they are overwritten by QPR MobileDashboard so those attributes don't have any effect.

More information about SVG:

Actions in the SVG presentation object

The SVG code can contain SVG events (such as clicking shapes), which will trigger QPR MobileDashboard actions. The events are defined in the SVG code as follows:

<tag eventName=<#action name="ActionName">>

Where:

  • tag can be any tag that can be used in the SVG code, such as svg, g, rect, circle or text.
  • eventName can be for example click, doubleclick, mouseover, mouseout, mousedown, mouseup, mousemove. List of all available SVG events: SVG Event
  • ActionName is defined in the "Define SVG actions" text field similarly as with Data Grid popup menu actions.

Context variables in SVG Code

It's possible to use context variables in the SVG code so that the context variable values appear in the SVG drawing. To do this, write the context variable reference as {#variablename}. It's also possible to put the whole SVG code into a context variable, and use the context variable reference in the SVG code.

SVG code example: text

This example contains text block which size, color and positioning can be changed easily. If you change the length of the text, you may need to adjust the viewbox length to fit the text to the available screen.

<svg viewBox="0 0 300 20" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <text x="0" y="15" fill="#707070" style="font-size: 14px;">QPR MobileDashboard supports SVG graphics!</text>
</svg>

SVG code example: Base64 encoded image

This example contains a bitmap image which data is embedded into the SVG code using base64 encoding. You can set margins for the image with following changes to the image tag: x="1" y="1" width="8" height="8".

<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <image x="0" y="0" width="10" height="10" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATYAAAE2CAYAAADrvL6pAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAG+xJREFUeNrt3XlzFeeZ9/GvpCMWgST2fTE22HiSOHYyUzU1b8Cv2e/gqWdqYifOxHEM2GxmMRixCwlJ88d1X+7mIEDYOjrdN99PVZeEAKnV5+pf31v3mUCS3tLKF2eHvzQFzACHgHPAJ8B54APgOLC//P00MLHOt1wDloA7wDXge+Bb4BvgH8BV4H75dy/+4M8vvPTNB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E5MtOsIQgAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9wbmc/slZOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ4NTMzMzY1OAmExKIAAAAPdEVYdFRodW1iOjpTaXplADBCQpSiPuwAAABWdEVYdFRodW1iOjpVUkkAZmlsZTovLy9tbnRsb2cvZmF2aWNvbnMvMjAxNy0wMS0yNS9kMzNkOGY5MDU3ZWM3YTU1NDg2MGQxMjA2ZGZhMjlmMC5pY28ucG5n6Hr3ygAAAABJRU5ErkJggg==">
</svg>

There are online tools available to make the base64 encoding from a bitmap image (e.g. png): https://www.google.com/?#q=base64+encode.

By default SVG preserves it's aspect ratio. If you want the aspect ratio to adjust to the available space add following attribute to the SVG tag: preserveAspectRatio="none".

If you don't want to embed the image data to the SVG code but use an image which is available as a web resource, use the following kind of href in the image tag: xlink:href="https://community.qpr.com/sites/all/themes/custom/qprc_theme/logo.png".

SVG code example: groups with hover effect

The SVG Code and SVG Action sections below result in an SVG image with the following properties:

  • A circle inside a rectangle is drawn
  • The SVG colors are changed when mouse is hovered over the SVG image. The "style" element contains the CSS which defines the rectangle and circle colors to be used when mouse is hovered over the SVG image.
  • A bitmap image residing in the URL defined in the "image" context variable value is placed in the center of the circle.
  • The SVG contains an embedded action named "gotodashboard" which is activated when the SVG image is clicked causing the dashboard to be changed to the dashboard the id of which is defined in the "targetdashboard" context variable.

SVG Code:

<svg onclick="<#action name="GoToDashboard">" viewBox="0 0 205 205" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<style>
.myHoverGroup:hover rect {
  opacity: 0.5;
  fill: #FFFFFF;
}
.myHoverGroup:hover ellipse {      
  stroke: #00CC00;
}
</style>
  <g>   
    <rect height="197" width="197" y="5" x="5" stroke-width="0" fill="#CBCBCB" />
    <rect height="197" width="197" y="0" x="0" stroke-width="0" fill="#CBCBCB" />
    <g class="myHoverGroup" cursor="pointer" transform="translate(0,0)">            
      <rect id="rectangle" height="197" width="197" y="0" x="0" stroke-width="1" stroke="#808080" fill="#FAFAFA" />      
      <ellipse ry="68" rx="68" cy="82" cx="100" stroke-width="5" stroke="#FFCCAA" fill-opacity="1" fill="#FFFFFF" />
      <text xml:space="preserve" font-size="8" text-anchor="middle" y="167" x="100" stroke-width="0" fill="#808080">Click and hover demo</text>
      <text xml:space="preserve" font-size="10" text-anchor="middle" y="183" x="100" stroke-width="0" fill="#808080">Click me!</text>
    </g>
  </g>
</svg>

SVG Action:

[
 {
  "name": "GoToDashboard",
  "contextChanges": {
   "sys:dashboardIdentifier": {
    "behavior": "FIXED",
    "value": "Identifier1"
   }
  }
 }
]

External SVG editors

Instead of editing SVG code as a text, it's possible use an external graphical editor to create SVG drawings. SVG editors:

The SVG code is exported from the external editor and pasted to QPR MobileDashboard. Check that the SVG code contains the viewBox attribute instead of width and height.

Microsoft PowerPoint presentation can converted to SVG using Inkscape: Export the PowerPoint presentation as a PDF and import the PDF to Inkscape where it can be saved as SVG. Template:MDBTutorialAddSVG