فهرست منبع

持仓分析pc端显示弹窗

jwyu 2 سال پیش
والد
کامیت
d7f75663ef
2فایلهای تغییر یافته به همراه25 افزوده شده و 22 حذف شده
  1. 1 1
      src/views/hzyb/chart/positionAnalysis/Index.vue
  2. 24 21
      src/views/hzyb/chart/positionAnalysis/components/ChartBox.vue

+ 1 - 1
src/views/hzyb/chart/positionAnalysis/Index.vue

@@ -373,7 +373,7 @@ window.addEventListener('message',e=>{
     padding-top: 300px;
 }
 
-@media (min-width: 400px){
+@media (min-width: 600px){
     .chart-position-analysis-page{
         padding: 0;
         .top-sticky-wrap{

+ 24 - 21
src/views/hzyb/chart/positionAnalysis/components/ChartBox.vue

@@ -22,7 +22,7 @@ const colorMap=new Map([
 //图表默认配置项
 const chartDefaultOpts={
     chart: {
-		type: 'columnrange',
+		type: 'column',
         inverted:true,//xy轴换位置
 	},
     title: {
@@ -31,14 +31,14 @@ const chartDefaultOpts={
     //版权信息
 	credits: {enabled:false},
     plotOptions:{
-        columnrange: {
-            grouping: false,//不分组 这样就能叠起来
+        column: {
             pointPadding: 0,
+			stacking: 'normal',
             dataLabels: {
                 enabled: true,
-                inside:true,
-                align: 'left',
+                align: 'right',
                 color: '#333',
+                x:60,
                 formatter:function(e){
                     return this.point.options.isLabel
                 }
@@ -77,28 +77,21 @@ function chartRender(){
         {
             name:'减少',
             data:[]
-        }
+        },
     ]
     let totalArr=[],increaseArr=[],reduceArr=[];
-    props.data.list.forEach(item=>{
+    props.data.list.forEach((item,index)=>{
         categories.push(item.deal_short_name)
 
         // 处理series
-        totalArr.push({low:0,high:item.deal_value})
         if(item.deal_change<0){//减少
-            increaseArr.push({low:0,high:0})
-            reduceArr.push({
-                low:item.deal_value,
-                high:item.deal_value-item.deal_change,
-                isLabel:`${item.deal_value}/${item.deal_change}`
-            })
+            totalArr.push({y:item.deal_value})
+            increaseArr.push({y:0})
+            reduceArr.push({y:-item.deal_change,isLabel:`${item.deal_value}/${item.deal_change}`})
         }else{
-            reduceArr.push({low:0,high:0})
-            increaseArr.push({
-                low:item.deal_value-item.deal_change,
-                high:item.deal_value,
-                isLabel:`${item.deal_value}/+${item.deal_change}`
-            })
+            totalArr.push({y:item.deal_value-item.deal_change})
+            reduceArr.push({y:0})
+            increaseArr.push({y:item.deal_change,isLabel:`${item.deal_value}/+${item.deal_change}`})
         }
         
     })
@@ -123,6 +116,7 @@ function chartRender(){
         title: {
           text: '',
         },
+        reversedStacks: false
     }
     
     options.colors=colorMap.get(props.keyVal)
@@ -145,6 +139,15 @@ function showDetail(name){
             data=item
         }
     })
+    // 判断是否是在pc中 如果是则通知pc显示弹窗
+    console.log(window.innerWidth);
+    if(window.innerWidth>600){
+        window.parent.postMessage({
+            opt:'showDetail',
+            data:data
+        },"*")
+        return
+    }
     showDetailData.value=data
     showDetailPop.value=true
 }
@@ -299,7 +302,7 @@ onMounted(()=>{
         color: #E3B377;
     }
 }
-@media (min-width: 400px){
+@media (min-width: 600px){
     .chart-render-box{
         .label-box{
             display: flex;