From 46540e9b79da0855cc0d9b00fd5a1ba8b0bafcb1 Mon Sep 17 00:00:00 2001 From: "grzegorz.bylica@gmail.com" Date: Mon, 25 Jul 2016 18:45:37 +0200 Subject: [PATCH 1/3] SLTS-9 adding missing js --- .../customClientScripts/customView.js | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 WebContent/resources/customClientScripts/customView.js diff --git a/WebContent/resources/customClientScripts/customView.js b/WebContent/resources/customClientScripts/customView.js new file mode 100644 index 0000000000..879337e36b --- /dev/null +++ b/WebContent/resources/customClientScripts/customView.js @@ -0,0 +1,121 @@ +/***************************************************************** + * Custom client side scripts for graphical views + ****************************************************************/ + +/***************************************************************** + * 06.02.2015 Pawel + * Script for render color changing progress bar in predefined + * canvas. + * @arg0 canvas element used to draw on + * @arg1 minimal value + * @arg2 value below which bar is red + * @arg3 value below which bar is yellow + * @arg4 maximal value below which bar is green + * @arg5 actual value (in most cases should be set to this.value) + * @arg6 boolean; if true bar is vertical + * if false bar is horizontal + ****************************************************************/ +function renderBar() { + var canvas = document.getElementById(arguments[0]); + var height = canvas.offsetHeight; + var width = canvas.offsetWidth; + var min = arguments[1]; + var step1 = arguments[2]; + var step2 = arguments[3]; + var max = arguments[4]; + var value = arguments[5]; + var isVertical = arguments[6]; + + var context = canvas.getContext("2d"); + + context.beginPath(); + if(isVertical){ + var val = (value-min)*height/(max-min); + context.rect(0, height-val, width, val); + } else { + var val = (value-min)*width/(max-min); + context.rect(0, 0, val, height); + } + if(value