realchart
Version:
Wooritech charting library
8 lines (6 loc) • 4.34 kB
JavaScript
/**
* RealChart Heatmap v1.4.12
* Copyright (C) 2023-2026 WooriTech Inc.
* All Rights Reserved.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartheatmap={},t.RealChart)}(this,(function(t,e){"use strict";function n(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var o,r=n(e),i=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(e.ZValuePoint),u=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return i(n,t),n.prototype.getColor=function(t){},n.prototype.canMixWith=function(t){return!1},n.prototype.canCategorized=function(){return!0},n.prototype.hasZ=function(){return!0},n.prototype.defYAxisType=function(){return"category"},n.prototype._createPoint=function(t){return new a(t)},n.prototype._doPrepareRender=function(){t.prototype._doPrepareRender.call(this);var n=Number.MAX_VALUE,o=Number.MIN_VALUE;this._runPoints.forEach((function(t){isNaN(t.zValue)||(n=e.minv(n,t.zValue),o=e.maxv(o,t.zValue))})),this._heatMin=n,this._heatMax=o},n.type=e.HeatmapSeriesType,n.defaults=e.extend(e.Series.defaults,{tooltipText:"x: <b>${x}</b><br>y: <b>${y}</b><br>heat: <b>${z}</b>"}),n}(e.ConnectableSeries),s=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),l=function(t){function n(n){return t.call(this,n,e.SeriesView.POINT_CLASS)||this}return s(n,t),n}(e.RectElement),c=function(t){function n(n){var o=t.call(this,n,"rct-heatmap-series")||this;return o._cells=new e.ElementPool(o._pointContainer,l),o}return s(n,t),n.prototype._getPointPool=function(){return this._cells},n.prototype._prepareSeries=function(t,e){this.$_parepareCells(e,this._visPoints)},n.prototype._renderSeries=function(t,e){this._pointContainer.invert(this._inverted,e),this.$_layoutCells(t,e)},n.prototype._runShowEffect=function(t){t&&e.SeriesAnimation.grow(this)},n.prototype._doViewRateChanged=function(t){this.$_layoutCells(this.width,this.height)},n.prototype.$_parepareCells=function(t,n){var o=this,r=new e.Color(t._calcedColor),i=[{fill:void 0}],a=t._heatMin,u=t._heatMax-a;this._cells.prepare(n.length,(function(e,s){var l=e.point=n[s];i[0].fill=r.brighten(1-(l.zValue-a)/u).toString(),o._setPointStyle(e,t,l,i)}))},n.prototype.$_layoutCells=function(t,e){var n=this.model,o=this._inverted,r=this._getGrowRate();n.pointLabel;var i=this._labelViews(),a=this._labelContainer._textAlign,u=n._xAxisObj,s=n._yAxisObj,l=o?t:e,c=o?e:t,p=o?0:e;this._cells.forEach((function(t){var e=t.point;if(t.setVis(!e.isNull)){var n=u.getUnitLen(c,e.xValue)*r,f=s.getUnitLen(l,e.yValue)*r,h=u.getPos(c,e.xValue)-n/2,y=p-s.getPos(l,e.yValue)-f/2,_=void 0;if(e.xPos=o?p+s.getPos(l,e.yValue):h+n/2,e.yPos=o?c-u.getPos(c,e.xValue)+n/2:y+f/2,t.setBounds(h,y,n,f),i&&(_=i.get(e,0))){_.layout(a);var d=_.getBBox();o?(y=c-u.getPos(c,e.xValue)-d.height/2,h=p+s.getPos(l,e.yValue)):(h+=n/2,y+=(f-d.height)/2),h-=d.width/2,_.trans(h,y)}}}))},n}(e.SeriesView);function p(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(u),t.SeriesView.register([u,c]))}p(r),t.HeatmapSeries=u,t.default=p,Object.defineProperty(t,"__esModule",{value:!0})}));