UNPKG

realmap

Version:

Wooritech map chart component library

8 lines (6 loc) 1.9 kB
/** * RealMap Chart v1.1.20 * Copyright (C) 2023-2026 WooriTech Inc. * All Rights Reserved. */ import{ChartAnnotationType as t,extend as e,Annotation as r,AnnotationView as i,RmElement as a,pickNum as h,rectToSize as s,ExternalModuleManager as o}from"./index.mjs";class n extends r{constructor(){super(...arguments),this._chart=null}get realchart(){return this._chart}set realchart(t){this._chart=t}}n.DEF_SIZE=100,n.type=t,n.defaults=e(r.defaults,{animatable:!0});class l extends i{constructor(t){super(t,l.CLASS_NAME),this.add(this._foreignObj=new a(t,"","foreignObject")),this._htmlView=t.createElementNS("http://www.w3.org/1999/xhtml","div"),this._htmlView.className="rm-chart-annotation-container",this._foreignObj.addDom(this._htmlView)}_doMeasure(t,e,r,i){const a=e.getSize(r,i),o=this._htmlView;return this._foreignObj.resize(h(a.width,n.DEF_SIZE),a.height),this.model.realchart||this.$_prepareChart(t),isNaN(this._foreignObj.height)&&(this._foreignObj.height=o.offsetHeight),s(this._foreignObj.bbox())}_doDispose(){this.model.realchart&&(this.model.realchart.destroy(),this.model.realchart=null),this._foreignObj.remove()}$_prepareChart(t){try{const e=this._htmlView,r=o.getInstance().findModule("realchart");if(!r)throw new Error("리얼차트 모듈을 로드하지 못했습니다. realchart 모듈을 등록했는지 확인하세요.");this.model.realchart=r.createChart(t,e,this.model.prop("config"),this.model.prop("animatable"))}catch(t){console.error("차트 생성 중 오류가 발생했습니다. 리얼차트의 모듈과 라이선스가 올바르게 적용되었는지 확인하세요.")}}}function c(t,e){if(function(t){return t.Series&&t.SeriesView}(t)){t.Annotation.register(n),t.AnnotationView.register([n,l]);const r=t.ExternalModuleManager.getInstance();e&&r.registerModule("realchart",e)}}l.CLASS_NAME="rm-chart-annotation";export{n as ChartAnnotation,c as default};