You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "fff21 (via GitHub)" <gi...@apache.org> on 2023/05/12 05:41:00 UTC

[GitHub] [echarts] fff21 opened a new issue, #18616: [Feature]

fff21 opened a new issue, #18616:
URL: https://github.com/apache/echarts/issues/18616

   ### What problem does this feature solve?
   
   轴线数值较大, 数据较小的时候挤在中间, 怎么才能让线的两头触底 (如图所示)
   希望能得到解决方法(ノ゚▽゚)ノ
   `getEchart() {
         this.$echarts.registerTransform(ecStat.transform.regression);
   
         let myChart4 = this.$echarts.init(document.getElementById("charts"));
   
         let mp = {
           symbol: 'arrow', symbolSize: 5, symbolRotate: -90,
           label: {show: true, position: 'left', formatter:'{c}'},
           data: [
             {yAxis: 5, xAxis:10, value:'5.00'},
             {yAxis: 40, xAxis:10, value:'40.00'}
           ]
         }
   
         let option = {
           dataset: [
             {
               source: [
                 [90, 12.988],
                 [109,30],
                 [283, 42.5],
                 [327, 56.0],
                 [452, 74.4],
                 [440, 88.2],
               ],
             },
             {
               transform: {
                 type: 'ecStat:regression'
               }
             },
             {
               id: 2,
               source: [
                 [173, 21],
                 [221,34],
                 [456,41],
                 [466,62],
                 [744,89]
               ]
             },
             {
               fromDatasetId: 2,
               transform: {
                 type: 'ecStat:regression'
               }
             },
             {
               id: 3,
               source: [
                 [344,21],
                 [821,36],
                 [856,51],
                 [879,67],
                 [958,81]
               ]
             },
             {
               fromDatasetId:3,
               transform: {
                 type: 'ecStat:regression'
               }
             }
           ],
   
           legend: {
             bottom: 5
           },
           tooltip: {
             trigger: 'axis',
             axisPointer: {
               type: 'cross'
             }
           },
           xAxis: {
             type: 'log',
             min: 10, max: 1000000,
             splitLine: {
               lineStyle: {
                 type: 'dashed'
               }
             },
             axisLabel: {
               formatter: function (value) {
                 if (Math.abs(value) > 1000) {
                   if (value == 0) {
                     return "0";
                     // 检查是否已经转化为科学计数了
                   } else if ((value + '').indexOf('e') > 0) {
                     return (value + '').replace(/e/, "E");
                   } else {
                     var res = value.toString();
                     var numN1 = 0;
                     var numN2 = 1;
                     var num1 = 0;
                     var num2 = 0;
                     var t1 = 1;
                     // 计入小数点前后有多少位
                     for (var k = 0; k < res.length; k++) {
                       if (res[k] == ".")
                         t1 = 0;
                       if (t1)
                         num1++;
                       else
                         num2++;
                     }
                     // 均转换为科学计数法表示
                     if (Math.abs(value) < 1) {
                       // 小数点后一位开始计算
                       for (var i = 2; i < res.length; i++) {
                         if (res[i] == "0") {
                           numN2++; //记录10的负指数值(默认值从1开始)
                         } else if (res[i] == ".")
                           continue;
                         else
                           break;
                       }
                       let v = parseFloat(value);
                       // 10的numN2次方
                       v = v * Math.pow(10, numN2);
                       v = v.toFixed(1); //四舍五入 仅保留一位小数位数
                       return v.toString() + "e-" + numN2;
                     } else if (num1 > 1) {
                       numN1 = num1 - 1;
                       let v = parseFloat(value);
                       v = v / Math.pow(10, numN1);
                       if (num2 > 1) {
                         v = v.toFixed(1);
                       }
                       return v.toString() + "e" + `+`+  numN1;
                     }
                   }
                 } else {
                   return value;
                 }
               }
             }
           },
           yAxis: {
             type: 'log',
             min: 1.0, max: 99.90,
             splitLine: {
               lineStyle: {
                 type: 'dashed'
               }
             }
           },
           series: [
             {
               symbol:'triangle',
               name: 'scatter',
               type: 'scatter',
               datasetIndex: 0
             },
             {
               name: 'line',
               type: 'line',
               datasetIndex: 1,
               symbol: 'circle',
               encode: { label: 2, tooltip: 1 }
             },
             {
               //散点形状设置symbol: 'circle’, ‘rect’, ‘roundRect’, ‘triangle’, ‘diamond’, ‘pin’, 'arrow’
               symbol:'roundRect',
               name: 'scatter2',
               type: 'scatter',
               datasetIndex: 2
             },
             {
               name: 'line2',
               type: 'line',
               smooth: true,
               datasetIndex: 3,
               symbol: 'circle',
               encode: { label: 2, tooltip: 1 }
             },
             {
               name: 'scatter3',
               type: 'scatter',
               datasetIndex: 4
             },
             {
               name: 'line3',
               type: 'line',
               smooth: true,
               datasetIndex:5,
               symbol: 'circle',
               encode: { label: 2, tooltip: 1 }
             },
             {
               type: 'scatter',
               datasetIndex:6,
               itemStyle: {
                 normal: {
                   color: '#a80000', //改变折线点的颜色
                   lineStyle: {
                     color: '#a80000' //改变折线颜色
                   }
                 }
               },
               markPoint: mp,
               markLine: {
                 symbol: ['none','none'],
                 label: {position:'start'},
                 data: [{yAxis: 63.21}]
               }
             },
           ]
         };
         // 使用指定的配置项和数据显示图表。
         myChart4.setOption(option);
       },`
   
   ### What does the proposed API look like?
   
   ![Snipaste_2023-05-12_13-34-26](https://github.com/apache/echarts/assets/130143783/cc6e026c-9226-4ab0-b9b1-77180e45a52f)
   这个是想要实现的效果


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] echarts-bot[bot] closed issue #18616: [Feature]

Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] closed issue #18616: [Feature] 
URL: https://github.com/apache/echarts/issues/18616


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] fff21 closed issue #18616: [Feature]

Posted by "fff21 (via GitHub)" <gi...@apache.org>.
fff21 closed issue #18616: [Feature] 
URL: https://github.com/apache/echarts/issues/18616


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] echarts-bot[bot] commented on issue #18616: [Feature]

Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on issue #18616:
URL: https://github.com/apache/echarts/issues/18616#issuecomment-1545196637

   I'm sorry to close this issue for it lacks the necessary title. Please provide **a _descriptive_ and as _concise_ as possible title to describe your problems or requests** and then the maintainers or I will reopen this issue.
   
   Every good bug report or feature request starts with a title. Your issue title is a critical element as it's the first thing maintainers see.
   
   A good issue title makes it easier for maintainers to understand what the issue is, easily locate it, and know what steps they'll need to take to fix it.
   
   Moreover, it's better to include keywords, as this makes it easier to find the issue self and similar issues in searches.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org