"use strict";const t=require("../../../common/vendor.js"),e=require("../../../request/api.js"),a=require("../../../utils/util.js"),o=require("../../../common/assets.js"),i=require("../../../uni_modules/lime-echart/static/echarts.min.js"),s={data:()=>({navH:t.inject("navHeight"),contentTop:"",navTitle:"",type:"",eventId:"",stockCode:"",categoryList:["分时图","日K线"],selectCategory:0,tradeData:null,option:{title:{show:!1},tooltip:{position:function(t,e,a,o,i){var s={top:"10%"};return s[["left","right"][+(t[0]{if(200==e.code){this.navTitle=e.data.basic_info.stock_name+"("+e.data.basic_info.stock_code+")";let t=e.data.minute_chart_data;this.tradeData=e.data.latest_trade;let i=[],s=[],n=t[0].open;for(let e of t){i.push(e.time);let t=a.accMul(a.accDiv(a.accSub(e.close,n),n).toFixed(4),100),o=e.volume;o>1e4&&(o=(o/1e4).toFixed(0)+"万");let r=e.amount;r>1e4&&(r=(r/1e4).toFixed(0)+"万"),s.push([e.time,e.close,e.high,e.open,e.low,t,o,r])}let r=n,l=0;for(let e of s){let t=e[1];parseFloat(t)l&&(l=parseFloat(t))}let c=(n-r)/3,d=(l-n)/3,h=[];if(c>d){for(var o=3;o>0;o--)h.push(n-o*c);for(o=0;o<4;o++)h.push(n+o*c)}else{for(o=3;o>0;o--)h.push(n-o*d);for(o=0;o<4;o++)h.push(n+o*d)}this.option1.xAxis.data=i,this.option1.yAxis.min=h[0].toFixed(2),this.option1.yAxis.max=h[h.length-1].toFixed(2),this.option1.series.data=s;let p=[],m=e.data.event_info.event_start_time.split("T")[1];m=m.substring(0,5);for(let e of h)p.push({xAxis:m,lineStyle:{type:"solid",width:1,color:"#ffd700"},label:{position:"middle",formatter:"事件发生",color:"#ffd700"}},{yAxis:e,label:{show:!0,position:"start",color:"#333"}},{yAxis:e,label:{show:!0,position:"end",formatter:a.accMul(a.accDiv(a.accSub(e,n),n).toFixed(4),100)+"%",color:"#333"}});this.option1.series.markLine.data=p;let u=e.data.related_desc;u&&(this.relatedDesc=u.relation_desc,u.retrieved_sources&&(this.sourceList=u.retrieved_sources)),this.init()}else t.index.showToast({title:e.message,icon:"none"})})).catch((t=>{}))},getStockCandlestickChartData(){let t=this.stockCode,a={chart_type:"minute"};1==this.selectCategory&&(a.chart_type="daily"),e.stockCandlestickChartData(t,a).then((t=>{let e=t.data,a=[],o=[];for(let i of e)a.push(i.time),o.push([i.open,i.close,i.low,i.high]);this.option.xAxis.data=a,this.option.series[0].data=o,this.init()})).catch((t=>{}))}}};if(!Array){(t.resolveComponent("navBar")+t.resolveComponent("l-echart"))()}Math||((()=>"../../../components/navBar/navBar.js")+(()=>"../../../uni_modules/lime-echart/components/l-echart/l-echart.js"))();const n=t._export_sfc(s,[["render",function(e,a,i,s,n,r){return t.e({a:t.p({leftText:n.navTitle,hideNavBg:!0}),b:o._imports_0,c:1==n.type},1==n.type?{d:t.f(n.categoryList,((e,a,o)=>t.e({a:t.t(e),b:n.selectCategory==a},(n.selectCategory,{}),{c:t.n("item relative "+(n.selectCategory==a?"select":"")),d:a,e:t.o((t=>r.clickCategoryItem(a)),a)})))}:{},{e:1==n.type&&n.tradeData},1==n.type&&n.tradeData?{f:t.t(n.tradeData.volume),g:t.t(n.tradeData.amount)}:{},{h:1==n.type},1==n.type?{i:t.sr("chartRef","42054871-1")}:{},{j:t.t(n.relatedDesc),k:t.s("margin-top:"+n.contentTop+"px;"),l:1==n.type&&n.sourceList.length>0},1==n.type&&n.sourceList.length>0?{m:t.f(n.sourceList,((e,a,o)=>({a:t.t(e.sentences),b:t.t(e.report_title),c:t.t(e.author),d:t.t(n.getLocalDate(e.declare_date)),e:a})))}:{})}]]);wx.createPage(n);