antvis/G2

Bug - Broken auto fit container #4540

cd-alexslater posted onGitHub

Hey Everyone,

Thought I'd mention this as the demo on the site is broken as well.

When using autoFit: true in the new Chart() configuration, you get this: <img width="447" alt="image" src="https://user-images.githubusercontent.com/114569661/209939011-1df8f820-57b9-4a77-9b77-593636ce53bd.png">

Steps to reproduce:

1) Go to the 'Dual' demo in code sandbox: https://codesandbox.io/s/q3t41i 2) Change the dependency version to the latest beta version (it's v5 code but the code sandbox is set to v4 for whatever reason) 3) Observe that nothing renders 4) Resize the window with the preview in code sandbox and it will reload, and you'll see the problem I pictured above.


Potentially related to https://github.com/antvis/G2/issues/4533 but I think that one relates to a broken UI after resize - in this case the chart fails to render (or does so improperly).

posted by cd-alexslater over 2 years ago

I reproduce this issue, and you should specify the beta version of G2 explicitly as the latest tag is still point to v4.

{
  "dependencies": {
    "@antv/g2": "5.0.0-beta.5"
  },
  "devDependencies": {
    "typescript": "latest"
  },
  "main": "index.ts"
}
posted by pearmini over 2 years ago
posted by pearmini over 2 years ago

You should specify the width and height of the container, then the problem will be solved.

<div id="container" style="width: 640px;height: 480px"/>

https://codesandbox.io/s/vibrant-meninsky-t62zvc?file=/index.html

posted by pearmini over 2 years ago

Fund this Issue

$0.00
Funded

Pull requests