| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("echarts"),require("d3")):"function"==typeof define&&define.amd?define(["echarts","d3"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).contourCustomSeriesInstaller=t(e.echarts,e.d3)}(this,(function(e,t){"use strict";function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t),o=function(t,r){var o=t.dataInsideLength;if(t.dataIndex===o-1){for(var i=t.itemPayload,a=t.coordSys,l=[],u=0;u<o;u++){var c=r.value(0,u),d=r.value(1,u),f=r.value(2,u),s=r.coord([c,d]);l.push({coord:s,value:f})}var h=a.width,p=a.height,y=n.scaleLinear().domain(n.extent(l,(function(e){return e.coord[0]}))).range([0,h]),v=n.scaleLinear().domain(n.extent(l,(function(e){return e.coord[1]}))).range([0,p]),g=e.zrUtil.retrieve2(i.thresholds,8),b=e.zrUtil.retrieve2(i.bandwidth,20),m=n.contourDensity().x((function(e){return y(e.coord[0])})).y((function(e){return v(e.coord[1])})).size([h,p]).bandwidth(b).thresholds(g)(l.map((function(e){return{coord:e.coord,value:e.value}}))).map(n.geoPath()),z=i.itemStyle||{},x=z.color||[r.visual("color")],j=e.zrUtil.retrieve2(z.opacity,[.3,1]);"number"==typeof j&&(j=[j,j]);var O=i.lineStyle||{},U=O.color,w=e.zrUtil.retrieve2(O.width,1),S=[];return m.forEach((function(t,r){var o="none"===x?"none":function(e,t,r){if(t<=1)return e[0];var o=r/(t-1),i=Math.floor(o*(e.length-1));if(i<=0)return e[0];if(i>=e.length-1)return e[e.length-1];var a=n.color(e[i]),l=n.color(e[i+1]),u=(o-i/(e.length-1))*(e.length-1);return n.interpolate(a,l)(u)}(x,g,r);"none"!==x&&S.push({type:"path",shape:{pathData:t},style:{fill:o,opacity:j[0]+(j[1]-j[0])*(r/(m.length-1))},z2:-1,disableTooltip:!0}),"none"===U||null==U&&"none"===x||S.push({type:"path",shape:{pathData:t},style:{fill:"none",stroke:e.zrUtil.retrieve2(U,o),lineWidth:w,opacity:e.zrUtil.retrieve2(O.opacity,1)},z2:-1,disableTooltip:!0})})),{type:"group",children:S,x:a.x,y:a.y}}return null};return{install:function(e){e.registerCustomSeries("contour",o)}}})); |
| //# sourceMappingURL=index.min.js.map |