Initial commit

This commit is contained in:
zhongjin 2018-09-28 09:18:42 +08:00
commit 367491f8aa
22 changed files with 1185 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/node_modules
/.idea

6
.npmignore Normal file
View File

@ -0,0 +1,6 @@
Gruntfile.js
tasks
node_modules
test
.travis.yml
appveyor.yml

7
.travis.yml Normal file
View File

@ -0,0 +1,7 @@
os:
- linux
language: node_js
node_js:
- '4'
- '8'
- '10'

193
Gruntfile.js Normal file
View File

@ -0,0 +1,193 @@
// To use this file in WebStorm, right click on the file name in the Project Panel (normally left) and select "Open Grunt Console"
/** @namespace __dirname */
/* jshint -W097 */// jshint strict:false
/*jslint node: true */
"use strict";
function getAppName() {
var parts = __dirname.replace(/\\/g, '/').split('/');
return parts[parts.length - 1].split('.')[0].toLowerCase();
}
module.exports = function (grunt) {
var srcDir = __dirname + '/';
var pkg = grunt.file.readJSON('package.json');
var iopackage = grunt.file.readJSON('io-package.json');
var version = (pkg && pkg.version) ? pkg.version : iopackage.common.version;
var appName = getAppName();
// Project configuration.
grunt.initConfig({
pkg: pkg,
replace: {
core: {
options: {
patterns: [
{
match: /var version = *'[\.0-9]*';/g,
replacement: "var version = '" + version + "';"
},
{
match: /"version"\: *"[\.0-9]*",/g,
replacement: '"version": "' + version + '",'
}
]
},
files: [
{
expand: true,
flatten: true,
src: [
srcDir + 'controller.js',
srcDir + 'package.json',
srcDir + 'io-package.json'
],
dest: srcDir
}
]
},
name: {
options: {
patterns: [
{
match: /yunkong2/gi,
replacement: appName
}
]
},
files: [
{
expand: true,
flatten: true,
src: [
srcDir + '*.*',
srcDir + '.travis.yml'
],
dest: srcDir
},
{
expand: true,
flatten: true,
src: [
srcDir + 'admin/*.*',
'!' + srcDir + 'admin/*.png'
],
dest: srcDir + 'admin'
},
{
expand: true,
flatten: true,
src: [
srcDir + 'lib/*.*'
],
dest: srcDir + 'lib'
},
{
expand: true,
flatten: true,
src: [
srcDir + 'example/*.*'
],
dest: srcDir + 'example'
},
{
expand: true,
flatten: true,
src: [
srcDir + 'www/*.*'
],
dest: srcDir + 'www'
}
]
}
},
// Javascript code styler
jscs: require(__dirname + '/tasks/jscs.js'),
// Lint
jshint: require(__dirname + '/tasks/jshint.js'),
http: {
get_hjscs: {
options: {
url: 'https://raw.githubusercontent.com/' + appName + '/' + appName + '.js-controller/master/tasks/jscs.js'
},
dest: 'tasks/jscs.js'
},
get_jshint: {
options: {
url: 'https://raw.githubusercontent.com/' + appName + '/' + appName + '.js-controller/master/tasks/jshint.js'
},
dest: 'tasks/jshint.js'
},
get_gruntfile: {
options: {
url: 'https://raw.githubusercontent.com/' + appName + '/' + appName + '.build/master/adapters/Gruntfile.js'
},
dest: 'Gruntfile.js'
},
get_utilsfile: {
options: {
url: 'https://raw.githubusercontent.com/' + appName + '/' + appName + '.build/master/adapters/utils.js'
},
dest: 'lib/utils.js'
},
get_jscsRules: {
options: {
url: 'https://raw.githubusercontent.com/' + appName + '/' + appName + '.js-controller/master/tasks/jscsRules.js'
},
dest: 'tasks/jscsRules.js'
}
}
});
grunt.registerTask('updateReadme', function () {
var readme = grunt.file.read('README.md');
var pos = readme.indexOf('## Changelog\n');
if (pos != -1) {
var readmeStart = readme.substring(0, pos + '## Changelog\n'.length);
var readmeEnd = readme.substring(pos + '## Changelog\n'.length);
if (readme.indexOf(version) == -1) {
var timestamp = new Date();
var date = timestamp.getFullYear() + '-' +
('0' + (timestamp.getMonth() + 1).toString(10)).slice(-2) + '-' +
('0' + (timestamp.getDate()).toString(10)).slice(-2);
var news = "";
if (iopackage.common.whatsNew) {
for (var i = 0; i < iopackage.common.whatsNew.length; i++) {
if (typeof iopackage.common.whatsNew[i] == 'string') {
news += '* ' + iopackage.common.whatsNew[i] + '\n';
} else {
news += '* ' + iopackage.common.whatsNew[i].en + '\n';
}
}
}
grunt.file.write('README.md', readmeStart + '### ' + version + ' (' + date + ')\n' + (news ? news + '\n\n' : '\n') + readmeEnd);
}
}
});
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-http');
grunt.registerTask('default', [
'http',
'replace:core',
'updateReadme',
'jshint',
'jscs'
]);
grunt.registerTask('p', [
'replace:core',
'updateReadme'
]);
grunt.registerTask('rename', [
'replace:name'
]);
};

22
LICENSE Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2016 bluefox <dogafox@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

39
README.md Normal file
View File

