chartjs-plugin-waterfall
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -377,7 +377,3 @@ (function (global, factory) { | ||
status[chart.id].readyToDrawStepLines = true; | ||
var options = chart.options.plugins.waterFallPlugin; | ||
if (options.stepLines.enabled) { | ||
drawStepLines(chart); | ||
} | ||
chart.draw(); | ||
}, chart.options.animation.duration); | ||
@@ -384,0 +380,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("lodash.merge"),require("lodash.groupby")):"function"==typeof define&&define.amd?define(["lodash.merge","lodash.groupby"],o):t.chartjsPluginWaterfall=o(t._.merge,t._.groupby)}(this,function(t,o){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,o=o&&o.hasOwnProperty("default")?o.default:o;!function(){function t(t){this.value=t}function o(o){function e(n,r){try{var s=o[n](r),i=s.value;i instanceof t?Promise.resolve(i.value).then(function(t){e("next",t)},function(t){e("throw",t)}):a(s.done?"return":"normal",s.value)}catch(t){a("throw",t)}}function a(t,o){switch(t){case"return":n.resolve({value:o,done:!0});break;case"throw":n.reject(o);break;default:n.resolve({value:o,done:!1})}(n=n.next)?e(n.key,n.arg):r=null}var n,r;this._invoke=function(t,o){return new Promise(function(a,s){var i={key:t,arg:o,resolve:a,reject:s,next:null};r?r=r.next=i:(n=r=i,e(t,o))})},"function"!=typeof o.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(o.prototype[Symbol.asyncIterator]=function(){return this}),o.prototype.next=function(t){return this._invoke("next",t)},o.prototype.throw=function(t){return this._invoke("throw",t)},o.prototype.return=function(t){return this._invoke("return",t)}}();var e=function(t){if(Array.isArray(t)){for(var o=0,e=Array(t.length);o<t.length;o++)e[o]=t[o];return e}return Array.from(t)},a=function(t,o,e,a){var n=e.stackBase,r=a.stackBase,s=e.stackTopYPos,i=a.stackTopYPos;s===r?(i=r,r=a.dummyStackBase):n===i&&(s=n,n=e.dummyStackBase),!e.isPositive&&a.isPositive&&(i=r,r=a.stackTopYPos),e.isPositive&&!a.isPositive&&(s=n,n=e.stackTopYPos);var l=s>i?s:i,u=n>r?n:r,c=t.createLinearGradient(0,l,0,u),f=e.options.startColor||o.startColor,p=e.options.endColor||o.endColor,d=e.options.startColorStop||o.startColorStop,k=e.options.endColorStop||o.endColorStop;c.addColorStop(d,f),c.addColorStop(k,p),t.fillStyle=c,t.beginPath(),t.lineTo(e.stackRightXPos,s),t.lineTo(a.stackLeftXPos,i),t.lineTo(a.stackLeftXPos,r),t.lineTo(e.stackRightXPos,n),t.fill()},n=function(t){var n=t.ctx,r=t.data.datasets,s=t.options.plugins.waterFallPlugin.stepLines,i=o(r,"stack"),l=[],u=function(t){var o=Object.keys(t._meta)[0];return t._meta[o].data[0]._model};Object.keys(i).forEach(function(t){var o=i[t],a=o.filter(function(t){return!t.waterfall.dummyStack}).map(function(t){return u(t).base}),n=Math.max.apply(Math,e(a)),r=o.map(function(t){return u(t).base}),s=Math.max.apply(Math,e(r)),c=o.map(function(t){var o=u(t);return{stackRightXPos:o.x+o.width/2,stackLeftXPos:o.x-o.width/2,stackTopYPos:o.y,stackBase:n,dummyStackBase:s,isPositive:t.data[0]>0,options:t.waterfall.stepLines}});l.push(c)});for(var c=function(t){var o=t.length-1;return{stackRightXPos:t[o].stackRightXPos,stackLeftXPos:t[o].stackLeftXPos,stackTopYPos:t[o].stackTopYPos,stackBase:t[o].stackBase,dummyStackBase:t[o].dummyStackBase,isPositive:t[o].isPositive,options:t[o].options}},f=0;f<l.length;f+=1){var p=l[f];if(f!==l.length-1){var d=l[f+1],k=c(p),h=c(d);k.stackTopYPos!==h.stackTopYPos&&k.stackBase!==h.stackTopYPos&&k.stackTopYPos!==h.stackBase||a(n,s,k,h)}}},r={waterFallPlugin:{stepLines:{enabled:!0,startColorStop:0,endColorStop:.6,startColor:"rgba(0, 0, 0, 0.55)",endColor:"rgba(0, 0, 0, 0)"}}},s={},i=function(t,o){return!o.datasets[t.datasetIndex].waterfall.dummyStack},l=function(o){o.data.datasets.forEach(function(o){o.waterfall=t({},{stepLines:{}},o.waterfall),o.waterfall.dummyStack&&(o.backgroundColor="rgba(0, 0, 0, 0)")})};return{beforeInit:function(t){s[t.id]={readyToDrawStepLines:!1}},afterInit:function(o){l(o),o.options.plugins=t({},r,o.options.plugins),o.options.tooltips.filter=i,o.options.legend.labels.filter=i,setTimeout(function(){s[o.id].readyToDrawStepLines=!0,o.options.plugins.waterFallPlugin.stepLines.enabled&&n(o)},o.options.animation.duration)},afterDraw:function(t){var o=t.options.plugins.waterFallPlugin;l(t),o.stepLines.enabled&&s[t.id].readyToDrawStepLines&&n(t)}}}); | ||
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("lodash.merge"),require("lodash.groupby")):"function"==typeof define&&define.amd?define(["lodash.merge","lodash.groupby"],o):t.chartjsPluginWaterfall=o(t._.merge,t._.groupby)}(this,function(t,o){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,o=o&&o.hasOwnProperty("default")?o.default:o;!function(){function t(t){this.value=t}function o(o){function e(n,r){try{var s=o[n](r),i=s.value;i instanceof t?Promise.resolve(i.value).then(function(t){e("next",t)},function(t){e("throw",t)}):a(s.done?"return":"normal",s.value)}catch(t){a("throw",t)}}function a(t,o){switch(t){case"return":n.resolve({value:o,done:!0});break;case"throw":n.reject(o);break;default:n.resolve({value:o,done:!1})}(n=n.next)?e(n.key,n.arg):r=null}var n,r;this._invoke=function(t,o){return new Promise(function(a,s){var i={key:t,arg:o,resolve:a,reject:s,next:null};r?r=r.next=i:(n=r=i,e(t,o))})},"function"!=typeof o.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(o.prototype[Symbol.asyncIterator]=function(){return this}),o.prototype.next=function(t){return this._invoke("next",t)},o.prototype.throw=function(t){return this._invoke("throw",t)},o.prototype.return=function(t){return this._invoke("return",t)}}();var e=function(t){if(Array.isArray(t)){for(var o=0,e=Array(t.length);o<t.length;o++)e[o]=t[o];return e}return Array.from(t)},a=function(t,o,e,a){var n=e.stackBase,r=a.stackBase,s=e.stackTopYPos,i=a.stackTopYPos;s===r?(i=r,r=a.dummyStackBase):n===i&&(s=n,n=e.dummyStackBase),!e.isPositive&&a.isPositive&&(i=r,r=a.stackTopYPos),e.isPositive&&!a.isPositive&&(s=n,n=e.stackTopYPos);var l=s>i?s:i,u=n>r?n:r,c=t.createLinearGradient(0,l,0,u),f=e.options.startColor||o.startColor,p=e.options.endColor||o.endColor,d=e.options.startColorStop||o.startColorStop,k=e.options.endColorStop||o.endColorStop;c.addColorStop(d,f),c.addColorStop(k,p),t.fillStyle=c,t.beginPath(),t.lineTo(e.stackRightXPos,s),t.lineTo(a.stackLeftXPos,i),t.lineTo(a.stackLeftXPos,r),t.lineTo(e.stackRightXPos,n),t.fill()},n=function(t){var n=t.ctx,r=t.data.datasets,s=t.options.plugins.waterFallPlugin.stepLines,i=o(r,"stack"),l=[],u=function(t){var o=Object.keys(t._meta)[0];return t._meta[o].data[0]._model};Object.keys(i).forEach(function(t){var o=i[t],a=o.filter(function(t){return!t.waterfall.dummyStack}).map(function(t){return u(t).base}),n=Math.max.apply(Math,e(a)),r=o.map(function(t){return u(t).base}),s=Math.max.apply(Math,e(r)),c=o.map(function(t){var o=u(t);return{stackRightXPos:o.x+o.width/2,stackLeftXPos:o.x-o.width/2,stackTopYPos:o.y,stackBase:n,dummyStackBase:s,isPositive:t.data[0]>0,options:t.waterfall.stepLines}});l.push(c)});for(var c=function(t){var o=t.length-1;return{stackRightXPos:t[o].stackRightXPos,stackLeftXPos:t[o].stackLeftXPos,stackTopYPos:t[o].stackTopYPos,stackBase:t[o].stackBase,dummyStackBase:t[o].dummyStackBase,isPositive:t[o].isPositive,options:t[o].options}},f=0;f<l.length;f+=1){var p=l[f];if(f!==l.length-1){var d=l[f+1],k=c(p),h=c(d);k.stackTopYPos!==h.stackTopYPos&&k.stackBase!==h.stackTopYPos&&k.stackTopYPos!==h.stackBase||a(n,s,k,h)}}},r={waterFallPlugin:{stepLines:{enabled:!0,startColorStop:0,endColorStop:.6,startColor:"rgba(0, 0, 0, 0.55)",endColor:"rgba(0, 0, 0, 0)"}}},s={},i=function(t,o){return!o.datasets[t.datasetIndex].waterfall.dummyStack},l=function(o){o.data.datasets.forEach(function(o){o.waterfall=t({},{stepLines:{}},o.waterfall),o.waterfall.dummyStack&&(o.backgroundColor="rgba(0, 0, 0, 0)")})};return{beforeInit:function(t){s[t.id]={readyToDrawStepLines:!1}},afterInit:function(o){l(o),o.options.plugins=t({},r,o.options.plugins),o.options.tooltips.filter=i,o.options.legend.labels.filter=i,setTimeout(function(){s[o.id].readyToDrawStepLines=!0,o.draw()},o.options.animation.duration)},afterDraw:function(t){var o=t.options.plugins.waterFallPlugin;l(t),o.stepLines.enabled&&s[t.id].readyToDrawStepLines&&n(t)}}}); | ||
//# sourceMappingURL=chartjs-plugin-waterfall.min.js.map |
@@ -375,7 +375,3 @@ 'use strict'; | ||
status[chart.id].readyToDrawStepLines = true; | ||
var options = chart.options.plugins.waterFallPlugin; | ||
if (options.stepLines.enabled) { | ||
drawStepLines(chart); | ||
} | ||
chart.draw(); | ||
}, chart.options.animation.duration); | ||
@@ -382,0 +378,0 @@ }, |
@@ -5,3 +5,3 @@ { | ||
"description": "Chart.js plugin for easy waterfall charts", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "lib/chartjs-plugin-waterfall.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71860
581