UNPKG

echarts

Version:

Apache ECharts is a powerful, interactive charting and data visualization library for browser

22 lines (19 loc) 4.42 kB
/* * 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 * under the License. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dataTool={},e.echarts)}(this,function(e,t){"use strict";u(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(e,t){return e["[object "+t+"]"]=!0,e},{}),u(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(e,t){return e["[object "+t+"Array]"]=!0,e},{});var r=Array.prototype,n=r.slice,a=r.map,o=function(){}.constructor,i=o?o.prototype:null;function l(e,t,r){if(!e)return[];if(!t)return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return n.apply(e,t)}(e);if(e.map&&e.map===a)return e.map(t,r);for(var o=[],i=0,l=e.length;i<l;i++)o.push(t.call(r,e[i],i,e));return o}function u(e,t,r,n){if(e&&t){for(var a=0,o=e.length;a<o;a++)r=t.call(n,r,e[a],a,e);return r}}i&&"function"==typeof i.bind&&i.call.bind(i.bind);function s(e,t){return e?l(d(e,"node"),function(e){var r={id:c(e,"id"),name:c(e,"label"),itemStyle:{normal:{}}},n=p(e,"viz:size"),a=p(e,"viz:position"),o=p(e,"viz:color"),i=p(e,"attvalues");if(n&&(r.symbolSize=parseFloat(c(n,"value"))),a&&(r.x=parseFloat(c(a,"x")),r.y=parseFloat(c(a,"y"))),o&&(r.itemStyle.normal.color="rgb("+[0|c(o,"r"),0|c(o,"g"),0|c(o,"b")].join(",")+")"),i){var l=d(i,"attvalue");r.attributes={};for(var u=0;u<l.length;u++){var s=l[u],f=c(s,"for"),v=c(s,"value"),g=t[f];if(g){switch(g.type){case"integer":case"long":v=parseInt(v,10);break;case"float":case"double":v=parseFloat(v);break;case"boolean":v="true"===v.toLowerCase()}r.attributes[f]=v}}}return r}):[]}function f(e){return e?l(d(e,"edge"),function(e){var t={id:c(e,"id"),name:c(e,"label"),source:c(e,"source"),target:c(e,"target"),lineStyle:{normal:{}}},r=t.lineStyle.normal,n=p(e,"viz:thickness"),a=p(e,"viz:color");return n&&(r.width=parseFloat(n.getAttribute("value"))),a&&(r.color="rgb("+[0|c(a,"r"),0|c(a,"g"),0|c(a,"b")].join(",")+")"),t}):[]}function c(e,t){return e.getAttribute(t)}function p(e,t){for(var r=e.firstChild;r;){if(1===r.nodeType&&r.nodeName.toLowerCase()===t.toLowerCase())return r;r=r.nextSibling}return null}function d(e,t){for(var r=e.firstChild,n=[];r;)r.nodeName.toLowerCase()===t.toLowerCase()&&n.push(r),r=r.nextSibling;return n}var v=Object.freeze({__proto__:null,parse:function(e){var t;if(!(t="string"==typeof e?(new DOMParser).parseFromString(e,"text/xml"):e)||t.getElementsByTagName("parsererror").length)return null;var r=p(t,"gexf");if(!r)return null;for(var n,a=p(r,"graph"),o=(n=p(a,"attributes"))?l(d(n,"attribute"),function(e){return{id:c(e,"id"),title:c(e,"title"),type:c(e,"type")}}):[],i={},u=0;u<o.length;u++)i[o[u].id]=o[u];return{nodes:s(p(a,"nodes"),i),links:f(p(a,"edges"))}}});function g(e){return e.sort(function(e,t){return e-t}),e}function b(e,t){var r=(e.length-1)*t+1,n=Math.floor(r),a=+e[n-1],o=r-n;return o?a+o*(e[n]-a):a}function h(e,t){for(var r=[],n=[],a=[],o=(t=t||{}).boundIQR,i="none"===o||0===o,l=0;l<e.length;l++){a.push(l+"");var u=g(e[l].slice()),s=b(u,.25),f=b(u,.5),c=b(u,.75),p=u[0],d=u[u.length-1],v=(null==o?1.5:o)*(c-s),h=i?p:Math.max(p,s-v),m=i?d:Math.min(d,c+v);r.push([h,s,f,c,m]);for(var y=0;y<u.length;y++){var x=u[y];if(x<h||x>m){var C=[l,x];"vertical"===t.layout&&C.reverse(),n.push(C)}}}return{boxData:r,outliers:n,axisData:a}}var m="1.0.0";t.dataTool&&(t.dataTool.version=m,t.dataTool.gexf=v,t.dataTool.prepareBoxplotData=h),e.gexf=v,e.prepareBoxplotData=h,e.version=m,Object.defineProperty(e,"__esModule",{value:!0})});