UNPKG

realmap

Version:

Wooritech map chart component library

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