Giter VIP home page Giter VIP logo

Comments (8)

Calmio-Y avatar Calmio-Y commented on July 19, 2024 1

ok,谢谢

from g2.

pearmini avatar pearmini commented on July 19, 2024

每个组里面数据都不一样,可以将数据按照 color 字段先排序。

from g2.

Calmio-Y avatar Calmio-Y commented on July 19, 2024

有demo吗

from g2.

pearmini avatar pearmini commented on July 19, 2024
chart
  .interval()
  .data(xx.sort((a, b) => a['产品'] - b['产品']))
  .transform({
    type: 'dodgeX',
    orderBy: 'series', // 这里
    reverse: true, // 这里
  })
  .encode('x', '品牌')
  .encode('y', '上期收入')
  .encode('color', '产品')
  .encode('series', '产品');

chart.render();

from g2.

Calmio-Y avatar Calmio-Y commented on July 19, 2024

6303能答疑一下下吗

from g2.

Calmio-Y avatar Calmio-Y commented on July 19, 2024

不对啊,
image
期望是柱子的顺序和图例的顺序一致啊

from g2.

pearmini avatar pearmini commented on July 19, 2024

我再看一下,有点奇怪这个问题

from g2.

pearmini avatar pearmini commented on July 19, 2024

先这样写:

chart
  .interval()
  .data(xx)
  .encode('x', '品牌')
  .encode('y', '上期收入')
  .encode('color', '产品')
  .encode('series', '产品');

chart.render();

这种和 dodgeX 应该是等价的,我进一步看问题在哪。

from g2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.