Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据堆叠时最大值计算错误 #8338

Closed
zx69 opened this issue May 15, 2018 · 1 comment
Closed

数据堆叠时最大值计算错误 #8338

zx69 opened this issue May 15, 2018 · 1 comment
Labels
stale Inactive for a long time. Will be closed in 7 days.

Comments

@zx69
Copy link

zx69 commented May 15, 2018

One-line summary [问题简述]

项目中同时采用stack数据堆叠、series.data数据分组,结果柱状图的高度超出yAxis的最大值,突出图表。

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:
  • Browser version [浏览器类型和版本]:
  • OS Version [操作系统类型和版本]:

最新版chrome

Expected behaviour [期望结果]

准确计算最大值

ECharts option [ECharts配置项]

option = { 
  "tooltip": {
    "trigger": "axis",
    formatter: function(params){
        let pre = params[0].seriesName;
        return params[0].value[0]
          + '<br>' + params.reduce((init,next) => {
            let hrText = '';
            if(pre !== next.seriesName){
              hrText = '<hr>';
              pre = next.seriesName;
            }
            return init + hrText + `${next.marker} ${next.value[2]}-${next.seriesName}: ${next.value[1]}<br>`;
          },'')
      },
    "axisPointer": {
      "type": "cross",
      "label": {
        "precision": 0
      },
      "crossStyle": {
        "color": "#999"
      }
    }
  },
  "legend": {
    "right": 0,
    "data": [
      "入库单数",
      "出库单数",
      "盘点单数",
      "入库SKU数",
      "出库SKU数",
      "盘点SKU数"
    ]
  },
  "xAxis": [
    {
      "data": [
        "05-15-00时",
        "05-15-01时",
        "05-15-02时",
        "05-15-03时",
        "05-15-04时",
        "05-15-05时",
        "05-15-06时",
        "05-15-07时",
        "05-15-08时",
        "05-15-09时",
        "05-15-10时",
        "05-15-11时",
        "05-15-12时",
        "05-15-13时",
        "05-15-14时",
        "05-15-15时",
        "05-15-16时",
        "05-15-17时",
        "05-15-18时",
        "05-15-19时",
        "05-15-20时",
        "05-15-21时",
        "05-15-22时",
        "05-15-23时",
        "05-12-00时",
        "05-12-01时",
        "05-12-02时",
        "05-12-03时",
        "05-12-04时",
        "05-12-05时",
        "05-12-06时",
        "05-12-07时",
        "05-12-08时",
        "05-12-09时",
        "05-12-10时",
        "05-12-11时",
        "05-12-12时",
        "05-12-13时",
        "05-12-14时",
        "05-12-15时",
        "05-12-16时",
        "05-12-17时",
        "05-12-18时",
        "05-12-19时",
        "05-12-20时",
        "05-12-21时",
        "05-12-22时",
        "05-12-23时",
        "05-04-00时",
        "05-04-01时",
        "05-04-02时",
        "05-04-03时",
        "05-04-04时",
        "05-04-05时",
        "05-04-06时",
        "05-04-07时",
        "05-04-08时",
        "05-04-09时",
        "05-04-10时",
        "05-04-11时",
        "05-04-12时",
        "05-04-13时",
        "05-04-14时",
        "05-04-15时",
        "05-04-16时",
        "05-04-17时",
        "05-04-18时",
        "05-04-19时",
        "05-04-20时",
        "05-04-21时",
        "05-04-22时",
        "05-04-23时",
        "05-03-00时",
        "05-03-01时",
        "05-03-02时",
        "05-03-03时",
        "05-03-04时",
        "05-03-05时",
        "05-03-06时",
        "05-03-07时",
        "05-03-08时",
        "05-03-09时",
        "05-03-10时",
        "05-03-11时",
        "05-03-12时",
        "05-03-13时",
        "05-03-14时",
        "05-03-15时",
        "05-03-16时",
        "05-03-17时",
        "05-03-18时",
        "05-03-19时",
        "05-03-20时",
        "05-03-21时",
        "05-03-22时",
        "05-03-23时"
      ],
      "axisPointer": {
        "type": "shadow"
      }
    }
  ],
  "yAxis": [
    {
      "type": "value",
      "name": "处理单数",
      "axisLabel": {
        "formatter": "{value}单"
      }
    },
    {
      "type": "value",
      "name": "处理SKU数",
      "axisLabel": {
        "formatter": "{value}件"
      }
    }
  ],
  "series": [
    {
      "name": "出库单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "出库单数",
      "itemStyle": {
        "color": "#c23531"
      },
      "data": [
        [
          "05-15-10时",
          3,
          "STATIONA"
        ],
        [
          "05-15-10时",
          3,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "出库SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "出库SKU数",
      "itemStyle": {
        "color": "#d48265"
      },
      "data": [
        [
          "05-15-10时",
          3,
          "STATIONA"
        ],
        [
          "05-15-10时",
          3,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "盘点单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "盘点单数",
      "itemStyle": {
        "color": "#546570"
      },
      "data": [
        [
          "05-12-15时",
          1,
          "STATIONC"
        ]
      ]
    },
    {
      "name": "盘点SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "盘点SKU数",
      "itemStyle": {
        "color": "#2f4554"
      },
      "data": [
        [
          "05-12-15时",
          1998,
          "STATIONC"
        ]
      ]
    },
    {
      "name": "盘点单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "盘点单数",
      "itemStyle": {
        "color": "#546570"
      },
      "data": [
        [
          "05-12-14时",
          1,
          "STATIONC"
        ]
      ]
    },
    {
      "name": "盘点SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "盘点SKU数",
      "itemStyle": {
        "color": "#2f4554"
      },
      "data": [
        [
          "05-12-14时",
          999,
          "STATIONC"
        ]
      ]
    },
    {
      "name": "出库单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "出库单数",
      "itemStyle": {
        "color": "#c23531"
      },
      "data": [
        [
          "05-04-09时",
          51,
          "STATIOND"
        ],
        [
          "05-04-09时",
          35,
          "STATIONC"
        ],
        [
          "05-04-09时",
          49,
          "STATIONB"
        ],
        [
          "05-04-09时",
          67,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "出库SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "出库SKU数",
      "itemStyle": {
        "color": "#d48265"
      },
      "data": [
        [
          "05-04-09时",
          74,
          "STATIOND"
        ],
        [
          "05-04-09时",
          63,
          "STATIONC"
        ],
        [
          "05-04-09时",
          74,
          "STATIONB"
        ],
        [
          "05-04-09时",
          102,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "出库单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "出库单数",
      "itemStyle": {
        "color": "#c23531"
      },
      "data": [
        [
          "05-04-08时",
          118,
          "STATIOND"
        ],
        [
          "05-04-08时",
          104,
          "STATIONC"
        ],
        [
          "05-04-08时",
          126,
          "STATIONB"
        ],
        [
          "05-04-08时",
          114,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "出库SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "出库SKU数",
      "itemStyle": {
        "color": "#d48265"
      },
      "data": [
        [
          "05-04-08时",
          152,
          "STATIOND"
        ],
        [
          "05-04-08时",
          252,
          "STATIONC"
        ],
        [
          "05-04-08时",
          211,
          "STATIONB"
        ],
        [
          "05-04-08时",
          211,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "盘点单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "盘点单数",
      "itemStyle": {
        "color": "#546570"
      },
      "data": [
        [
          "05-04-00时",
          12,
          "STATIONC"
        ]
      ]
    },
    {
      "name": "盘点SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "盘点SKU数",
      "itemStyle": {
        "color": "#2f4554"
      },
      "data": [
        [
          "05-04-00时",
          415,
          "STATIONC"
        ]
      ]
    },
    {
      "name": "出库单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "出库单数",
      "itemStyle": {
        "color": "#c23531"
      },
      "data": [
        [
          "05-03-09时",
          51,
          "STATIOND"
        ],
        [
          "05-03-09时",
          35,
          "STATIONC"
        ],
        [
          "05-03-09时",
          49,
          "STATIONB"
        ],
        [
          "05-03-09时",
          67,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "出库SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "出库SKU数",
      "itemStyle": {
        "color": "#d48265"
      },
      "data": [
        [
          "05-03-09时",
          74,
          "STATIOND"
        ],
        [
          "05-03-09时",
          63,
          "STATIONC"
        ],
        [
          "05-03-09时",
          74,
          "STATIONB"
        ],
        [
          "05-03-09时",
          102,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "出库单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "出库单数",
      "itemStyle": {
        "color": "#c23531"
      },
      "data": [
        [
          "05-03-08时",
          118,
          "STATIOND"
        ],
        [
          "05-03-08时",
          104,
          "STATIONC"
        ],
        [
          "05-03-08时",
          126,
          "STATIONB"
        ],
        [
          "05-03-08时",
          114,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "出库SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "出库SKU数",
      "itemStyle": {
        "color": "#d48265"
      },
      "data": [
        [
          "05-03-08时",
          152,
          "STATIOND"
        ],
        [
          "05-03-08时",
          252,
          "STATIONC"
        ],
        [
          "05-03-08时",
          211,
          "STATIONB"
        ],
        [
          "05-03-08时",
          211,
          "STATIONA"
        ]
      ]
    },
    {
      "name": "盘点单数",
      "type": "bar",
      "yAxisIndex": 0,
      "stack": "盘点单数",
      "itemStyle": {
        "color": "#546570"
      },
      "data": [
        [
          "05-03-00时",
          12,
          "STATIONC"
        ]
      ]
    },
    {
      "name": "盘点SKU数",
      "type": "bar",
      "yAxisIndex": 1,
      "stack": "盘点SKU数",
      "itemStyle": {
        "color": "#2f4554"
      },
      "data": [
        [
          "05-03-00时",
          415,
          "STATIONC"
        ]
      ]
    }
  ]
}

Other comments [其他信息]

@stale
Copy link

stale bot commented May 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Inactive for a long time. Will be closed in 7 days. label May 15, 2020
@stale stale bot closed this as completed May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Inactive for a long time. Will be closed in 7 days.
Projects
None yet
Development

No branches or pull requests

1 participant