You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
91 KiB
1 line
91 KiB
9 months ago
|
'use strict';var config={yAxisWidth:15,yAxisSplit:5,xAxisHeight:15,xAxisLineHeight:15,legendHeight:15,yAxisTitleWidth:15,padding:[10,10,10,10],pixelRatio:1,rotate:!1,columePadding:3,fontSize:13,dataPointShape:["circle","circle","circle","circle"],colors:["#1890ff","#2fc25b","#facc14","#f04864","#8543e0","#90ed7d"],pieChartLinePadding:15,pieChartTextPadding:5,xAxisTextPadding:3,titleColor:"#333333",titleFontSize:20,subtitleColor:"#999999",subtitleFontSize:15,toolTipPadding:3,toolTipBackground:"#000000",toolTipOpacity:.7,toolTipLineHeight:20,radarLabelTextMargin:15,gaugeLabelTextMargin:15};let assign=function(e,...t){function i(e,t){for(let a in t)e[a]=e[a]&&"[object Object]"===e[a].toString()?i(e[a],t[a]):e[a]=t[a];return e}if(null==e)throw new TypeError("Cannot convert undefined or null to object");return!t||0>=t.length?e:(t.forEach(t=>{e=i(e,t)}),e)};var util={toFixed:function(e,t){return t=t||2,this.isFloat(e)&&(e=e.toFixed(t)),e},isFloat:function(e){return 0!=e%1},approximatelyEqual:function(e,t){return 1e-10>Math.abs(e-t)},isSameSign:function(e,t){var i=Math.abs;return i(e)===e&&i(t)===t||i(e)!==e&&i(t)!==t},isSameXCoordinateArea:function(e,t){return this.isSameSign(e.x,t.x)},isCollision:function(e,t){e.end={},e.end.x=e.start.x+e.width,e.end.y=e.start.y-e.height,t.end={},t.end.x=t.start.x+t.width,t.end.y=t.start.y-t.height;var i=t.start.x>e.end.x||t.end.x<e.start.x||t.end.y>e.start.y||t.start.y<e.end.y;return!i}};function getH5Offset(t){return t.mp={changedTouches:[]},t.mp.changedTouches.push({x:t.offsetX,y:t.offsetY}),t}function hexToRgb(e,t){var i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,a=e.replace(i,function(e,t,i,a){return t+t+i+i+a+a}),o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a),n=parseInt(o[1],16),l=parseInt(o[2],16),r=parseInt(o[3],16);return"rgba("+n+","+l+","+r+","+t+")"}function findRange(e,t,i){if(isNaN(e))throw new Error("[uCharts] unvalid series data!");i=i||10,t=t?t:"upper";for(var a=1;1>i;)i*=10,a*=10;for(e="upper"===t?Math.ceil(e*a):Math.floor(e*a);0!=e%i;)"upper"===t?e++:e--;return e/a}function calCandleMA(e,t,i,a){let o=[];for(let n,l=0;l<e.length;l++){n={data:[],name:t[l],color:i[l]};for(let t=0,i=a.length;t<i;t++){if(t<e[l]){n.data.push(null);continue}let i=0;for(let o=0;o<e[l];o++)i+=a[t-o][1];n.data.push(+(i/e[l]).toFixed(3))}o.push(n)}return o}function calValidDistance(e,t,i,a,o){var n=o.width-o.area[1]-o.area[3],l=i.eachSpacing*(o.chartData.xAxisData.xAxisPoints.length-1),r=t;return 0<=t?(r=0,e.event.trigger("scrollLeft")):Math.abs(t)>=l-n&&(r=n-l,e.event.trigger("scrollRight")),r}function isInAngleRange(e,t,i){function a(e){for(;0>e;)e+=2*o;for(;e>2*o;)e-=2*o;return e}var o=Math.PI;return e=a(e),t=a(t),i=a(i),t>i&&(i+=2*o,e<t&&(e+=2*o)),e>=t&&e<=i}function calRotateTranslate(e,t,i){var a=e,o=i-t,n=a+(i-o-a)/1.4142135623730951;n*=-1;return{transX:n,transY:(i-o)*(1.4142135623730951-1)-(i-o-a)/1.4142135623730951}}function createCurveControlPoints(e,t){function i(e,t){return!!(e[t-1]&&e[t+1])&&(e[t].y>=l(e[t-1].y,e[t+1].y)||e[t].y<=n(e[t-1].y,e[t+1].y))}function o(e,t){return!!(e[t-1]&&e[t+1])&&(e[t].x>=l(e[t-1].x,e[t+1].x)||e[t].x<=n(e[t-1].x,e[t+1].x))}var n=Math.min,l=Math.max,r=.2,a=.2,s=null,d=null,h=null,x=null;if(1>t?(s=e[0].x+(e[1].x-e[0].x)*r,d=e[0].y+(e[1].y-e[0].y)*r):(s=e[t].x+(e[t+1].x-e[t-1].x)*r,d=e[t].y+(e[t+1].y-e[t-1].y)*r),t>e.length-3){var c=e.length-1;h=e[c].x-(e[c].x-e[c-1].x)*a,x=e[c].y-(e[c].y-e[c-1].y)*a}else h=e[t+1].x-(e[t+2].x-e[t].x)*a,x=e[t+1].y-(e[t+2].y-e[t].y)*a;return i(e,t+1)&&(x=e[t+1].y),i(e,t)&&(d=e[t].y),o(e,t+1)&&(h=e[t+1].x),o(e,t)&&(s=e[t].x),(d>=l(e[t].y,e[t+1].y)||d<=n(e[t].y,e[t+1].y))&&(d=e[t].y),(x>=l(e[t].y,e[t+1].y)||x<=n(e[t].y,e[t+1].y))&&(x=e[t+1].y),(s>=l(e[t].x,e[t+1].x)||s<=n(e[t].x,e[t+1].x))&&(s=e[t].x),(h>=l(e[t].x,e[t+1].x)||h<=n(e[t].x,e[t+1].x))&&(h=e[t+1].x),{ctrA:{x:s,y:d},ctrB:{x:h,y:x}}}function convertCoordinateOrigin(e,t,i){return{x:i.x+e,y:i.y-t}}function avoidCollision(e,t){if(t)for(;util.isCollision(e,t);)0<e.start.x?e.start.y--:0>e.start.x?e.start.y++:0<e.start.y?e.start.y++:e.start.y--;return e}function fillSeries(e,t,i
|