apexcharts
Version:
A JavaScript Chart Library
6 lines (5 loc) • 4.02 kB
JavaScript
/*!
* ApexCharts v7.0.0
* (c) 2018-2026 ApexCharts
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexMarks={})}(this,function(e){"use strict";const t=globalThis.ApexCharts,s=globalThis.ApexCharts.__internals.__apex_Graphics,l=globalThis.ApexCharts.__internals.__apex_Utils;t._customSeriesFactory=function(e,t){const r=class{constructor(e,t,s){this.w=e,this.ctx=t,this.xyRatios=s,this._warned=!1}draw(r,i,a){var n,o;const u=this.w,c=new s(u,this.ctx),d=function(e,t){const s=e&&e.renderer;return s&&s.kind&&"svg"!==s.kind?s:t}(this.ctx,c),h=c.group({class:"apexcharts-marks-series"});return r.forEach((s,r)=>{var i;const n=Array.isArray(a)?a[r]:r,o=c.group({class:"apexcharts-series",rel:n+1,seriesName:l.escapeString(u.seriesData.seriesNames[n]),"data:realIndex":n}),x=this._scales(n,(u.seriesData.series[n]||[]).length),p=u.globals.colors[n],y=(null==(i=u.config.series[n])?void 0:i.data)||[],f=u.seriesData.seriesX[n]||[],g=u.seriesData.series[n]||[];u.globals.seriesXvalues[n]=[],u.globals.seriesYvalues[n]=[],void 0===u.globals.pointsArray[n]&&(u.globals.pointsArray[n]=[]);for(let s=0;s<g.length;s++){const l=g[s];if(null==l)continue;const r=f[s],i=x.xAt(s,r),a=x.y(l),c=this._api(d,o,n,s);try{t.renderItem({datum:y[s],x:i,y:a,scales:x,api:c,seriesIndex:n,dataPointIndex:s,color:p})}catch(t){this._warned||(console.warn(`[apexcharts] renderItem for series type "${e}" threw; skipping datum:`,t),this._warned=!0)}u.globals.seriesXvalues[n][s]=i,u.globals.seriesYvalues[n][s]=a,u.globals.pointsArray[n][s]=[i,a]}c.setupEventDelegation(o,".apexcharts-marks-mark"),h.add(o)}),null==(o=null==(n=this.ctx.animations)?void 0:n.animationCompleted)||o.call(n,h),h}_scales(e,t){var s,l,r,i;const a=this.w.globals,n=this.w.config,o=this.xyRatios.xRatio,u=this.xyRatios.yRatio,c=null!=(l=null==(s=a.seriesYAxisReverseMap)?void 0:s[e])?l:0,d=Array.isArray(u)?null!=(r=u[c])?r:u[0]:u,h=a.maxYArr,x=Array.isArray(h)&&h.length&&null!=(i=h[c])?i:a.maxY,p=a.gridWidth,y=a.gridHeight,f=!a.isXNumeric,g=t||a.dataPoints||1,k=g>0?p/g:p,m="on"===n.xaxis.tickPlacement,v=e=>o?(e-a.minX)/o:p/2,w=a.minXDiff||1;return{x:v,xAt:(e,t)=>f?m&&g>1?e/(g-1)*p:(e+.5)*k:v(t),y:e=>(x-e)/d,gridWidth:p,gridHeight:y,band:f?k:o?w/o:p}}_api(e,t,s,l){const r=e=>{if(e){try{e.node.setAttribute("index",String(s)),e.node.setAttribute("j",String(l)),e.node.classList.add("apexcharts-marks-mark")}catch(e){}t.add(e)}return e};return{path:(t={})=>{var s,l,i,a,n,o,u,c,d;return r(e.drawPath({d:t.d||"",stroke:null!=(s=t.stroke)?s:"#000",strokeWidth:null!=(i=null!=(l=t.width)?l:t.strokeWidth)?i:1,fill:null!=(a=t.fill)?a:"none",fillOpacity:null!=(o=t.fillOpacity)?o:t.fill&&"none"!==t.fill?null!=(n=t.opacity)?n:1:0,strokeOpacity:null!=(c=null!=(u=t.strokeOpacity)?u:t.opacity)?c:1,strokeDashArray:null!=(d=t.dash)?d:0,strokeLinecap:t.lineCap}))},line:(t={})=>{var s,l,i,a;return r(e.drawLine(t.x1,t.y1,t.x2,t.y2,null!=(s=t.stroke)?s:"#000",null!=(l=t.dash)?l:0,null!=(a=null!=(i=t.width)?i:t.strokeWidth)?a:1))},rect:(t={})=>{var s,l,i,a,n,o,u,c;return r(e.drawRect(null!=(s=t.x)?s:0,null!=(l=t.y)?l:0,null!=(i=t.w)?i:0,null!=(a=t.h)?a:0,null!=(n=t.r)?n:0,null!=(o=t.fill)?o:"#000",null!=(u=t.opacity)?u:1,null!=t.stroke?null!=(c=t.strokeWidth)?c:1:null,t.stroke))},circle:(t={})=>{var s,l,i,a,n;return r(e.drawCircle(null!=(s=t.r)?s:0,{cx:null!=(l=t.cx)?l:0,cy:null!=(i=t.cy)?i:0,fill:null!=(a=t.fill)?a:"#000",stroke:t.stroke||"none","stroke-width":null!=(n=t.strokeWidth)?n:t.stroke?1:0}))},text:(t={})=>{var s,l,i,a;return r(e.drawText({x:null!=(s=t.x)?s:0,y:null!=(l=t.y)?l:0,text:null!=(i=t.text)?i:"",textAnchor:null!=(a=t.anchor)?a:"start",fontSize:t.size,foreColor:t.color,fontWeight:t.weight}))}}}};return r.dataType=t.dataType||"xy",r.yExtent="function"==typeof t.yExtent?t.yExtent:null,r},e.default=t,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});