@ -0,0 +1,39 @@
![Logo](admin/vis-canvas-gauges.png)
yunkong2.vis-canvas-gauges
============
![Logo](img/logo.svg)
[![NPM version](http://img.shields.io/npm/v/yunkong2.vis-canvas-gauges.svg)](https://www.npmjs.com/package/yunkong2.vis-canvas-gauges)
[![Downloads](https://img.shields.io/npm/dm/yunkong2.vis-canvas-gauges.svg)](https://www.npmjs.com/package/yunkong2.vis-canvas-gauges)
[![NPM](https://nodei.co/npm/yunkong2.vis-canvas-gauges.png?downloads=true)](https://nodei.co/npm/yunkong2.vis-canvas-gauges/)
canvas-gauges - Canvas gauges for yunkong2.vis
![Example](img/widgets.png)
Very detailed canvas library from Mikhus is used in this widget set. Thank you Mikhus.
You can find description of used library here: [https://canvas-gauges.com](https://canvas-gauges.com)
And on github [here](https://git.spacen.net/Mikhus/canvas-gauges)
## Changelog
### 0.1.5 (2016-11-24)
- (bluefox) do not scan DOM at start
### 0.1.4 (2016-11-18)
- (bluefox) fix destroy of widgets
### 0.1.3 (2016-10-06)
- (bluefox) fix highlights if min not zero
### 0.1.2 (2016-09-30)
- (bluefox) translate english
### 0.1.0 (2016-09-26)
- (bluefox) initial checkin
## License
Copyright (c) 2016 bluefox https://git.spacen.net/GermanBluefox
MIT

BIN
admin/vis-canvas-gauges.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

1
img/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="120" viewBox="0 0 785 175"><path d="M164.8 23.5C145-4.5 54.5-14 12.8 57.8c-15.3 30.3-19.6 67 22.7 93.6 27.8 14.8 49.2 17.5 74.2 11.4 20.8-5 39-22.7 47.8-35.3-18.2 12.7-48.8 45-103.5 13.4-26.7-19.2-32-47-19.3-75C57 20.6 120.2-8.3 164.5 23"></path><path d="M91 79.7c.7-1 20.3 1.8 50.4 9 25 6 25.3 11.7 25.6 11.2 7.4-9 7-18.7 6.3-20-88.4-.6 1.7-.3-82.4-.7M90 139.5l5.7.7 2.6-16.6-2-.7-6.4 16.5zM40.2 106.4l2 4.4 18.6-8-.7-1.7-19.8 5.4zM59.7 44.2L56.3 48l17.2 8.7 1-1.2-14.8-11.3zM123 19l-5.8-.5-2 16.7 2 .6L123 19zM637 134.6q-77.8-4.5-245.4 4-167.6 2.5-194-5.7l39.2 15.4q62 2.7 186.3-6 149.6-10.5 214-7.8zM264.4 72.4q-8-5.6-17.7-5.6T231.5 73q-5.4 6.3-5.4 16 0 10 5.5 16.2 5.5 6.2 15.2 6.2 9.6 0 17.7-5.6h.4v7.4q-8.5 5.4-18.5 5.4-12 0-19.6-8-7.7-8-7.7-21.5 0-13.4 7.7-21.3 7.7-8 19.6-8 10 0 18.5 5.3v7.4h-.4m11.5 5.8q6.7-3 14.4-3 7.8 0 12 4.6 4 4.8 4 11.4v26.5h-6.2l-.8-5.2h-.3q-5.5 6-14.3 6-5.3 0-9-3.3-3.7-3.4-3.7-9.2 0-5.8 4.6-9.4Q281 93 290 93h9.4v-.7q0-5.4-2.6-7.8-2.5-2.4-8.7-2.4-6.2 0-11.6 3h-.5V78m23.4 27.6v-7H291q-12 0-12 6.7 0 6.5 8.4 6.5 3.4 0 6.6-1.8 3.2-1.7 5.4-4.4M340 75q6.5 0 10.3 4.7 3.7 4.6 3.7 11.5v26.5h-7V92q0-10-8.7-10-6.7 0-12.7 7.8v28h-7v-42h6l1 5.3v1.4Q332 75 340.2 75m53 1h7.6L384 117.6h-7L360.2 76h7.7l12.3 33h.3L393 76m15 2.2q6.7-3 14.5-3t12 4.6q4 4.8 4 11.4v26.5h-6.2l-1-5.2q-5.7 6-14.5 6-5.3 0-9-3.3-3.7-3.4-3.7-9.2 0-5.8 4.6-9.4Q413.2 93 422 93h9.4v-.7q0-5.4-2.5-7.8-2.6-2.4-9-2.4-6 0-11.6 3h-.4V78m23.4 27.6v-7H423q-11.8 0-11.8 6.7 0 6.5 8.2 6.5 3.4 0 6.6-1.8 3.2-1.7 5.4-4.4m33.5-24q-5 0-7.4 1.7-2.4 1.6-2.4 4t2.4 3.7q2.4 1.3 6 2l6.8 2q3.4 1.2 5.8 4 2.5 2.8 2.5 7.6 0 5-4 8.3-4 3.6-11.7 3.6-7.7 0-14-3.7v-7.3h.3q6.3 4 13.8 4 8.8 0 8.8-6 0-1.7-2.4-3-2.4-1-6-2-3.3-.8-6.7-2-3.5-1-6-3.8-2.3-2.8-2.3-7 0-5.7 4-9.3 4-3.6 10.7-3.6 7 0 12.7 2.4v6.8h-.5Q470 82 460 82m74 4.3h20.5v26q-10 6.3-20.8 6.3-12.2 0-19.8-8.3-7.7-8.2-7.7-21.2t7.8-21q8-8.3 19-8.3 10.8 0 20.7 6.3v7.7h-.4q-9.5-6.8-19-6.8-9.2 0-15 5.8-6 6-6 16t5.8 16.4q5.8 6.3 15.6 6.3 7.4 0 13.7-3.6V93H534v-6.7m33-8q6.7-3.2 14.4-3.2 7.8 0 12 4.8 4 4.8 4 11.4v26.5h-6.2l-.8-5.2h-.3q-5.5 6-14.3 6-5.3 0-9-3.3-3.7-3.4-3.7-9.2 0-5.8 4.6-9.4Q572 93 581 93h9.4v-.7q0-5.4-2.6-7.8-2.5-2.4-8.7-2.4-6.2 0-11.6 3h-.5V78m23.4 27.6v-7H582q-12 0-12 6.7 0 6.5 8.4 6.5 3.4 0 6.6-1.8 3.2-1.7 5.4-4.4m32.7 12.8q-6.4 0-10-4.6-3.8-4.6-3.8-11.5V76h7v25.7q0 10 8.6 10 6.8 0 12.8-8V76h7v41.7h-6l-1-5.2v-1.2q-6.5 7.3-14.5 7.3M687.8 76h6.2v40q0 10.3-5 15.8-4.6 5.6-13.6 5.6t-16.4-4.2V126h.4q6.6 4.4 15.5 4.4 11.8 0 11.8-13.4v-5.3h-.2q-5.4 6-13 6-7.4 0-13.2-5.6-5.8-5.5-5.8-15.6 0-10 5.8-15.7 5.8-5.6 13.3-5.6 7.5 0 13 6l1-5m-1 29V88q-5.5-6-11.6-6-6 0-9.6 3.6-3.7 3.7-3.7 10.8 0 7 3.7 10.8 3.7 3.7 9.7 3.7 6.2 0 11.8-6m54.3-8.2v2.6h-30q.7 5.8 4 9 3.5 3.2 10.5 3.2t13-4h.3v7q-6.6 4-15.4 4-9 0-14.2-5.7-5.3-6-5.3-15.6 0-9.7 4.6-16 4.8-6.3 14-6.3 9 0 13.8 6.4 4.7 6.3 4.7 15.4m-30-3.4h23q-.3-6-3.7-9-3.5-3-7.8-3t-7.7 3q-3.4 3-3.8 9M765 82q-5 0-7.3 1.5-2.4 1.6-2.4 4t2.4 3.7q2.5 1.3 6 2l6.8 2q3.4 1.2 6 4 2.3 2.8 2.3 7.6 0 5-4 8.3-4 3.6-11.6 3.6-7.8 0-14.2-3.7v-7.3h.4q6.3 4 14 4 8.5 0 8.5-6 0-1.7-2.5-3-2.4-1-5.8-2-3.5-.8-7-2-3.3-1-5.7-3.8-2.5-2.8-2.5-7 0-5.7 4-9.3 4-3.6 10.7-3.6 6.8 0 12.6 2.4v6.8h-.5Q770 82 760 82z"></path> </svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
img/widgets.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

70
io-package.json Normal file
View File

@ -0,0 +1,70 @@
{
"common": {
"name": "vis-canvas-gauges",
"version": "0.1.5",
"news": {
"0.1.5": {
"en": "do not scan DOM at start",
"de": "Skäniere DOM nicht beim Start",
"ru": "Не искать элементы в DOM при старте"
},
"0.1.4": {
"en": "fix destroy of widgets",
"de": "Korrigiere löschen von Widgets",
"ru": "Исправлено удаление элементов"
},
"0.1.3": {
"en": "fix highlights if min not zero",
"de": "Korrigiere Markierung, falls min ist nicht null",
"ru": "Исправлены секторы, если min не ноль"
},
"0.1.2": {
"en": "english translation",
"de": "Englisch Übersetzung",
"ru": "Английский перевод"
},
"0.1.0": {
"en": "initial commit",
"de": "initial commit",
"ru": "initial commit"
}
},
"title": "yunkong2 Visualisation - canvas-gauges style Widgets",
"desc": {
"en": "Canvas gauges for yunkong2.vis",
"de": "Canvas gauges für yunkong2.vis",
"ru": "Canvas gauges для yunkong2.vis"
},
"platform": "Javascript/Node.js",
"loglevel": "info",
"icon": "vis-canvas-gauges.png",
"enabled": true,
"mode": "once",
"extIcon": "https://git.spacen.net/yunkong2/yunkong2.vis-canvas-gauges/raw/master/admin/vis-canvas-gauges.png",
"keywords": [
"canvas-gauges",
"vis",
"GUI",
"graphical",
"scada"
],
"readme": "https://git.spacen.net/yunkong2/yunkong2.vis-canvas-gauges/blob/master/README.md",
"authors": [
"bluefox <dogafox@gmail.com>"
],
"localLink": "%web_protocol%://%ip%:%web_port%/vis/edit.html",
"license": "MIT",
"dependencies": [
"vis"
],
"onlyWWW": true,
"singleton": true,
"type": "visualization-widgets",
"restartAdapters": [
"vis"
],
"noConfig": true
},
"native": {},
"instanceObjects": []
}

49
package.json Normal file
View File

@ -0,0 +1,49 @@
{
"name": "yunkong2.vis-canvas-gauges",
"description": "canvas-gauges Widgets for yunkong2.vis",
"version": "0.1.5",
"author": {
"name": "bluefox",
"email": "dogafox@gmail.com"
},
"contributors": [
"bluefox <dogafox@gmail.com>"
],
"homepage": "https://git.spacen.net/yunkong2/yunkong2.vis-canvas-gauges",
"repository": {
"type": "git",
"url": "https://git.spacen.net/yunkong2/yunkong2.vis-canvas-gauges"
},
"licenses": [
{
"type": "MIT",
"url": "https://git.spacen.net/yunkong2/yunkong2.vis-canvas-gauges/blob/master/LICENSE"
}
],
"keywords": [
"yunkong2",
"GUI",
"DashUI",
"web interface",
"home automation",
"SCADA",
"canvas-gauges GUI"
],
"devDependencies": {
"grunt": "^1.0.1",
"grunt-replace": "^1.0.1",
"grunt-contrib-jshint": "^1.1.0",
"grunt-jscs": "^3.0.1",
"grunt-http": "^2.2.0",
"mocha": "^4.1.0",
"chai": "^4.1.2"
},
"bugs": {
"url": "https://git.spacen.net/yunkong2/yunkong2.vis-canvas-gauges/issues"
},
"main": "widgets/canvas-gauges.html",
"scripts": {
"test": "node node_modules/mocha/bin/mocha --exit"
},
"license": "MIT"
}

17
tasks/jscs.js Normal file
View File

@ -0,0 +1,17 @@
var srcDir = __dirname + "/../";
module.exports = {
all: {
src: [
srcDir + "*.js",
srcDir + "lib/*.js",
srcDir + "adapter/example/*.js",
srcDir + "tasks/**/*.js",
srcDir + "www/**/*.js",
'!' + srcDir + "www/lib/**/*.js",
'!' + srcDir + 'node_modules/**/*.js',
'!' + srcDir + 'adapter/*/node_modules/**/*.js'
],
options: require('./jscsRules.js')
}
};

36
tasks/jscsRules.js Normal file
View File

@ -0,0 +1,36 @@
module.exports = {
force: true,
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"], /*"if",*/
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"disallowSpacesInFunctionDeclaration": {"beforeOpeningRoundBrace": true},
"disallowSpacesInNamedFunctionExpression": {"beforeOpeningRoundBrace": true},
"requireSpacesInFunctionExpression": {"beforeOpeningCurlyBrace": true},
"requireSpacesInAnonymousFunctionExpression": {"beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true},
"requireSpacesInNamedFunctionExpression": {"beforeOpeningCurlyBrace": true},
"requireSpacesInFunctionDeclaration": {"beforeOpeningCurlyBrace": true},
"disallowMultipleVarDecl": true,
"requireBlocksOnNewline": true,
"disallowEmptyBlocks": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpacesInsideParentheses": true,
"requireCommaBeforeLineBreak": true,
//"requireAlignedObjectValues": "all",
"requireOperatorBeforeLineBreak": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
// "disallowLeftStickedOperators": ["?", "+", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
// "requireRightStickedOperators": ["!"],
// "requireSpaceAfterBinaryOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
//"disallowSpaceAfterBinaryOperators": [","],
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
"requireSpaceAfterBinaryOperators": ["?", ">", ",", ">=", "<=", "<", "+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
//"validateIndentation": 4,
//"validateQuoteMarks": { "mark": "\"", "escape": true },
"disallowMixedSpacesAndTabs": true,
"disallowKeywordsOnNewLine": ["else", "catch"]
};

17
tasks/jshint.js Normal file
View File

@ -0,0 +1,17 @@
var srcDir = __dirname + "/../";
module.exports = {
options: {
force: true
},
all: [
srcDir + "*.js",
srcDir + "lib/*.js",
srcDir + "adapter/example/*.js",
srcDir + "tasks/**/*.js",
srcDir + "www/**/*.js",
'!' + srcDir + "www/lib/**/*.js",
'!' + srcDir + 'node_modules/**/*.js',
'!' + srcDir + 'adapter/*/node_modules/**/*.js'
]
};

91
test/testPackageFiles.js Normal file
View File

@ -0,0 +1,91 @@
/* jshint -W097 */
/* jshint strict:false */
/* jslint node: true */
/* jshint expr: true */
var expect = require('chai').expect;
var fs = require('fs');
describe('Test package.json and io-package.json', function() {
it('Test package files', function (done) {
console.log();
var fileContentIOPackage = fs.readFileSync(__dirname + '/../io-package.json', 'utf8');
var ioPackage = JSON.parse(fileContentIOPackage);
var fileContentNPMPackage = fs.readFileSync(__dirname + '/../package.json', 'utf8');
var npmPackage = JSON.parse(fileContentNPMPackage);
expect(ioPackage).to.be.an('object');
expect(npmPackage).to.be.an('object');
expect(ioPackage.common.version, 'ERROR: Version number in io-package.json needs to exist').to.exist;
expect(npmPackage.version, 'ERROR: Version number in package.json needs to exist').to.exist;
expect(ioPackage.common.version, 'ERROR: Version numbers in package.json and io-package.json needs to match').to.be.equal(npmPackage.version);
if (!ioPackage.common.news || !ioPackage.common.news[ioPackage.common.version]) {
console.log('WARNING: No news entry for current version exists in io-package.json, no rollback in Admin possible!');
console.log();
}
expect(npmPackage.author, 'ERROR: Author in package.json needs to exist').to.exist;
expect(ioPackage.common.authors, 'ERROR: Authors in io-package.json needs to exist').to.exist;
if (ioPackage.common.name.indexOf('template') !== 0) {
if (Array.isArray(ioPackage.common.authors)) {
expect(ioPackage.common.authors.length, 'ERROR: Author in io-package.json needs to be set').to.not.be.equal(0);
if (ioPackage.common.authors.length === 1) {
expect(ioPackage.common.authors[0], 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name <my@email.com>');
}
}
else {
expect(ioPackage.common.authors, 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name <my@email.com>');
}
}
else {
console.log('WARNING: Testing for set authors field in io-package skipped because template adapter');
console.log();
}
expect(fs.existsSync(__dirname + '/../README.md'), 'ERROR: README.md needs to exist! Please create one with description, detail information and changelog. English is mandatory.').to.be.true;
if (!ioPackage.common.titleLang || typeof ioPackage.common.titleLang !== 'object') {
console.log('WARNING: titleLang is not existing in io-package.json. Please add');
console.log();
}
if (
ioPackage.common.title.indexOf('yunkong2') !== -1 ||
ioPackage.common.title.indexOf('yunkong2') !== -1 ||
ioPackage.common.title.indexOf('adapter') !== -1 ||
ioPackage.common.title.indexOf('Adapter') !== -1
) {
console.log('WARNING: title contains Adapter or yunkong2. It is clear anyway, that it is adapter for yunkong2.');
console.log();
}
if (ioPackage.common.name.indexOf('vis-') !== 0) {
if (!ioPackage.common.materialize || !fs.existsSync(__dirname + '/../admin/index_m.html') || !fs.existsSync(__dirname + '/../gulpfile.js')) {
console.log('WARNING: Admin3 support is missing! Please add it');
console.log();
}
if (ioPackage.common.materialize) {
expect(fs.existsSync(__dirname + '/../admin/index_m.html'), 'Admin3 support is enabled in io-package.json, but index_m.html is missing!').to.be.true;
}
}
var licenseFileExists = fs.existsSync(__dirname + '/../LICENSE');
var fileContentReadme = fs.readFileSync(__dirname + '/../README.md', 'utf8');
if (fileContentReadme.indexOf('## Changelog') === -1) {
console.log('Warning: The README.md should have a section ## Changelog');
console.log();
}
expect((licenseFileExists || fileContentReadme.indexOf('## License') !== -1), 'A LICENSE must exist as LICENSE file or as part of the README.md').to.be.true;
if (!licenseFileExists) {
console.log('Warning: The License should also exist as LICENSE file');
console.log();
}
if (fileContentReadme.indexOf('## License') === -1) {
console.log('Warning: The README.md should also have a section ## License to be shown in Admin3');
console.log();
}
done();
});
});

606
widgets/canvas-gauges.html Normal file
View File

@ -0,0 +1,606 @@
<!--
yunkong2.vis-canvas-gauges
version: "0.1.5"
Copyright 2016 bluefox<dogafox@gmail.com>
-->
<script type="text/javascript" src="widgets/canvas-gauges/js/gauge.min.js"></script>
<script language="javascript">
'use strict';
// Add words for bars
if (vis.editMode) {
$.extend(systemDictionary, {
"linear": {"en": "linear", "de": "linear", "ru": "linear"},
"quad": {"en": "quad", "de": "quad", "ru": "quad"},
"quint": {"en": "quint", "de": "quint", "ru": "quint"},
"cycle": {"en": "cycle", "de": "cycle", "ru": "cycle"},
"elastic": {"en": "elastic", "de": "elastic", "ru": "elastic"},
"dequad": {"en": "dequad", "de": "dequad", "ru": "dequad"},
"dequint": {"en": "dequint", "de": "dequint", "ru": "dequint"},
"decycle": {"en": "decycle", "de": "decycle", "ru": "decycle"},
"debounce": {"en": "debounce", "de": "debounce", "ru": "debounce"},
"delastic": {"en": "delastic", "de": "delastic", "ru": "delastic"},
"arrow": {"en": "arrow", "de": "arrow", "ru": "arrow"},
"minValue": {"en": "min", "de": "min", "ru": "minValue"},
"maxValue": {"en": "max", "de": "max", "ru": "maxValue"},
"valueOffset": {"en": "Value offset", "de": "Wertoffset", "ru": "valueOffset"},
"hCount": {"en": "Highlights number", "de": "Anzahl von Sektoren", "ru": "Кол-во секторов"},
"group_highlights": {"en": "Highlights", "de": "Sektoren", "ru": "Сектора"},
"highlightsFrom": {"en": "From", "de": "Von", "ru": "highlightsFrom"},
"highlightsTo": {"en": "To", "de": "Bis", "ru": "highlightsTo"},
"highlightsColor": {"en": "Color", "de": "Farbe", "ru": "highlightsColor"},
"majorTicks": {"en": "Major ticks", "de": "majorTicks", "ru": "majorTicks"},
"minorTicks": {"en": "Minor ticks", "de": "minorTicks", "ru": "minorTicks"},
"strokeTicks": {"en": "Stroke ticks", "de": "strokeTicks", "ru": "strokeTicks"},
"majorTicksInt": {"en": "Before comma ", "de": "majorTicksInt", "ru": "majorTicksInt"},
"majorTicksDec": {"en": "After comma", "de": "majorTicksDec", "ru": "majorTicksDec"},
"group_animation": {"en": "Animation", "de": "group_animation", "ru": "group_animation"},
"animation": {"en": "Enabled", "de": "animation", "ru": "animation"},
"animationDuration": {"en": "Duration", "de": "animationDuration", "ru": "animationDuration"},
"animationRule": {"en": "Rule", "de": "animationRule", "ru": "animationRule"},
"animatedValue": {"en": "Value", "de": "animatedValue", "ru": "animatedValue"},
"animateOnInit": {"en": "Animate on start", "de": "animateOnInit", "ru": "animateOnInit"},
"group_colorsGauge": {"en": "Colors", "de": "Farben", "ru": "group_colorsGauge"},
"colorPlate": {"en": "Plate", "de": "Plate", "ru": "colorPlate"},
"colorPlateEnd": {"en": "Plate end", "de": "PlateEnd", "ru": "colorPlateEnd"},
"colorMajorTicks": {"en": "Major ticks", "de": "MajorTicks", "ru": "colorMajorTicks"},
"colorMinorTicks": {"en": "Minor ticks", "de": "MinorTicks", "ru": "colorMinorTicks"},
"colorTitle": {"en": "Title", "de": "Title", "ru": "colorTitle"},
"colorUnits": {"en": "Units", "de": "Units", "ru": "colorUnits"},
"colorNumbers": {"en": "Numbers", "de": "Numbers", "ru": "colorNumbers"},
"colorNeedle": {"en": "Needle", "de": "Needle", "ru": "colorNeedle"},
"colorNeedleEnd": {"en": "NeedleEnd", "de": "NeedleEnd", "ru": "colorNeedleEnd"},
"colorValueText": {"en": "ValueText", "de": "ValueText", "ru": "colorValueText"},
"colorValueTextShadow": {"en": "Value text shadow", "de": "ValueTextShadow", "ru": "colorValueTextShadow"},
"colorBorderShadow": {"en": "Border shadow", "de": "BorderShadow", "ru": "colorBorderShadow"},
"colorBorderOuter": {"en": "Border outer", "de": "BorderOuter", "ru": "colorBorderOuter"},
"colorBorderOuterEnd": {"en": "Border outer end", "de": "BorderOuterEnd", "ru": "colorBorderOuterEnd"},
"colorBorderMiddle": {"en": "Border middle", "de": "BorderMiddle", "ru": "colorBorderMiddle"},
"colorBorderMiddleEnd": {"en": "Border middle end", "de": "BorderMiddleEnd", "ru": "colorBorderMiddleEnd"},
"colorBorderInner": {"en": "Border inner", "de": "BorderInner", "ru": "colorBorderInner"},
"colorBorderInnerEnd": {"en": "Border inner end", "de": "BorderInnerEnd", "ru": "colorBorderInnerEnd"},
"colorValueBoxRect": {"en": "Value box rect", "de": "ValueBoxRect", "ru": "colorValueBoxRect"},
"colorValueBoxRectEnd": {"en": "Value box rect end", "de": "ValueBoxRectEnd", "ru": "colorValueBoxRectEnd"},
"colorValueBoxBackground": {"en": "Value box background", "de": "ValueBoxBackground", "ru": "colorValueBoxBackground"},
"colorValueBoxShadow": {"en": "Value box shadow", "de": "ValueBoxShadow", "ru": "colorValueBoxShadow"},
"colorNeedleShadowUp": {"en": "Needle shadow up", "de": "NeedleShadowUp", "ru": "colorNeedleShadowUp"},
"colorNeedleShadowDown": {"en": "Needle shadow down", "de": "NeedleShadowDown", "ru": "colorNeedleShadowDown"},
"needle": {"en": "Needle", "de": "needle", "ru": "needle"},
"needleShadow": {"en": "NeedleShadow", "de": "needleShadow", "ru": "needleShadow"},
"needleType": {"en": "NeedleType", "de": "needleType", "ru": "needleType"},
"needleStart": {"en": "NeedleStart", "de": "needleStart", "ru": "needleStart"},
"needleEnd": {"en": "NeedleEnd", "de": "needleEnd", "ru": "needleEnd"},
"needleWidth": {"en": "NeedleWidth", "de": "needleWidth", "ru": "needleWidth"},
"group_borders": {"en": "Borders", "de": "Rahmen", "ru": "group_borders"},
"borders": {"en": "Enabled", "de": "Aktiviert", "ru": "borders"},
"borderOuterWidth": {"en": "Outer width", "de": "borderOuterWidth", "ru": "borderOuterWidth"},
"borderMiddleWidth": {"en": "Middle width", "de": "borderMiddleWidth", "ru": "borderMiddleWidth"},
"borderInnerWidth": {"en": "Inner width", "de": "borderInnerWidth", "ru": "borderInnerWidth"},
"borderShadowWidth": {"en": "Shadow width", "de": "borderShadowWidth", "ru": "borderShadowWidth"},
"group_valueBox": {"en": "Value Box", "de": "Wert-Box", "ru": "group_valueBox"},
"valueBox": {"en": "Enabled", "de": "Aktiviert", "ru": "valueBox"},
"valueBoxStroke": {"en": "Box stroke", "de": "valueBoxStroke", "ru": "valueBoxStroke"},
"valueText": {"en": "Text", "de": "valueText", "ru": "valueText"},
"valueTextShadow": {"en": "Text shadow", "de": "valueTextShadow", "ru": "valueTextShadow"},
"valueBoxBorderRadius": {"en": "Box border radius", "de": "valueBoxBorderRadius", "ru": "valueBoxBorderRadius"},
"valueInt": {"en": "Before comma", "de": "Vor Komma", "ru": "valueInt"},
"valueDec": {"en": "After comma", "de": "Nach Komma", "ru": "valueDec"},
"group_fonts": {"en": "Fonts", "de": "Schriften", "ru": "group_fonts"},
"fontNumbers": {"en": "Numbers", "de": "Numbers", "ru": "fontNumbers"},
"fontTitle": {"en": "Title", "de": "Title", "ru": "fontTitle"},
"fontUnits": {"en": "Units", "de": "Units", "ru": "fontUnits"},
"fontValue": {"en": "Value", "de": "Value", "ru": "fontValue"},
"fontNumbersSize": {"en": "Numbers size", "de": "Numbers Size", "ru": "fontNumbersSize"},
"fontTitleSize": {"en": "Title size", "de": "Title Size", "ru": "fontTitleSize"},
"fontUnitsSize": {"en": "Units size", "de": "Units Size", "ru": "fontUnitsSize"},
"fontValueSize": {"en": "Value size", "de": "Value Size", "ru": "fontValueSize"},
"fontNumbersStyle": {"en": "Numbers style", "de": "Numbers Style", "ru": "fontNumbersStyle"},
"fontTitleStyle": {"en": "Title style", "de": "Title Style", "ru": "fontTitleStyle"},
"fontUnitsStyle": {"en": "Units style", "de": "Units Style", "ru": "fontUnitsStyle"},
"fontValueStyle": {"en": "Value style", "de": "Value Style", "ru": "fontValueStyle"},
"fontNumbersWeight": {"en": "Numbers weight", "de": "Numbers Weight", "ru": "fontNumbersWeight"},
"fontTitleWeight": {"en": "Title weight", "de": "Title Weight", "ru": "fontTitleWeight"},
"fontUnitsWeight": {"en": "Units weight", "de": "Units Weight", "ru": "fontUnitsWeight"},
"fontValueWeight": {"en": "Value weight", "de": "Value Weight", "ru": "fontValueWeight"},
"group_gaugeBar": {"en": "Gauge bar", "de": "Gauge Bar", "ru": "group_gaugeBar"},
"barBeginCircle": {"en": "Begin circle", "de": "BeginCircle", "ru": "barBeginCircle"},
"barWidth": {"en": "Width", "de": "Width", "ru": "barWidth"},
"barLength": {"en": "Length", "de": "Length", "ru": "barLength"},
"barStrokeWidth": {"en": "Stroke width", "de": "StrokeWidth", "ru": "barStrokeWidth"},
"barProgress": {"en": "Progress", "de": "Progress", "ru": "barProgress"},
"group_colorsBar": {"en": "Bar colors", "de": "Bar-Farbe", "ru": "group_colorsBar"},
"colorBarStroke": {"en": "Bar stroke", "de": "BarStroke", "ru": "colorBarStroke"},
"colorBar": {"en": "Bar", "de": "Bar", "ru": "colorBar"},
"colorBarEnd": {"en": "BarEnd", "de": "BarEnd", "ru": "colorBarEnd"},
"colorBarProgress": {"en": "BarProgress", "de": "BarProgress", "ru": "colorBarProgress"},
"colorBarProgressEnd": {"en": "BarProgressEnd", "de": "BarProgressEnd", "ru": "colorBarProgressEnd"},
"group_positions": {"en": "Positions", "de": "Position", "ru": "group_positions"},
"tickSide": {"en": "Tick's side", "de": "tick Side", "ru": "tickSide"},
"needleSide": {"en": "Needle's side", "de": "needle Side", "ru": "needleSide"},
"numberSide": {"en": "Number's side", "de": "number Side", "ru": "numberSide"},
"group_ticksBar": {"en": "Bar ticks", "de": "Ticks Bar", "ru": "group_ticksBar"},
"ticksWidth": {"en": "Width", "de": "ticksWidth", "ru": "ticksWidth"},
"ticksWidthMinor": {"en": "Width minor", "de": "ticksWidthMinor", "ru": "ticksWidthMinor"},
"ticksPadding": {"en": "Padding", "de": "ticksPadding", "ru": "ticksPadding"},
"plate": {"en": "plate", "de": "plate", "ru": "plate"},
"animationTarget": {"en": "Animation target", "de": "Animationsziel", "ru": "animationTarget"},
"group_gaugeRadial": {"en": "Gauge radial", "de": "Radial", "ru": "group_gaugeRadial"},
"ticksAngle": {"en": "Ticks's angle", "de": "ticksAngle", "ru": "ticksAngle"},
"startAngle": {"en": "Start Angle", "de": "startAngle", "ru": "startAngle"},
"group_colorsRadial": {"en": "Colors for radial", "de": "Farbe (radiall)", "ru": "group_colorsRadial"},
"colorNeedleCircleOuter": {"en": "Needle circle outer", "de": "NeedleCircleOuter", "ru": "colorNeedleCircleOuter"},
"colorNeedleCircleOuterEnd": {"en": "Needle circle outer end", "de": "NeedleCircleOuterEnd", "ru": "colorNeedleCircleOuterEnd"},
"colorNeedleCircleInner": {"en": "Needle circle inner", "de": "NeedleCircleInner", "ru": "colorNeedleCircleInner"},
"colorNeedleCircleInnerEnd": {"en": "Needle circle inner end", "de": "NeedleCircleInnerEnd", "ru": "colorNeedleCircleInnerEnd"},
"group_needleRadial": {"en": "Needle for radial", "de": "Zeiger (radial)", "ru": "group_needleRadial"},
"needleCircleSize": {"en": "Circle size", "de": "Circle Size", "ru": "needleCircleSize"},
"needleCircleInner": {"en": "Circle inner", "de": "Circle Inner", "ru": "needleCircleInner"},
"needleCircleOuter": {"en": "Circle outer", "de": "Circle Outer", "ru": "needleCircleOuter"}
});
}
//jQuery.extend(true, vis.binds, {
vis.binds['canvas-gauges'] = {
version: "0.1.5",
showVersion: function () {
if (vis.binds['canvas-gauges'].version) {
console.log('Version vis-canvas-gauges: ' + vis.binds['canvas-gauges'].version);
vis.binds['canvas-gauges'].version = null;
}
},
gaugeDestroy: function (wid, $wid) {
if ($wid && $wid.length) {
var bound = $wid.data('bound');
if (bound) {
var bindHandler = $wid.data('bindHandler');
for (var b = 0; b < bound.length; b++) {
vis.states.unbind(bound[b], bindHandler);
}
}
var gauge = $wid.data('gauge');
if (gauge) {
gauge.destroy();
$wid.data('gauge', null);
}
}
},
gauge: function (view, data, type) {
var wid = data.attr('wid');
var $wid = $('#' + wid).css('overflow', 'visible');
if (!$wid.length) {
setTimeout(function () {
vis.binds['canvas-gauges'].gauge(view, data, type);
}, 100);
return;
}
if (!$wid.is(':visible')) {
setTimeout(function () {
vis.binds['canvas-gauges'].gauge(view, data, type);
}, 1000);
return;
}
$wid.css('overflow', 'visible');
var w = $wid.width();
var h = $wid.height();
var gauge = $wid.data('gauge');
var options = {
width: w,
height: h,
title: data.attr('title') || '',
minValue: parseFloat(data.attr('minValue')) || 0,
maxValue: parseFloat(data.attr('maxValue')),
units: data.attr('units') || '',
factor: parseFloat(data.attr('factor')) || 1,
offset: parseFloat(data.attr('valueOffset')) || 0,
minorTicks: parseInt(data.attr('minorTicks'), 10) || 1,
strokeTicks: data.attr('strokeTicks') === 'true' || data.attr('strokeTicks') === true,
majorTicksInt: parseInt(data.attr('majorTicksInt'), 10) || 4,
majorTicksDec: parseInt(data.attr('majorTicksDec'), 10) || 2,
animation: data.attr('animation') === 'true' || data.attr('animation') === true,
animationDuration: parseInt(data.attr('animationDuration')) || 500,
animationRule: data.attr('animationRule') || 'linear',
animatedValue: data.attr('animatedValue') === 'true' || data.attr('animatedValue') === true,
animateOnInit: data.attr('animateOnInit') === 'true' || data.attr('animateOnInit') === true
};
if (isNaN(options.maxValue)) options.maxValue = 100;
if (data.attr('colorPlate')) options.colorPlate = data.attr('colorPlate');
if (data.attr('colorPlateEnd')) options.colorPlateEnd = data.attr('colorPlateEnd');
if (data.attr('colorMajorTicks')) options.colorMajorTicks = data.attr('colorMajorTicks');
if (data.attr('colorMinorTicks')) options.colorMinorTicks = data.attr('colorMinorTicks');
if (data.attr('colorTitle')) options.colorTitle = data.attr('colorTitle');
if (data.attr('colorUnits')) options.colorUnits = data.attr('colorUnits');
if (data.attr('colorNumbers')) options.colorNumbers = data.attr('colorNumbers');
if (data.attr('colorNeedle')) options.colorNeedle = data.attr('colorNeedle');
if (data.attr('colorNeedleEnd')) options.colorNeedleEnd = data.attr('colorNeedleEnd');
if (data.attr('colorValueText')) options.colorValueText = data.attr('colorValueText');
if (data.attr('colorValueTextShadow')) options.colorValueTextShadow = data.attr('colorValueTextShadow');
if (data.attr('colorBorderShadow')) options.colorBorderShadow = data.attr('colorBorderShadow');
if (data.attr('colorBorderOuter')) options.colorBorderOuter = data.attr('colorBorderOuter');
if (data.attr('colorBorderOuterEnd')) options.colorBorderOuterEnd = data.attr('colorBorderOuterEnd');
if (data.attr('colorBorderMiddle')) options.colorBorderMiddle = data.attr('colorBorderMiddle');
if (data.attr('colorBorderMiddleEnd')) options.colorBorderMiddleEnd = data.attr('colorBorderMiddleEnd');
if (data.attr('colorBorderInner')) options.colorBorderInner = data.attr('colorBorderInner');
if (data.attr('colorBorderInnerEnd')) options.colorBorderInnerEnd = data.attr('colorBorderInnerEnd');
if (data.attr('colorValueBoxRect')) options.colorValueBoxRect = data.attr('colorValueBoxRect');
if (data.attr('colorValueBoxRectEnd')) options.colorValueBoxRectEnd = data.attr('colorValueBoxRectEnd');
if (data.attr('colorValueBoxBackground'))options.colorValueBoxBackground = data.attr('colorValueBoxBackground');
if (data.attr('colorValueBoxShadow')) options.colorValueBoxShadow = data.attr('colorValueBoxShadow');
if (data.attr('colorNeedleShadowUp')) options.colorNeedleShadowUp = data.attr('colorNeedleShadowUp');
if (data.attr('colorNeedleShadowDown')) options.colorNeedleShadowDown = data.attr('colorNeedleShadowDown');
if (data.attr('needle') !== undefined && data.attr('needle') !== '') options.needle = data.attr('needle') === 'true' || data.attr('needle') === true;
if (data.attr('needleShadow') !== undefined && data.attr('needleShadow') !== '') options.needleShadow = data.attr('needleShadow') === 'true' || data.attr('needleShadow') === true;
if (data.attr('needleType') !== undefined && data.attr('needleType') !== '') options.needleType = data.attr('needleType');
if (data.attr('needleStart') !== undefined && data.attr('needleStart') !== '') options.needleStart = parseFloat(data.attr('needleStart'));
if (data.attr('needleEnd') !== undefined && data.attr('needleEnd') !== '') options.needleEnd = parseFloat(data.attr('needleEnd'));
if (data.attr('needleWidth') !== undefined && data.attr('needleWidth') !== '') options.needleWidth = parseFloat(data.attr('needleWidth'));
if (data.attr('borders') !== undefined && data.attr('borders') !== '') options.borders = data.attr('borders') === 'true' || data.attr('borders') === true;
if (data.attr('borderOuterWidth') !== undefined && data.attr('borderOuterWidth') !== '') options.borderOuterWidth = parseFloat(data.attr('borderOuterWidth'));
if (data.attr('borderMiddleWidth') !== undefined && data.attr('borderMiddleWidth') !== '') options.borderMiddleWidth = parseFloat(data.attr('borderMiddleWidth'));
if (data.attr('borderInnerWidth') !== undefined && data.attr('borderInnerWidth') !== '') options.borderInnerWidth = parseFloat(data.attr('borderInnerWidth'));
if (data.attr('borderShadowWidth') !== undefined && data.attr('borderShadowWidth') !== '') options.borderShadowWidth = parseFloat(data.attr('borderShadowWidth'));
if (data.attr('valueBox') !== undefined && data.attr('valueBox') !== '') options.valueBox = data.attr('valueBox') === 'true' || data.attr('valueBox') === true;
if (data.attr('valueText') !== undefined && data.attr('valueText') !== '') options.valueText = data.attr('valueText');
if (data.attr('valueBoxStroke') !== undefined && data.attr('valueBoxStroke') !== '') options.valueBoxStroke = parseFloat(data.attr('valueBoxStroke'));
if (data.attr('valueTextShadow') !== undefined) options.valueTextShadow = data.attr('valueTextShadow');
if (data.attr('valueBoxBorderRadius') !== undefined && data.attr('valueBoxBorderRadius') !== '') options.valueBoxBorderRadius = parseFloat(data.attr('valueBoxBorderRadius'));
if (data.attr('valueInt') !== undefined && data.attr('valueInt') !== '') options.valueInt = parseInt(data.attr('valueInt'), 10);
if (data.attr('valueDec') !== undefined && data.attr('valueDec') !== '') options.valueDec = parseInt(data.attr('valueDec'), 10);
if (data.attr('fontNumbers') !== undefined && data.attr('fontNumbers') !== '') options.fontNumbers = data.attr('fontNumbers');
if (data.attr('fontTitle') !== undefined && data.attr('fontTitle') !== '') options.fontTitle = data.attr('fontTitle');
if (data.attr('fontUnits') !== undefined && data.attr('fontUnits') !== '') options.fontUnits = data.attr('fontUnits');
if (data.attr('fontValue') !== undefined && data.attr('fontValue') !== '') options.fontValue = data.attr('fontValue');
if (data.attr('fontNumbersSize') !== undefined && data.attr('fontNumbersSize') !== '') options.fontNumbersSize = parseInt(data.attr('fontNumbersSize'), 10);
if (data.attr('fontTitleSize') !== undefined && data.attr('fontTitleSize') !== '') options.fontTitleSize = parseInt(data.attr('fontTitleSize'), 10);
if (data.attr('fontUnitsSize') !== undefined && data.attr('fontUnitsSize') !== '') options.fontUnitsSize = parseInt(data.attr('fontUnitsSize'), 10);
if (data.attr('fontValueSize') !== undefined && data.attr('fontValueSize') !== '') options.fontValueSize = parseInt(data.attr('fontValueSize'), 10);
if (data.attr('fontNumbersStyle') !== undefined && data.attr('fontNumbersStyle') !== '') options.fontNumbersStyle = data.attr('fontNumbersStyle');
if (data.attr('fontTitleStyle') !== undefined && data.attr('fontTitleStyle') !== '') options.fontTitleStyle = data.attr('fontTitleStyle');
if (data.attr('fontUnitsStyle') !== undefined && data.attr('fontUnitsStyle') !== '') options.fontUnitsStyle = data.attr('fontUnitsStyle');
if (data.attr('fontValueStyle') !== undefined && data.attr('fontValueStyle') !== '') options.fontValueStyle = data.attr('fontValueStyle');
if (data.attr('fontNumbersWeight') !== undefined && data.attr('fontNumbersWeight') !== '') options.fontNumbersWeight = data.attr('fontNumbersWeight');
if (data.attr('fontTitleWeight') !== undefined && data.attr('fontTitleWeight') !== '') options.fontTitleWeight = data.attr('fontTitleWeight');
if (data.attr('fontUnitsWeight') !== undefined && data.attr('fontUnitsWeight') !== '') options.fontUnitsWeight = data.attr('fontUnitsWeight');
if (data.attr('fontValueWeight') !== undefined && data.attr('fontValueWeight') !== '') options.fontNumbers = data.attr('fontValueWeight');
var hCount = parseInt(data.attr('hCount'), 10) || 0;
if (hCount) {
options.highlights = [];
for (var u = 1; u <= hCount; u++) {
if (data.attr('highlightsFrom' + u) === undefined || data.attr('highlightsFrom' + u) === '') continue;
if (type === 'radial') {
options.highlights.push({
from: (parseFloat(data.attr('highlightsFrom' + u)) || 0),
to: parseFloat(data.attr('highlightsTo' + u)),
color: data.attr('highlightsColor' + u)
});
} else {
options.highlights.push({
from: (parseFloat(data.attr('highlightsFrom' + u)) || 0) - options.minValue,
to: parseFloat(data.attr('highlightsTo' + u)) - options.minValue,
color: data.attr('highlightsColor' + u)
});
}
}
} else {
options.highlights = false;
}
// convert majorTicks
var majorTicks = data.attr('majorTicks');
if (typeof majorTicks === 'string' && majorTicks.indexOf(',') !== -1) {
majorTicks = majorTicks.split(',');
for (var m = majorTicks.length - 1; m >= 0; m--) {
majorTicks[m] = majorTicks[m].trim();
}
} else {
majorTicks = parseFloat(majorTicks);
if (majorTicks) {
var start = options.minValue;
var step = (options.maxValue - options.minValue) / (majorTicks - 1);
majorTicks = [];
while(start <= options.maxValue) {
majorTicks.push(start);
start += step;
}
} else {
majorTicks = undefined;
}
}
if (!majorTicks) {
majorTicks = [];
var start = options.minValue;
var step = (options.maxValue - options.minValue) / 5;
while(start <= options.maxValue) {
majorTicks.push(start);
start += step;
}
}
options.majorTicks = majorTicks;
if (type === 'radial') {
vis.binds['canvas-gauges'].radialGauge(view, data, options, $wid);
} else {
vis.binds['canvas-gauges'].linearGauge(view, data, options, $wid);
}
if (gauge) {
gauge.update(options);
} else {
options.value = options.minValue || 0;
$wid.html('<canvas class="vis-canvas-gauges"></canvas>');
options.renderTo = $wid.find('.vis-canvas-gauges')[0];
if (type === 'radial') {
gauge = new RadialGauge(options);
} else {
gauge = new LinearGauge(options);
}
$wid.data('gauge', gauge);
gauge.draw();
if (vis.editMode && vis.activeWidgets.indexOf(wid) !== -1) {
$wid.resizable('destroy');
vis.resizable($wid);
}
}
var oid = data.attr('oid');
if ((oid || oid === 0) && oid !== 'nothing_selected') {
var val = vis.states.attr(oid + '.val');
if (val === undefined || val === null) {
val = parseFloat(val);
} else {
var updateGauge = function (e, newVal /* , oldVal*/) {
gauge.value = parseFloat(newVal) * gauge.options.factor + gauge.options.offset;
};
// remember all ids, that bound
$wid.data('bound', [oid + '.val']);
// remember bind handler
$wid.data('bindHandler', updateGauge);
vis.states.bind(oid + '.val', updateGauge);
}
gauge.value = val * gauge.options.factor + gauge.options.offset;
}
// register destroy handler
$wid.data('destroy', vis.binds['canvas-gauges'].gaugeDestroy);
},
linearGauge: function (view, data, options, $wid) {
options.borderRadius = parseFloat($wid.css('border-radius'));
if (data.attr('barBeginCircle') !== undefined && data.attr('barBeginCircle') !== '') options.barBeginCircle = parseFloat(data.attr('barBeginCircle'));
if (data.attr('barWidth') !== undefined && data.attr('barWidth') !== '') options.barWidth = parseFloat(data.attr('barWidth'));
if (data.attr('barLength') !== undefined && data.attr('barLength') !== '') options.barLength = parseFloat(data.attr('barLength'));
if (data.attr('barStrokeWidth') !== undefined && data.attr('barStrokeWidth') !== '') options.barStrokeWidth = parseFloat(data.attr('barStrokeWidth'));
if (data.attr('barProgress') !== undefined && data.attr('barProgress') !== '') options.barProgress = data.attr('barProgress') === 'true' || data.attr('barProgress') === true;
if (data.attr('colorBarStroke') !== undefined && data.attr('colorBarStroke') !== '') options.colorBarStroke = data.attr('colorBarStroke');
if (data.attr('colorBar') !== undefined && data.attr('colorBar') !== '') options.colorBar = data.attr('colorBar');
if (data.attr('colorBarEnd') !== undefined && data.attr('colorBarEnd') !== '') options.colorBarEnd = data.attr('colorBarEnd');
if (data.attr('colorBarProgress') !== undefined && data.attr('colorBarProgress') !== '') options.colorBarProgress = data.attr('colorBarProgress');
if (data.attr('colorBarProgressEnd') !== undefined && data.attr('colorBarProgressEnd') !== '') options.colorBarProgressEnd = data.attr('colorBarProgressEnd');
if (data.attr('tickSide') !== undefined && data.attr('tickSide') !== '') options.tickSide = data.attr('tickSide');
if (data.attr('needleSide') !== undefined && data.attr('needleSide') !== '') options.needleSide = data.attr('needleSide');
if (data.attr('numberSide') !== undefined && data.attr('numberSide') !== '') options.numberSide = data.attr('numberSide');
if (data.attr('ticksWidth') !== undefined && data.attr('ticksWidth') !== '') options.ticksWidth = parseFloat(data.attr('ticksWidth'));
if (data.attr('ticksWidthMinor') !== undefined && data.attr('ticksWidthMinor') !== '') options.ticksWidthMinor = parseFloat(data.attr('ticksWidthMinor'));
if (data.attr('ticksPadding') !== undefined && data.attr('ticksPadding') !== '') options.barBeginCircle = parseFloat(data.attr('ticksPadding'));
},
radialGauge: function (view, data, options, $wid) {
if (data.attr('ticksAngle') !== undefined && data.attr('ticksAngle') !== '') options.ticksAngle = parseFloat(data.attr('ticksAngle'));
if (data.attr('startAngle') !== undefined && data.attr('startAngle') !== '') options.startAngle = parseFloat(data.attr('startAngle'));
if (data.attr('colorNeedleCircleOuter') !== undefined && data.attr('colorNeedleCircleOuter') !== '') options.colorNeedleCircleOuter = data.attr('colorNeedleCircleOuter');
if (data.attr('colorNeedleCircleOuterEnd') !== undefined && data.attr('colorNeedleCircleOuterEnd') !== '') options.colorNeedleCircleOuterEnd = data.attr('colorNeedleCircleOuterEnd');
if (data.attr('colorNeedleCircleInner') !== undefined && data.attr('colorNeedleCircleInner') !== '') options.colorNeedleCircleInner = data.attr('colorNeedleCircleInner');
if (data.attr('colorNeedleCircleInnerEnd') !== undefined && data.attr('colorNeedleCircleInnerEnd') !== '') options.colorNeedleCircleInnerEnd = data.attr('colorNeedleCircleInnerEnd');
if (data.attr('needleCircleSize') !== undefined && data.attr('needleCircleSize') !== '') options.needleCircleSize = parseFloat(data.attr('needleCircleSize'));
if (data.attr('needleCircleInner') !== undefined && data.attr('needleCircleInner') !== '') options.needleCircleInner = data.attr('needleCircleInner') === 'true' || data.attr('needleCircleInner') === true;
if (data.attr('needleCircleOuter') !== undefined && data.attr('needleCircleOuter') !== '') options.needleCircleOuter = data.attr('needleCircleOuter') === 'true' || data.attr('needleCircleOuter') === true;
if (data.attr('animationTarget') !== undefined && data.attr('animationTarget') !== '') options.animationTarget = data.attr('animationTarget');
}
};
if (vis.editMode) {
vis.binds['canvas-gauges'].changedId = function (widgetID, view, newId/*, fields*/) {
var obj = vis.objects[newId];
var changed = [];
var wData = vis.views[view].widgets[widgetID].data;
var wwData = vis.widgets[widgetID].data;
if (obj && obj.common && obj.type === 'state') {
if (obj.common.min !== undefined && (wData.minValue === undefined || wData.minValue === '')) {
wData.minValue = obj.common.min;
wwData.minValue = obj.common.min;
changed.push('minValue');
}
if (obj.common.max !== undefined && (wData.maxValue === undefined || wData.maxValue === '')) {
wData.maxValue = obj.common.max;
wwData.maxValue = obj.common.max;
changed.push('maxValue');
}
if (obj.common.unit !== undefined && (wData.units === undefined || wData.units === '')) {
wData.units = obj.common.unit;
wwData.units = obj.common.unit;
changed.push('units');
}
if (obj.common.name && (wData.title === undefined || wData.title === '')) {
wData.title = obj.common.name;
wwData.title = obj.common.name;
changed.push('title');
}
}
return changed.length ? changed : null;
};
}
vis.binds['canvas-gauges'].showVersion();
</script>
<!--script id="tplCGlinearGauge"
type="text/ejs"
class="vis-tpl"
data-vis-type="temperature,number"
data-vis-set="canvas-gauges"
data-vis-name="Linear"
data-vis-update-style="true"
data-vis-prev='<img src="widgets/canvas-gauges/img/prev/Prev_cgLinear.png"></img>'
data-vis-attrs="oid/id/changedId;minValue;maxValue;units;title;factor[1];valueOffset[0];hCount[1]/slider,0,20,1;"
data-vis-attrs0="group.highlights/byindex;highlightsFrom(1-hCount);highlightsTo(1-hCount);highlightsColor(1-hCount)/color;"
data-vis-attrs1="group.ticks;majorTicks/slider,0,20,1;minorTicks/slider,0,20,1;strokeTicks/checkbox;majorTicksInt/slider,0,10,1;majorTicksDec/slider,0,10,1;"
data-vis-attrs2="group.animation;animation[true]/checkbox;animationDuration/slider,0,2000,50;animationRule/select,linear,quad,quint,cycle,bounce,elastic,dequad,dequint,decycle,debounce,delastic;animatedValue/checkbox;animateOnInit/checkbox;"
data-vis-attrs3="group.colorsGauge;colorPlate/color;colorPlateEnd/color;colorMajorTicks/color;colorMinorTicks/color;colorTitle/color;colorUnits/color;colorNumbers/color;colorNeedle/color;colorNeedleEnd/color;colorValueText/color;colorValueTextShadow/color;colorBorderShadow/color;colorBorderOuter/color;colorBorderOuterEnd/color;colorBorderMiddle/color;colorBorderMiddleEnd/color;colorBorderInner/color;colorBorderInnerEnd/color;colorValueBoxRect/color;colorValueBoxRectEnd/color;colorValueBoxBackground/color;colorValueBoxShadow/color;colorNeedleShadowUp/color;colorNeedleShadowDown/color;"
data-vis-attrs4="group.needle;needle/checkbox;needleShadow/checkbox;needleType/select,arrow,line;needleStart/slider,0,20,1;needleEnd/slider,0,20,1;needleWidth/slider,0,20,1;"
data-vis-attrs5="group.borders;borders[true]/checkbox;borderOuterWidth/slider,0,20,1;borderMiddleWidth/slider,0,20,1;borderInnerWidth/slider,0,20,1;borderShadowWidth/slider,0,20,1;;"
data-vis-attrs6="group.valueBox;valueBox[false]/checkbox;valueBoxStroke/slider,0,20,1;valueText;valueTextShadow/checkbox;valueBoxBorderRadius/slider,0,20,1;valueInt/slider,0,20,1;valueDec/slider,0,20,1;"
data-vis-attrs7="group.fonts;fontNumbers/fontname;fontTitle/fontname;fontUnits/fontname;fontValue/fontname;"
data-vis-attrs8="fontNumbersSize/slider,0,100,1;fontTitleSize/slider,0,100,1;fontUnitsSize/slider,0,100,1;fontValueSize/slider,0,100,1;"
data-vis-attrs9="fontNumbersStyle/nselect,normal,italic,oblique;fontTitleStyle/nselect,normal,italic,oblique;fontUnitsStyle/nselect,normal,italic,oblique;fontValueStyle/nselect,normal,italic,oblique;"
data-vis-attrs10="fontNumbersWeight/auto,normal,bold,bolder,lighter;fontTitleWeight/auto,normal,bold,bolder,lighter;fontUnitsWeight/auto,normal,bold,bolder,lighter;fontValueWeight/auto,normal,bold,bolder,lighter;"
>
<div class="vis-widget <%== this.data.attr('class') %>" style="overflow: visible; width: 150px; height: 250px; border-radius: 10px" id="<%= this.data.attr('wid') %>"></div>
<% vis.binds['canvas-gauges'].gauge(this.view, this.data, 'linear'); %>
</script-->
<script id="tplCGlinearGauge"
type="text/ejs"
class="vis-tpl"
data-vis-type="temperature,number"
data-vis-set="canvas-gauges"
data-vis-name="Linear"
data-vis-update-style="true"
data-vis-prev='<img src="widgets/canvas-gauges/img/prev/Prev_cgLinear.png"></img>'
data-vis-attrs="oid/id/changedId;minValue;maxValue;units;title;factor[1];valueOffset[0];hCount[1]/slider,0,20,1;"
data-vis-attrs0="group.highlights/byindex;highlightsFrom(1-hCount);highlightsTo(1-hCount);highlightsColor(1-hCount)/color;"
data-vis-attrs1="group.ticks;majorTicks/slider,0,20,1;minorTicks[5]/slider,0,20,1;strokeTicks/checkbox;majorTicksInt/slider,0,10,1;majorTicksDec/slider,0,10,1;"
data-vis-attrs2="group.animation;animation[true]/checkbox;animationDuration/slider,0,2000,50;animationRule/select,linear,quad,quint,cycle,bounce,elastic,dequad,dequint,decycle,debounce,delastic;animatedValue/checkbox;animateOnInit/checkbox;"
data-vis-attrs3="group.colorsGauge;colorPlate/color;colorPlateEnd/color;colorMajorTicks/color;colorMinorTicks/color;colorTitle/color;colorUnits/color;colorNumbers/color;colorNeedle/color;colorNeedleEnd/color;colorValueText/color;colorValueTextShadow/color;colorBorderShadow/color;colorBorderOuter/color;colorBorderOuterEnd/color;colorBorderMiddle/color;colorBorderMiddleEnd/color;colorBorderInner/color;colorBorderInnerEnd/color;colorValueBoxRect/color;colorValueBoxRectEnd/color;colorValueBoxBackground/color;colorValueBoxShadow/color;colorNeedleShadowUp/color;colorNeedleShadowDown/color;"
data-vis-attrs4="group.needle;needle/checkbox;needleShadow/checkbox;needleType/select,arrow,line;needleStart/slider,0,100,1;needleEnd/slider,0,100,1;needleWidth/slider,0,50,1;"
data-vis-attrs5="group.borders;borders[true]/checkbox;borderOuterWidth/slider,0,20,1;borderMiddleWidth/slider,0,20,1;borderInnerWidth/slider,0,20,1;borderShadowWidth/slider,0,20,1;"
data-vis-attrs6="group.valueBox;valueBox[false]/checkbox;valueBoxStroke/slider,0,20,1;valueText;valueTextShadow/checkbox;valueBoxBorderRadius/slider,0,20,1;valueInt/slider,0,20,1;valueDec/slider,0,20,1;"
data-vis-attrs7="group.fonts;fontNumbers/fontname;fontTitle/fontname;fontUnits/fontname;fontValue/fontname;"
data-vis-attrs8="fontNumbersSize/slider,0,100,1;fontTitleSize/slider,0,100,1;fontUnitsSize/slider,0,100,1;fontValueSize/slider,0,100,1;"
data-vis-attrs9="fontNumbersStyle/nselect,normal,italic,oblique;fontTitleStyle/nselect,normal,italic,oblique;fontUnitsStyle/nselect,normal,italic,oblique;fontValueStyle/nselect,normal,italic,oblique;"
data-vis-attrs10="fontNumbersWeight/auto,normal,bold,bolder,lighter;fontTitleWeight/auto,normal,bold,bolder,lighter;fontUnitsWeight/auto,normal,bold,bolder,lighter;fontValueWeight/auto,normal,bold,bolder,lighter;"
data-vis-attrs11="group.gaugeBar;barBeginCircle/slider,0,360,1;barWidth/slider,0,50,1;barLength/slider,0,100,1;barStrokeWidth/slider,0,50,0;barProgress[true]/checkbox;"
data-vis-attrs12="group.colorsBar;colorBarStroke/color;colorBar/color;colorBarEnd/color;colorBarProgress/color;colorBarProgressEnd/color;"
data-vis-attrs13="group.positions;tickSide/select,both,left,right;needleSide/select,both,left,right;numberSide/select,both,left,right;"
data-vis-attrs14="group.ticksBar;ticksWidth/slider,0,50,1;ticksWidthMinor/slider,0,50,1;ticksPadding/slider,0,50,1;"
>
<div class="vis-widget <%== this.data.attr('class') %>" style="overflow: visible; width: 150px; height: 250px; border-radius: 10px" id="<%= this.data.attr('wid') %>"></div>
<% vis.binds['canvas-gauges'].gauge(this.view, this.data, 'linear'); %>
</script>
<script id="tplCGradialGauge"
type="text/ejs"
class="vis-tpl"
data-vis-type="number"
data-vis-set="canvas-gauges"
data-vis-name="Radial"
data-vis-update-style="true"
data-vis-prev='<img src="widgets/canvas-gauges/img/prev/Prev_cgRadial.png"></img>'
data-vis-attrs="oid/id/changedId;minValue;maxValue;units;title;factor[1];valueOffset[0];hCount[1]/slider,0,20,1;"
data-vis-attrs0="group.highlights/byindex;highlightsFrom(1-hCount);highlightsTo(1-hCount);highlightsColor(1-hCount)/color;"
data-vis-attrs1="group.ticks;majorTicks/slider,0,20,1;minorTicks[4]/slider,0,20,1;strokeTicks/checkbox;majorTicksInt/slider,0,10,1;majorTicksDec/slider,0,10,1;"
data-vis-attrs2="group.animation;animation[true]/checkbox;animationDuration/slider,0,2000,50;animationRule/select,linear,quad,quint,cycle,bounce,elastic,dequad,dequint,decycle,debounce,delastic;animatedValue/checkbox;animateOnInit/checkbox;animationTarget/select,needle,plate;"
data-vis-attrs3="group.colorsGauge;colorPlate/color;colorPlateEnd/color;colorMajorTicks/color;colorMinorTicks/color;colorTitle/color;colorUnits/color;colorNumbers/color;colorNeedle/color;colorNeedleEnd/color;colorValueText/color;colorValueTextShadow/color;colorBorderShadow/color;colorBorderOuter/color;colorBorderOuterEnd/color;colorBorderMiddle/color;colorBorderMiddleEnd/color;colorBorderInner/color;colorBorderInnerEnd/color;colorValueBoxRect/color;colorValueBoxRectEnd/color;colorValueBoxBackground/color;colorValueBoxShadow/color;colorNeedleShadowUp/color;colorNeedleShadowDown/color;"
data-vis-attrs4="group.needle;needle[true]/checkbox;needleShadow[true]/checkbox;needleType[select]/select,arrow,line;needleStart/slider,0,100,1;needleEnd/slider,0,100,1;needleWidth/slider,0,50,1;"
data-vis-attrs5="group.borders;borders[true]/checkbox;borderOuterWidth[2]/slider,0,20,1;borderMiddleWidth[2]/slider,0,20,1;borderInnerWidth[2]/slider,0,20,1;borderShadowWidth[2]/slider,0,20,1;"
data-vis-attrs6="group.valueBox;valueBox[false]/checkbox;valueBoxStroke/slider,0,20,1;valueText;valueTextShadow/checkbox;valueBoxBorderRadius/slider,0,20,1;valueInt/slider,0,20,1;valueDec/slider,0,20,1;"
data-vis-attrs7="group.fonts;fontNumbers/fontname;fontTitle/fontname;fontUnits/fontname;fontValue/fontname;"
data-vis-attrs8="fontNumbersSize/slider,0,100,1;fontTitleSize/slider,0,100,1;fontUnitsSize/slider,0,100,1;fontValueSize/slider,0,100,1;"
data-vis-attrs9="fontNumbersStyle/nselect,normal,italic,oblique;fontTitleStyle/nselect,normal,italic,oblique;fontUnitsStyle/nselect,normal,italic,oblique;fontValueStyle/nselect,normal,italic,oblique;"
data-vis-attrs10="fontNumbersWeight/auto,normal,bold,bolder,lighter;fontTitleWeight/auto,normal,bold,bolder,lighter;fontUnitsWeight/auto,normal,bold,bolder,lighter;fontValueWeight/auto,normal,bold,bolder,lighter;"
data-vis-attrs11="group.gaugeRadial;ticksAngle[270]/slider,0,360,1;startAngle[45]/slider,0,360,1;"
data-vis-attrs12="group.colorsRadial;colorNeedleCircleOuter/color;colorNeedleCircleOuterEnd/color;colorNeedleCircleInner/color;colorNeedleCircleInnerEnd/color;"
data-vis-attrs13="group.needleRadial;needleCircleSize/slider,0,200,1;needleCircleInner/checkbox;needleCircleInner/checkbox;needleCircleOuter/checkbox;"
>
<div class="vis-widget <%== this.data.attr('class') %>" style="overflow: visible; width: 200px; height: 200px;" id="<%= this.data.attr('wid') %>"></div>
<% vis.binds['canvas-gauges'].gauge(this.view, this.data, 'radial'); %>
</script>
<script id="tplCGCompas"
type="text/ejs"
class="vis-tpl"
data-vis-type="number"
data-vis-set="canvas-gauges"
data-vis-name="Compas"
data-vis-update-style="true"
data-vis-prev='<img src="widgets/canvas-gauges/img/prev/Prev_cgCompas.png"></img>'
data-vis-attrs="oid/id/changedId;minValue[0];maxValue[360];units;title;factor[1];valueOffset[0];hCount[1]/slider,0,20,1;"
data-vis-attrs0="group.highlights/byindex;highlightsFrom(1-hCount);highlightsTo(1-hCount);highlightsColor(1-hCount)/color;"
data-vis-attrs1="group.ticks;majorTicks[N,NE,E,SE,S,SW,W,NW,N];minorTicks[22]/slider,0,20,1;strokeTicks[false]/checkbox;majorTicksInt/slider,0,10,1;majorTicksDec/slider,0,10,1;"
data-vis-attrs2="group.animation;animation[true]/checkbox;animationDuration[1000]/slider,0,2000,50;animationRule/select,linear,quad,quint,cycle,bounce,elastic,dequad,dequint,decycle,debounce,delastic;animatedValue/checkbox;animateOnInit/checkbox;animationTarget/select,needle,plate;"
data-vis-attrs3="group.colorsGauge;colorPlate[#222]/color;colorPlateEnd/color;colorMajorTicks[#f5f5f5]/color;colorMinorTicks[#ddd]/color;colorTitle/color;colorUnits/color;colorNumbers[#ccc]/color;colorNeedle[rgba(240,128,128,1)]/color;colorNeedleEnd[rgba(255,160,122,.9)]/color;colorValueText/color;colorValueTextShadow/color;colorBorderShadow/color;colorBorderOuter[#ccc]/color;colorBorderOuterEnd[#ccc]/color;colorBorderMiddle/color;colorBorderMiddleEnd/color;colorBorderInner/color;colorBorderInnerEnd/color;colorValueBoxRect/color;colorValueBoxRectEnd/color;colorValueBoxBackground/color;colorValueBoxShadow/color;colorNeedleShadowUp/color;colorNeedleShadowDown[#222]/color;"
data-vis-attrs4="group.needle;needle/checkbox;needleShadow/checkbox;needleType[line]/select,arrow,line;needleStart[75]/slider,0,100,1;needleEnd[99]/slider,0,100,1;needleWidth[3]/slider,0,50,1;"
data-vis-attrs5="group.borders;borders[true]/checkbox;borderOuterWidth[10]/slider,0,20,1;borderMiddleWidth[0]/slider,0,20,1;borderInnerWidth[0]/slider,0,20,1;borderShadowWidth[0]/slider,0,20,1;"
data-vis-attrs6="group.valueBox;valueBox[false]/checkbox;valueBoxStroke/slider,0,20,1;valueText;valueTextShadow[false]/checkbox;valueBoxBorderRadius/slider,0,20,1;valueInt/slider,0,20,1;valueDec/slider,0,20,1;"
data-vis-attrs7="group.fonts;fontNumbers/fontname;fontTitle/fontname;fontUnits/fontname;fontValue/fontname;"
data-vis-attrs8="fontNumbersSize/slider,0,100,1;fontTitleSize/slider,0,100,1;fontUnitsSize/slider,0,100,1;fontValueSize/slider,0,100,1;"
data-vis-attrs9="fontNumbersStyle/nselect,normal,italic,oblique;fontTitleStyle/nselect,normal,italic,oblique;fontUnitsStyle/nselect,normal,italic,oblique;fontValueStyle/nselect,normal,italic,oblique;"
data-vis-attrs10="fontNumbersWeight/auto,normal,bold,bolder,lighter;fontTitleWeight/auto,normal,bold,bolder,lighter;fontUnitsWeight/auto,normal,bold,bolder,lighter;fontValueWeight/auto,normal,bold,bolder,lighter;"
data-vis-attrs11="group.gaugeRadial;ticksAngle[360]/slider,0,360,1;startAngle[180]/slider,0,360,1;"
data-vis-attrs12="group.colorsRadial;colorNeedleCircleOuter[#ccc]/color;colorNeedleCircleOuterEnd/color;colorNeedleCircleInner/color;colorNeedleCircleInnerEnd/color;"
data-vis-attrs13="group.needleRadial;needleCircleSize[15]/slider,0,200,1;needleCircleInner/checkbox;needleCircleInner/checkbox;needleCircleOuter[false]/checkbox;"
>
<div class="vis-widget <%== this.data.attr('class') %>" style="overflow: visible; width: 200px; height: 200px;" id="<%= this.data.attr('wid') %>"></div>
<% vis.binds['canvas-gauges'].gauge(this.view, this.data, 'radial'); %>
</script>
<script id="tplCGflatGauge"
type="text/ejs"
class="vis-tpl"
data-vis-type="temperature,number"
data-vis-set="canvas-gauges"
data-vis-name="Flat"
data-vis-update-style="true"
data-vis-prev='<img src="widgets/canvas-gauges/img/prev/Prev_cgFlat.png"></img>'
data-vis-attrs="oid/id/changedId;minValue;maxValue;units;title;factor[1];valueOffset[0];hCount[1]/slider,0,20,1;"
data-vis-attrs0="group.highlights/byindex;highlightsFrom(1-hCount);highlightsTo(1-hCount);highlightsColor(1-hCount)/color;"
data-vis-attrs1="group.ticks;majorTicks/slider,0,20,1;minorTicks[10]/slider,0,20,1;strokeTicks[true]/checkbox;majorTicksInt/slider,0,10,1;majorTicksDec/slider,0,10,1;"
data-vis-attrs2="group.animation;animation[true]/checkbox;animationDuration/slider,0,2000,50;animationRule/select,linear,quad,quint,cycle,bounce,elastic,dequad,dequint,decycle,debounce,delastic;animatedValue/checkbox;animateOnInit/checkbox;"
data-vis-attrs3="group.colorsGauge;colorPlate[#fff]/color;colorPlateEnd/color;colorMajorTicks/color;colorMinorTicks/color;colorTitle/color;colorUnits/color;colorNumbers/color;colorNeedle[red]/color;colorNeedleEnd[rgba(255,0,0,0.7)]/color;colorValueText/color;colorValueTextShadow/color;colorBorderShadow/color;colorBorderOuter/color;colorBorderOuterEnd/color;colorBorderMiddle/color;colorBorderMiddleEnd/color;colorBorderInner/color;colorBorderInnerEnd/color;colorValueBoxRect/color;colorValueBoxRectEnd/color;colorValueBoxBackground/color;colorValueBoxShadow/color;colorNeedleShadowUp/color;colorNeedleShadowDown/color;"
data-vis-attrs4="group.needle;needle/checkbox;needleShadow/checkbox;needleType[line]/select,arrow,line;needleStart/slider,0,100,1;needleEnd/slider,0,100,1;needleWidth[3]/slider,0,50,1;"
data-vis-attrs5="group.borders;borders[false]/checkbox;borderOuterWidth[0]/slider,0,20,1;borderMiddleWidth[0]/slider,0,20,1;borderInnerWidth[0]/slider,0,20,1;borderShadowWidth[0]/slider,0,20,1;;"
data-vis-attrs6="group.valueBox;valueBox[false]/checkbox;valueBoxStroke/slider,0,20,1;valueText;valueTextShadow/checkbox;valueBoxBorderRadius/slider,0,20,1;valueInt/slider,0,20,1;valueDec/slider,0,20,1;"
data-vis-attrs7="group.fonts;fontNumbers/fontname;fontTitle/fontname;fontUnits/fontname;fontValue/fontname;"
data-vis-attrs8="fontNumbersSize/slider,0,100,1;fontTitleSize/slider,0,100,1;fontUnitsSize/slider,0,100,1;fontValueSize/slider,0,100,1;"
data-vis-attrs9="fontNumbersStyle/nselect,normal,italic,oblique;fontTitleStyle/nselect,normal,italic,oblique;fontUnitsStyle/nselect,normal,italic,oblique;fontValueStyle/nselect,normal,italic,oblique;"
data-vis-attrs10="fontNumbersWeight/auto,normal,bold,bolder,lighter;fontTitleWeight/auto,normal,bold,bolder,lighter;fontUnitsWeight/auto,normal,bold,bolder,lighter;fontValueWeight/auto,normal,bold,bolder,lighter;"
data-vis-attrs11="group.gaugeBar;barBeginCircle[0]/slider,0,360,1;barWidth[5]/slider,0,50,1;barLength/slider,0,100,1;barStrokeWidth/slider,0,50,0;barProgress[true]/checkbox;"
data-vis-attrs12="group.colorsBar;colorBarStroke/color;colorBar/color;colorBarEnd/color;colorBarProgress[#db9994]/color;colorBarProgressEnd/color;"
data-vis-attrs13="group.positions;tickSide[left]/select,both,left,right;needleSide[left]/select,both,left,right;numberSide[left]/select,both,left,right;"
data-vis-attrs14="group.ticksBar;ticksWidth[50]/slider,0,50,1;ticksWidthMinor[15]/slider,0,50,1;ticksPadding/slider,0,50,1;"
>
<div class="vis-widget <%== this.data.attr('class') %>" style="overflow: visible; width: 360px; height: 100px;" id="<%= this.data.attr('wid') %>"></div>
<% vis.binds['canvas-gauges'].gauge(this.view, this.data, 'linear'); %>
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

28
widgets/canvas-gauges/js/gauge.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long