From 82534ea43f986cd4cd59e01e8f46fdcde45a956a Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 10 Nov 2018 11:16:09 +1030 Subject: [PATCH] Re-add some missing options, simplify CSS --- extensions/statistics/js/package-lock.json | 30 ++++---- .../src/admin/components/StatisticsWidget.js | 8 +- extensions/statistics/less/admin.less | 77 ++++++++++++++----- 3 files changed, 80 insertions(+), 35 deletions(-) diff --git a/extensions/statistics/js/package-lock.json b/extensions/statistics/js/package-lock.json index 351dd1073..4771e335b 100644 --- a/extensions/statistics/js/package-lock.json +++ b/extensions/statistics/js/package-lock.json @@ -1161,7 +1161,7 @@ }, "browserify-aes": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "requires": { "buffer-xor": "^1.0.3", @@ -1195,7 +1195,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "requires": { "bn.js": "^4.1.0", @@ -1235,7 +1235,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "requires": { "base64-js": "^1.0.2", @@ -1502,7 +1502,7 @@ }, "create-hash": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "requires": { "cipher-base": "^1.0.1", @@ -1514,7 +1514,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "requires": { "cipher-base": "^1.0.3", @@ -1643,7 +1643,7 @@ }, "diffie-hellman": { "version": "5.0.3", - "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "requires": { "bn.js": "^4.1.0", @@ -1773,7 +1773,7 @@ }, "events": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" }, "evp_bytestokey": { @@ -2512,7 +2512,7 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" }, "get-value": { @@ -3135,7 +3135,7 @@ }, "minimist": { "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "mississippi": { @@ -3176,7 +3176,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -3427,7 +3427,7 @@ }, "parse-asn1": { "version": "5.1.1", - "resolved": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "requires": { "asn1.js": "^4.0.0", @@ -3598,7 +3598,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "~1.0.0", @@ -3834,7 +3834,7 @@ }, "sha.js": { "version": "2.4.11", - "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "requires": { "inherits": "^2.0.1", @@ -4519,7 +4519,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "requires": { "string-width": "^1.0.1", @@ -4551,7 +4551,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" diff --git a/extensions/statistics/js/src/admin/components/StatisticsWidget.js b/extensions/statistics/js/src/admin/components/StatisticsWidget.js index f77770ec5..edf6bfbc6 100644 --- a/extensions/statistics/js/src/admin/components/StatisticsWidget.js +++ b/extensions/statistics/js/src/admin/components/StatisticsWidget.js @@ -139,10 +139,14 @@ export default class StatisticsWidget extends DashboardWidget { context.chart = new Chart(elm, { data, type: 'line', - height: 200, + height: 280, axisOptions: { xAxisMode: 'tick', - yAxisMode: 'span' + yAxisMode: 'span', + xIsSeries: true + }, + lineOptions: { + hideDots: 1 }, colors: ['black', app.forum.attribute('themePrimaryColor')] }); diff --git a/extensions/statistics/less/admin.less b/extensions/statistics/less/admin.less index 7941aa0d2..eb8559361 100644 --- a/extensions/statistics/less/admin.less +++ b/extensions/statistics/less/admin.less @@ -64,23 +64,8 @@ margin: -20px -10px; } .StatisticsWidget-chart .chart-container { - position: relative; - .frappe-chart { - height: 160px !important; - - .line-chart { - .dataset-0 { - opacity: 0.2; - - path { - stroke: #7f7f7f !important; - } - - circle { - fill: #7f7f7f !important; - } - } - } + .dataset-0 { + opacity: 0.2; } .chart-legend { display: none; @@ -95,7 +80,63 @@ * Frappe Charts 1.0.0 by @frappe - https://frappe.io/charts * License - MIT https://github.com/frappe/charts/blob/master/LICENSE */ -.StatisticsWidget-chart .chart-container .graph-svg-tip { +.chart-container { + position: relative; /* for absolutely positioned tooltip */ + + /* https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/ */ + font-family: -apple-system, BlinkMacSystemFont, + 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', + 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; + + .axis, .chart-label { + fill: #555b51; + + line { + stroke: #dadada; + } + } + .dataset-units { + circle { + stroke: #fff; + stroke-width: 2; + } + + path { + fill: none; + stroke-opacity: 1; + stroke-width: 2px; + } + } + .dataset-path { + stroke-width: 2px; + } + .path-group { + path { + fill: none; + stroke-opacity: 1; + stroke-width: 2px; + } + } + line.dashed { + stroke-dasharray: 5, 3; + } + .axis-line { + .specific-value { + text-anchor: start; + } + .y-line { + text-anchor: end; + } + .x-line { + text-anchor: middle; + } + } + .legend-dataset-text { + fill: #6c7680; + font-weight: 600; + } +} +.graph-svg-tip { position: absolute; z-index: 99999; padding: 10px;