(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[6],{"2pFn":function(e,t,a){"use strict";var n=a("g09b");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,a("miYZ");var r=n(a("tsqr")),i=n(a("qIgq")),o=f(a("q1tI")),u=a("yP6+"),l=n(a("CLrh")),c=a("N8P2");function d(e){if("function"!==typeof WeakMap)return null;var t=new WeakMap,a=new WeakMap;return(d=function(e){return e?a:t})(e)}function f(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==typeof e&&"function"!==typeof e)return{default:e};var a=d(t);if(a&&a.has(e))return a.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=e[i]}return n.default=e,a&&a.set(e,n),n}var s=u.Guide.Html,m=u.Guide.Arc,p=function(e){var t=e.config,a=[{value:0,formatValue:0}],n=(0,o.useState)(a),d=(0,i.default)(n,2),f=d[0],p=d[1],v={value:{min:t.min||0,max:t.max||10,tickInterval:t.max/10||1,nice:!1}},y=(0,o.useState)(300),g=(0,i.default)(y,2),h=g[0],b=g[1];return(0,o.useEffect)(function(){var t=document.getElementById(e.id);t&&b(t.offsetHeight-50)},[e.ySize]),(0,o.useEffect)(function(){e.ready&&e.ready(function(){r.default.success("\u66f4\u65b0\u3002\u3002\u3002".concat(e.id))}),e.edit&&e.edit(function(){return e.config})},[]),(0,o.useEffect)(function(){var t,a=e.config.dimension;if("history"===a){var n=[{dashboard:"device",object:e.productId,measurement:e.config.measurement,dimension:"history",params:{history:1,deviceId:e.deviceId}}];l.default.visualization.getDashboardData(n).then(function(e){if(200===e.status){var t=e.result,a=t.map(function(e){return{value:e.data.value.value,formatValue:e.data.value.formatValue}});p(a)}})}else t=(0,c.getWebsocket)("".concat(e.id,"-").concat(e.productId,"-").concat(e.deviceId,"-").concat(e.config.measurement),"/dashboard/device/".concat(e.productId,"/").concat(e.config.measurement,"/realTime"),{deviceId:e.deviceId,history:e.config.history}).subscribe(function(e){var t=e.payload;p([{formatValue:t.value.formatValue,value:t.value.value}])});return function(){return t&&t.unsubscribe()}},[]),o.default.createElement(u.Chart,{height:h,data:f,scale:v,padding:"auto",forceFit:!0,placeholder:!0,style:{overflow:"hidden"}},o.default.createElement(u.Coord,{type:"polar",startAngle:-9/8*Math.PI,endAngle:1/8*Math.PI,radius:.75}),o.default.createElement(u.Axis,{name:"value",zIndex:2,line:null,label:{offset:-16,textStyle:{fontSize:18,textAlign:"center",textBaseline:"middle"}},subTickCount:4,subTickLine:{length:-8,stroke:"#fff",strokeOpacity:1},tickLine:{length:-18,stroke:"#fff",strokeOpacity:1}}),o.default.createElement(u.Axis,{name:"1",visible:!1}),o.default.createElement(u.Guide,null,o.default.createElement(m,{zIndex:0,start:[t.min||0,.965],end:[t.max||10,.965],style:{stroke:"#CBCBCB",lineWidth:18}}),o.default.createElement(m,{zIndex:1,start:[0,.965],end:[f[0].value,.965],style:{stroke:"#1890FF",lineWidth:18}}),o.default.createElement(s,{position:["50%","90%"],html:'<div style="width: 300px;text-align: center;font-size: 12px!important;"><p style="font-size: 1.75em; color: rgba(0,0,0,0.43);margin: 0;">'.concat(t.name,'</p><p style="font-size: 3em;color: rgba(0,0,0,0.85);margin: 0;">').concat(f[0].formatValue,"</p></div>")})),o.default.createElement(u.Geom,{type:"point",position:"value*1",shape:"pointer",color:"#1890FF",active:!1,style:{stroke:"#fff",lineWidth:1}}))},v=p;t.default=v}}]);