You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/03/28 03:27:22 UTC

[GitHub] [echarts] zhedream opened a new issue #16757: [Bug] encode is bad when seriesData is an arrayObject

zhedream opened a new issue #16757:
URL: https://github.com/apache/echarts/issues/16757


   ### Version
   
   5.3.1
   
   ### Link to Minimal Reproduction
   
   https://codepen.io/zhedream/pen/abEWJVN
   
   ### Steps to Reproduce
   
   打开 codepen 链接, 使用了 encode 的几种方式, 如下
   run_dataset_arrayList_isGood
   run_dataset_arrayObject_isGood
   run_seriesData_arrayList_isGood
   run_seriesData_arrayObject_isBad,
   
   其中  run_seriesData_arrayObject_isBad 的使用方式存在 bug
   
   ```js
   option = 
   {
       title: {
         text: "run_seriesData_arrayObject_isBad",
         show: true
       },
       tooltip: {
         trigger: "axis",
         appendToBody: true
       },
       dataZoom: [
         {
           type: "inside"
         },
         {}
       ],
       legend: {},
       grid: {
         left: 30,
         right: 30,
         bottom: 50,
         containLabel: true
       },
       // dataset: [
       //   {
       //     source: [
       //       ["2022-03-11 14:51:01", 1, 1],
       //       ["2022-03-11 14:51:02", 2, 5],
       //       ["2022-03-11 14:51:03", 3, 2],
       //       ["2022-03-11 14:51:04", 4, 2],
       //       ["2022-03-11 14:51:05", 5, 4]
       //       // { x: '2022-03-11 14:51:01', y: 1 },
       //       // { x: '2022-03-11 14:51:02', y: 2 },
       //       // { x: '2022-03-11 14:51:03', y: 3 },
       //       // { x: '2022-03-11 14:51:04', y: 4 },
       //       // { x: '2022-03-11 14:51:05', y: 5 }
       //     ]
       //   }
       // ],
       xAxis: [
         {
           type: "time"
         }
       ],
       yAxis: [
         {
           type: "value",
           name: "浓度"
         }
       ],
       series: [
         {
           type: "line",
           name: "PM2.5",
           dimensions: ["x", "y", "value2"],
           encode: {
             x: "x",
             y: "y"
           },
           data: [
             // ["2022-03-11 14:51:01", 1, 1],
             // ["2022-03-11 14:51:02", 2, 5],
             // ["2022-03-11 14:51:03", 3, 2],
             // ["2022-03-11 14:51:04", 4, 2],
             // ["2022-03-11 14:51:05", 5, 4],
             { x: '2022-03-11 14:51:01', y: 1 },
             { x: '2022-03-11 14:51:02', y: 2 },
             { x: '2022-03-11 14:51:03', y: 3 },
             { x: '2022-03-11 14:51:04', y: 4 },
             { x: '2022-03-11 14:51:05', y: 5 }
           ]
         }
       ]
     
     };
   ```
   
   ### Current Behavior
   
   当 series.data 为数组对象, encode 错误, 图形不能正常显示
   
   ### Expected Behavior
   
   当 series.data 为数组对象时, encode 后正常显示图形
   
   ### Environment
   
   _No response_
   
   ### Any additional comments?
   
   _No response_


-- 
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] zhedream commented on issue #16757: [Bug] encode is bad when seriesData is an arrayObject

Posted by GitBox <gi...@apache.org>.
zhedream commented on issue #16757:
URL: https://github.com/apache/echarts/issues/16757#issuecomment-1081340620


   谢谢, 已解决
   ```js
   option = {
       title: {
         text: "run_seriesData_arrayObject_isBad",
         show: true
       },
       tooltip: {
         trigger: "axis",
         appendToBody: true
       },
       dataZoom: [
         {
           type: "inside"
         },
         {}
       ],
       legend: {},
       grid: {
         left: 30,
         right: 30,
         bottom: 50,
         containLabel: true
       },
       // dataset.encode  支持  数组和对象形式
       // dataset: [
       //   {
       //     source: [
       //       ["2022-03-11 14:51:01", 1, 1],
       //       ["2022-03-11 14:51:02", 2, 5],
       //       ["2022-03-11 14:51:03", 3, 2],
       //       ["2022-03-11 14:51:04", 4, 2],
       //       ["2022-03-11 14:51:05", 5, 4]
       //       // { x: '2022-03-11 14:51:01', y: 1 },
       //       // { x: '2022-03-11 14:51:02', y: 2 },
       //       // { x: '2022-03-11 14:51:03', y: 3 },
       //       // { x: '2022-03-11 14:51:04', y: 4 },
       //       // { x: '2022-03-11 14:51:05', y: 5 }
       //     ]
       //   }
       // ],
       xAxis: [
         {
           type: "category"
         }
       ],
       yAxis: [
         {
           type: "value",
           name: "浓度"
         }
       ],
       series: [
         {
           type: "line",
           name: "PM2.5",
          // series.data - encode 只支持数组嵌套格式
           dimensions: ["x", "y", "value2"],
           encode: {
             x: "x",
             y: "y"
           },
           data: [
             // 简写1, xAxis.type=category 且 xAxis.data , series.data 可以 只有数值
             // 1,2,3,4,5
   
             // 简写2: series.data 仅支持嵌套数组
             // ["2022-03-11 14:51:01", 1, 1],
             // ["2022-03-11 14:51:02", 2, 5],
             // ["2022-03-11 14:51:03", 3, 2],
             // ["2022-03-11 14:51:04", 4, 2],
             // ["2022-03-11 14:51:05", 5, 4],
   
             // 完整形式: series.data + 其他样式
             { value: ["2022-03-11 14:51:01", 1, 1], itemStyle: {} },
             { value: ["2022-03-11 14:51:02", 2, 5], itemStyle: {} },
             { value: ["2022-03-11 14:51:03", 3, 2], itemStyle: {} },
             { value: ["2022-03-11 14:51:04", 4, 2], itemStyle: {} },
             { value: ["2022-03-11 14:51:05", 5, 4], itemStyle: {} }
   
             // 没有这种
             // { x: '2022-03-11 14:51:01', y: 1 },
             // { x: '2022-03-11 14:51:02', y: 2 },
             // { x: '2022-03-11 14:51:03', y: 3 },
             // { x: '2022-03-11 14:51:04', y: 4 },
             // { x: '2022-03-11 14:51:05', y: 5 },
             
             // 也不支持这种写法: series.data 仅支持嵌套数组
             // { value: { x: "2022-03-11 14:51:01", y: 1 } },
             // { value: { x: "2022-03-11 14:51:02", y: 2 } },
             // { value: { x: "2022-03-11 14:51:03", y: 3 } },
             // { value: { x: "2022-03-11 14:51:04", y: 4 } },
             // { value: { x: "2022-03-11 14:51:05", y: 5 } },
           ]
         }
       ]
     };
   ```


-- 
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] zhedream closed issue #16757: [Bug] encode is bad when seriesData is an arrayObject

Posted by GitBox <gi...@apache.org>.
zhedream closed issue #16757:
URL: https://github.com/apache/echarts/issues/16757


   


-- 
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] jiawulin001 commented on issue #16757: [Bug] encode is bad when seriesData is an arrayObject

Posted by GitBox <gi...@apache.org>.
jiawulin001 commented on issue #16757:
URL: https://github.com/apache/echarts/issues/16757#issuecomment-1080367256


   series.data应该只支持数组嵌套格式,不支持键值对格式,只有dataset支持键值对格式,参考[series-line.data](https://echarts.apache.org/zh/option.html#series-line.data)


-- 
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