UNPKG

@progress/kendo-vue-charts

Version:
9 lines (8 loc) 2.08 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),h=require("@progress/kendo-vue-common"),d=require("@progress/kendo-charts"),c=require("./Popup.js");function f(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!o.isVNode(e)}const S="k-chart-crosshair-tooltip",O="k-chart-tooltip-inverse",m=o.defineComponent({name:"KendoCrosshairTooltip",props:{index:Number,name:String},data(){return{popupShown:!1,popupAlign:void 0,popupOffset:void 0,popupContent:void 0,popupStyles:void 0,className:void 0}},inject:{optionsState:{default:{}},dispatchOptions:{default:null},observersStore:{default:null},dispatchObservers:{default:null},childrenObserver:{default:null}},created(){this.chartObserver=new d.InstanceObserver(this,{showTooltip:"onShowTooltip",hideTooltip:"onHideTooltip"}),this.dispatchObservers({type:"add",payload:this.chartObserver})},unmounted(){this.dispatchObservers({type:"remove",payload:this.chartObserver})},render(){const e=this.popupShown?this.popupContent:Function.prototype,t=h.classNames({[S]:!0,[O]:!!this.className});return o.createVNode(c.TooltipPopup,{popupShown:this.popupShown,popupAlign:this.popupAlign,popupOffset:this.popupOffset,popupStyles:this.popupStyles,className:t},f(e)?e:{default:()=>[e]})},methods:{onShowTooltip(e){const{anchor:t,style:p,className:s,crosshair:n,axisName:i,axisIndex:r,value:a}=e,{name:u,index:l}=this.$props;n&&i===u&&r===l&&(this.popupShown=!0,this.popupAlign=t.align,this.popupOffset=t.point,this.popupContent=a,this.popupStyles=p,this.className=s)},onHideTooltip(){this.popupShown=!1,this.popupStyles={},this.className=void 0}}});exports.CrosshairTooltip=m;