UNPKG

@progress/kendo-react-charts

Version:

React Chart renders a wide range of high-quality data visualizations. KendoReact Charts package

9 lines (8 loc) 1.86 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 a=require("react"),p=require("../Container.js"),b=require("./Crosshair.js"),h=require("../ChartContext.js");function x(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>s[e]})}}return t.default=s,Object.freeze(t)}const i=x(a),u=["categoryAxis","valueAxis","xAxis","yAxis"];function f(s){const t={};for(let e=0;e<u.length;e++){const o=d(s,u[e]);for(let n=0;n<o.length;n++){const r=o[n];t[r.name+r.index]=r}}return t}function d(s,t){const e=[];if(s[t]){const o=[].concat(s[t]);for(let n=0;n<o.length;n++){const r=(o[n].crosshair||{}).tooltip;r&&r.visible&&e.push({index:n,name:t})}}return e}const l=class l extends i.Component{constructor(){super(...arguments),this.context=null,this.state={tooltips:{}},this.storeUnsubscriber=Function.prototype,this.subscriber=()=>{var t;this.setState({tooltips:f((t=this.context)==null?void 0:t.optionsStore.getState())})}}componentDidMount(){this.storeUnsubscriber=this.context.optionsStore.subscribe(this.subscriber)}render(){const{tooltips:t}=this.state,e=Object.keys(t).map(o=>i.createElement(b.CrosshairTooltip,{...t[o],key:o}));return i.createElement(p.Container,null,e)}componentWillUnmount(){this.storeUnsubscriber()}};l.contextType=h.ChartContext;let c=l;exports.CrosshairTooltipContainer=c;