@nodata/render
Version:
Allows to dynamically render nodata components
1 lines • 1.9 kB
JavaScript
;var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.WitchartRendererPlugin=void 0;var witchart_1=require("@nodata/witchart"),formatters_1=require("../formatters"),utils_1=require("../utils"),WitchartRendererPlugin=function(t){function e(){var e=t.call(this)||this;return e.code=1,e.rendered=!1,e}return __extends(e,t),e.prototype.initialize=function(t,e,r){return this.fromConfig(t.config),this.updateSeriesDimension((0,utils_1.getOutputs)(e.descriptor)),this.updateData(r),this},e.prototype.on=function(e){return this.registerFormatters(),t.prototype.on.call(this,e).render(),this},e.prototype.render=function(){return this.rendered||(t.prototype.render.call(this),this.rendered=!0),this},e.prototype.disableAnimations=function(){return this.updateAnimationDuration(0),this},e.prototype.registerFormatters=function(){for(var t in formatters_1.formatters)this.registerNamedFormatter(t,formatters_1.formatters[t])},e.prototype.updateSeriesDimension=function(t){for(var e=0;e<this.nbSeriesSelector();e++)for(var r=function(r){var i=n.seriesDimensionColumnSelector(e,r),o=t.find((function(t){return t.name===i}));n.updateSeriesDimensionUnit(e,r,o.dataType),n.updateSeriesDimensionScale(e,r,"number"===o.dataType?"linear":"discontinuous")},n=this,i=0;i<this.nbSeriesDimensionsSelector(e);i++)r(i)},e}(witchart_1.WitchArt);exports.WitchartRendererPlugin=WitchartRendererPlugin;