From 1c85a515b41d8f5fa10cb33d0d228ee81a6aee3d Mon Sep 17 00:00:00 2001 From: mujiannan Date: Sat, 5 Sep 2020 17:23:23 +0800 Subject: [PATCH] pbiviz new --- .gitignore | 108 +++++ assets/icon.png | Bin 0 -> 1541 bytes capabilities.json | 84 ++++ package-lock.json | 1102 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 24 + pbiviz.json | 1 + src/settings.ts | 48 ++ src/visual.ts | 81 ++++ style/visual.less | 9 + tsconfig.json | 19 + tslint.json | 9 + 11 files changed, 1485 insertions(+) create mode 100644 .gitignore create mode 100644 assets/icon.png create mode 100644 capabilities.json create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 pbiviz.json create mode 100644 src/settings.ts create mode 100644 src/visual.ts create mode 100644 style/visual.less create mode 100644 tsconfig.json create mode 100644 tslint.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..780e6fc --- /dev/null +++ b/.gitignore @@ -0,0 +1,108 @@ +.vscode/ +node_modules/ +dist/ +webpack.statistics.* +# tmp +.tmp/ + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# gatsby files +.cache/ +public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1c2db1c9fd5f1b26bd9beb4f638d389f153cf20a GIT binary patch literal 1541 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2v2c=9J8kh>{3jAFJg2T)jk)8oi3#0-$aN1{?c|g2d$P)DnfH z)bz|eTc!8A_bVx6rr0WloBA5~7C5J7WO`H;r3P2|g(O#HCtIc{+1n}DR9FEG$W1Lt zRH(?!$t$+1uvG$^YXxM3g!Ppaz)DK8ZIvL7itr6kaLzAERWQ{v&`mZlGf*%y)H5_T zF*i5YQ7|$vG|)FN(l<2HH8i&}HnK7>P=Ep@plwAdX;wilZcw{`JX@uVl9B=|ef{$C za=mh6z5JqdeM3u2OOP2xM!G;1y2X`wC5aWfdBw^w6I@b@lZ!G7N;32F6hI~>Cgqow z*eU^C3h_d2fv+#z;JjjJKmmhHzap_f-%!s$KQ|ZTFR<$3lAu(CGq9>I4yi0i)elN7 z&Mz%W2F6F4GE6ft?C@IzQV4X7m48ttFj5k8T=J7kb5rw5JY8&+fHHb1nJHF|7EW%) zmWJlejxNTo28M=?=7!Ert`dbTx3aFm!P; zGcz_ca&|Fvb}@$O^~@_SNz6-5h1r`4v=^$^1g~Bz=c3falKi5O{QMkP3JA!^FUc>? z$S+WE4mMQ?&&*57FE0i~4#cl6sYRJ(sVQzn`MC<<(6!3MV!Nf0rKO9hsfB@?iwSmL zL-eMQ6Jq*6$LNES22xUi2?5g|hzU>lKn^_Xq~-zhOA#<*On6~h%fP^7?&;zfQgLg| z6mO5vK#?}v?OPVP7LKw*Ck%W7^gNa}yFOq)Gs1a?S9J9` ztn7cF|AReUz_a=8p7?g_cYMBIWEV>59aM=?-g$3x9Xp5Rs?(Qu*;FkgqcX1 zu-t*fjMnH4;#Lo3az0Pl(^fXC>gkW40)d-d+FRI7mJ0FS7Gh20o0bzS`1{T6h2CFQ z#NCcfs$U?}_^4FdqH2cg6SZb*zmNcb5uPt(Crc0;T13MZg{ad?UahF zx=ctRvq&cMKPSbS_Vx*k`xnk!c|TTt#patDw~rh)T9V-@cIBzL_4WztJ~r57F8aPF zcwMV@g5Bno@21ZX4LQjDgVTCS{^ei%o(0WqS$msYy)>GI4VL`Bt!w1Ne(hq5*^|lB z4hH%f-ErA+RM&z-{Onhe_Rjv2J(ISulubI5pLp~6V(${q%J93}Hg4XLGxvk)@1%7t z#~!r5uDBI)_=(8tUsh@dUl^^q{nW*2{= 2.1.2 < 3" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz", + "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npm.taobao.org/is-number/download/is-number-7.0.0.tgz", + "integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/js-tokens/download/js-tokens-4.0.0.tgz", + "integrity": "sha1-GSA/tZmR35jjoocFDUZHzerzJJk=", + "dev": true + }, + "js-yaml": { + "version": "3.14.0", + "resolved": "https://registry.npm.taobao.org/js-yaml/download/js-yaml-3.14.0.tgz", + "integrity": "sha1-p6NBcPJqIbsWJCTYray0ETpp5II=", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npm.taobao.org/json5/download/json5-1.0.1.tgz", + "integrity": "sha1-d5+wAYYE+oVOrL9iUhgNg1Q+Pb4=", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-1.4.0.tgz", + "integrity": "sha1-xXm140yzSxp07cbB+za/o3HVphM=", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "memory-fs": { + "version": "0.5.0", + "resolved": "https://registry.npm.taobao.org/memory-fs/download/memory-fs-0.5.0.tgz", + "integrity": "sha1-MkwBKIuIZSlm0WHbd4OHIIRajjw=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npm.taobao.org/micromatch/download/micromatch-4.0.2.tgz", + "integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npm.taobao.org/minimist/download/minimist-1.2.5.tgz", + "integrity": "sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=", + "dev": true + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npm.taobao.org/mkdirp/download/mkdirp-0.5.5.tgz", + "integrity": "sha1-2Rzv1i0UNsoPQWIOJRKI1CAJne8=", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npm.taobao.org/path-parse/download/path-parse-1.0.6.tgz", + "integrity": "sha1-1i27VnlAXXLEc37FhgDp3c8G0kw=", + "dev": true + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npm.taobao.org/picomatch/download/picomatch-2.2.2.tgz", + "integrity": "sha1-IfMz6ba46v8CRo9RRupAbTRfTa0=", + "dev": true + }, + "powerbi-visuals-api": { + "version": "2.6.2", + "resolved": "https://registry.npm.taobao.org/powerbi-visuals-api/download/powerbi-visuals-api-2.6.2.tgz", + "integrity": "sha1-DXK92mShDXOyFts/Zp+KLjqvu80=", + "requires": { + "semver": "^7.1.2" + } + }, + "powerbi-visuals-utils-dataviewutils": { + "version": "2.2.1", + "resolved": "https://registry.npm.taobao.org/powerbi-visuals-utils-dataviewutils/download/powerbi-visuals-utils-dataviewutils-2.2.1.tgz", + "integrity": "sha1-UmVtZXuLGt+3jaH7YvT6MRxYAwM=" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npm.taobao.org/process-nextick-args/download/process-nextick-args-2.0.1.tgz", + "integrity": "sha1-eCDZsWEgzFXKmud5JoCufbptf+I=", + "dev": true + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npm.taobao.org/prr/download/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.7.tgz", + "integrity": "sha1-Hsoc9xGu+BTAT2IlKjamL2yyO1c=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "regenerator-runtime": { + "version": "0.13.7", + "resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.13.7.tgz?cache=0&sync_timestamp=1595456105304&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.13.7.tgz", + "integrity": "sha1-ysLazIoepnX+qrrriugziYrkb1U=" + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.17.0.tgz", + "integrity": "sha1-sllBtUloIxzC0bt2p5y38sC/hEQ=", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "rw": { + "version": "1.3.3", + "resolved": "https://registry.npm.taobao.org/rw/download/rw-1.3.3.tgz", + "integrity": "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npm.taobao.org/safer-buffer/download/safer-buffer-2.1.2.tgz", + "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=" + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.2.tgz", + "integrity": "sha1-YElisFK4HtB4aq6EOJ/7pw/9OTg=" + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npm.taobao.org/sprintf-js/download/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.1.1.tgz", + "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz?cache=0&sync_timestamp=1598611771865&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz", + "integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "tapable": { + "version": "1.1.3", + "resolved": "https://registry.npm.taobao.org/tapable/download/tapable-1.1.3.tgz", + "integrity": "sha1-ofzMBrWNth/XpF2i2kT186Pme6I=", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npm.taobao.org/to-regex-range/download/to-regex-range-5.0.1.tgz", + "integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ=", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-loader": { + "version": "6.1.0", + "resolved": "https://registry.npm.taobao.org/ts-loader/download/ts-loader-6.1.0.tgz?cache=0&sync_timestamp=1598257188541&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fts-loader%2Fdownload%2Fts-loader-6.1.0.tgz", + "integrity": "sha1-mZywp2RPnHxsCQGALc5QzrCnbls=", + "dev": true, + "requires": { + "chalk": "^2.3.0", + "enhanced-resolve": "^4.0.0", + "loader-utils": "^1.0.2", + "micromatch": "^4.0.0", + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npm.taobao.org/tslib/download/tslib-1.13.0.tgz?cache=0&sync_timestamp=1596752024863&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftslib%2Fdownload%2Ftslib-1.13.0.tgz", + "integrity": "sha1-yIHhPMcBWJTtkUhi0nZDb6mkcEM=", + "dev": true + }, + "tslint": { + "version": "5.20.1", + "resolved": "https://registry.npm.taobao.org/tslint/download/tslint-5.20.1.tgz", + "integrity": "sha1-5AHortoBUrxE3QfmFANPP4DGe30=", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz", + "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "dev": true + } + } + }, + "tslint-microsoft-contrib": { + "version": "6.2.0", + "resolved": "https://registry.npm.taobao.org/tslint-microsoft-contrib/download/tslint-microsoft-contrib-6.2.0.tgz", + "integrity": "sha1-iqD0BYTQZtBeal55iNpRY7hfKtQ=", + "dev": true, + "requires": { + "tsutils": "^2.27.2 <2.29.0" + }, + "dependencies": { + "tsutils": { + "version": "2.28.0", + "resolved": "https://registry.npm.taobao.org/tsutils/download/tsutils-2.28.0.tgz", + "integrity": "sha1-a9ceFggo+dAZtvToRHQiKPhRaaE=", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npm.taobao.org/tsutils/download/tsutils-2.29.0.tgz", + "integrity": "sha1-MrSIUBRnrL7dS4VJhnOggSrKC5k=", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "typescript": { + "version": "3.6.3", + "resolved": "https://registry.npm.taobao.org/typescript/download/typescript-3.6.3.tgz?cache=0&sync_timestamp=1599288923492&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftypescript%2Fdownload%2Ftypescript-3.6.3.tgz", + "integrity": "sha1-/qlC+rsg9+HKcWT/Ym8anz9wtNo=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..cab1605 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "visual", + "scripts": { + "pbiviz": "pbiviz", + "start": "pbiviz start", + "package": "pbiviz package", + "lint": "tslint -c tslint.json -p tsconfig.json" + }, + "dependencies": { + "@babel/runtime": "7.6.0", + "@babel/runtime-corejs2": "7.6.0", + "@types/d3": "5.7.2", + "d3": "5.12.0", + "powerbi-visuals-utils-dataviewutils": "2.2.1", + "powerbi-visuals-api": "~2.6.1", + "core-js": "3.2.1" + }, + "devDependencies": { + "ts-loader": "6.1.0", + "tslint": "^5.18.0", + "tslint-microsoft-contrib": "^6.2.0", + "typescript": "3.6.3" + } +} diff --git a/pbiviz.json b/pbiviz.json new file mode 100644 index 0000000..578e268 --- /dev/null +++ b/pbiviz.json @@ -0,0 +1 @@ +{"visual":{"name":"picsScroller","displayName":"picsScroller","guid":"picsScroller4F6E5B21FAB94F2081F33542CFAD9E09","visualClassName":"Visual","version":"1.0.0","description":"","supportUrl":"","gitHubUrl":""},"apiVersion":"2.6.0","author":{"name":"","email":""},"assets":{"icon":"assets/icon.png"},"externalJS":null,"style":"style/visual.less","capabilities":"capabilities.json","dependencies":null,"stringResources":[]} diff --git a/src/settings.ts b/src/settings.ts new file mode 100644 index 0000000..002889b --- /dev/null +++ b/src/settings.ts @@ -0,0 +1,48 @@ +/* + * Power BI Visualizations + * + * Copyright (c) Microsoft Corporation + * All rights reserved. + * MIT License + * + * 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. + */ + +"use strict"; + +import { dataViewObjectsParser } from "powerbi-visuals-utils-dataviewutils"; +import DataViewObjectsParser = dataViewObjectsParser.DataViewObjectsParser; + +export class VisualSettings extends DataViewObjectsParser { + public dataPoint: dataPointSettings = new dataPointSettings(); + } + + export class dataPointSettings { + // Default color + public defaultColor: string = ""; + // Show all + public showAllDataPoints: boolean = true; + // Fill + public fill: string = ""; + // Color saturation + public fillRule: string = ""; + // Text Size + public fontSize: number = 12; + } + diff --git a/src/visual.ts b/src/visual.ts new file mode 100644 index 0000000..3644f83 --- /dev/null +++ b/src/visual.ts @@ -0,0 +1,81 @@ +/* +* Power BI Visual CLI +* +* Copyright (c) Microsoft Corporation +* All rights reserved. +* MIT License +* +* 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. +*/ +"use strict"; + +import "core-js/stable"; +import "./../style/visual.less"; +import powerbi from "powerbi-visuals-api"; +import VisualConstructorOptions = powerbi.extensibility.visual.VisualConstructorOptions; +import VisualUpdateOptions = powerbi.extensibility.visual.VisualUpdateOptions; +import IVisual = powerbi.extensibility.visual.IVisual; +import EnumerateVisualObjectInstancesOptions = powerbi.EnumerateVisualObjectInstancesOptions; +import VisualObjectInstance = powerbi.VisualObjectInstance; +import DataView = powerbi.DataView; +import VisualObjectInstanceEnumerationObject = powerbi.VisualObjectInstanceEnumerationObject; + +import { VisualSettings } from "./settings"; +export class Visual implements IVisual { + private target: HTMLElement; + private updateCount: number; + private settings: VisualSettings; + private textNode: Text; + + constructor(options: VisualConstructorOptions) { + console.log('Visual constructor', options); + this.target = options.element; + this.updateCount = 0; + if (document) { + const new_p: HTMLElement = document.createElement("p"); + new_p.appendChild(document.createTextNode("Update count:")); + const new_em: HTMLElement = document.createElement("em"); + this.textNode = document.createTextNode(this.updateCount.toString()); + new_em.appendChild(this.textNode); + new_p.appendChild(new_em); + this.target.appendChild(new_p); + } + } + + public update(options: VisualUpdateOptions) { + this.settings = Visual.parseSettings(options && options.dataViews && options.dataViews[0]); + console.log('Visual update', options); + if (this.textNode) { + this.textNode.textContent = (this.updateCount++).toString(); + } + } + + private static parseSettings(dataView: DataView): VisualSettings { + return VisualSettings.parse(dataView); + } + + /** + * This function gets called for each of the objects defined in the capabilities files and allows you to select which of the + * objects and properties you want to expose to the users in the property pane. + * + */ + public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject { + return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options); + } +} \ No newline at end of file diff --git a/style/visual.less b/style/visual.less new file mode 100644 index 0000000..9b1f1dd --- /dev/null +++ b/style/visual.less @@ -0,0 +1,9 @@ +p { + font-size: 20px; + font-weight: bold; + em { + background: yellow; + padding: 5px; + + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1b13ad5 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "allowJs": false, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es6", + "sourceMap": true, + "outDir": "./.tmp/build/", + "moduleResolution": "node", + "declaration": true, + "lib": [ + "es2015", + "dom" + ] + }, + "files": [ + "./src/visual.ts" + ] +} \ No newline at end of file diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..9076745 --- /dev/null +++ b/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "tslint-microsoft-contrib/recommended", + "rulesDirectory": [ + "node_modules/tslint-microsoft-contrib" + ], + "rules": { + "no-relative-imports": false + } +} \ No newline at end of file