UNPKG

@progress/kendo-vue-charts

Version:
76 lines (75 loc) 1.97 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { defineComponent as c, createVNode as l, h as p } from "vue"; import { InstanceObserver as u } from "@progress/kendo-charts"; import { getTemplate as h } from "@progress/kendo-vue-common"; const S = /* @__PURE__ */ c({ name: "KendoDonutCenter", props: { render: [String, Function, Object] }, data() { return { donutCenterStyles: null }; }, inject: { optionsState: { default: {} }, dispatchOptions: { default: null }, dispatchObservers: { default: null }, childrenObserver: { default: null } }, created() { this.dispatchObservers({ type: "add", payload: new u(this, { render: "onRender" }) }); }, render() { const { render: t } = this.$props; let e = l("span", null, null); const n = h.call(this, { h: p, template: t, defaultRendering: null }); return t && this.donutCenterStyles && (e = l("div", { class: "k-chart-donut-center", style: this.donutCenterStyles }, [n])), e; }, methods: { onRender(t) { const e = this.optionsState.series, n = Array.isArray(e) ? e[0] : null, o = t.sender._plotArea.charts; if (!n || n.type !== "donut" || o[0].points.length === 0) return; const r = o[0].points[0].sector, s = r.innerRadius, d = r.center.y - s, a = r.center.x - s, i = s * 2; this.donutCenterStyles = { height: i + "px", left: a + "px", top: d + "px", width: i + "px" }; } } }); export { S as DonutCenter };