Lachevre
Lachevre

Reputation: 612

Data wrong display using @antv/g2plot.js version 2+

I have been trying to use G2plot (https://g2plot.antv.vision/) for a basic line graph. I made some tests a while ago with the 1.28 version and it was working fine. I removed some config that became obsolete and tried the latest version but the display of the graph isn't the same and looks like something sketchy. I guess I made a mistake but I can't see which one, any help would be very much appreciated.

Thanks in advance

Here is a link to the sandbox : https://codesandbox.io/s/szzhq?file=/index.ts

I found a screenshot of what it used to look like with the same data : https://ibb.co/H2MkfFj

Upvotes: 2

Views: 521

Answers (2)

Apostolos
Apostolos

Reputation: 10498

You shouldn't convert it to a string. Use meta instead and declare your axis as linear type.

  meta: {
    CountPerSecund: {
      type: "linear"
    }
  },

You can also directly add a type property to xAxis This is also working

xAxis: {
  type: 'linear',

demo

Upvotes: 0

Lachevre
Lachevre

Reputation: 612

Fixed it, the x field needed to be set as a string instead of a number..

Upvotes: 1

Related Questions