Giter VIP home page Giter VIP logo

Comments (1)

pearmini avatar pearmini commented on September 23, 2024

这个配置在指定了 paddingBottom 才会生效:

import { Chart } from '@antv/g2';

const data = [
  { year: '1991/04/10', value: 3 },
  { year: '1992/04/10', value: 4 },
  { year: '1993/04/10', value: 3.5 },
  { year: '1994/04/10', value: 5 },
  { year: '1995/04/10', value: 4.9 },
  { year: '1996/04/10', value: 6 },
  { year: '1997/04/10', value: 7 },
  { year: '1998/04/10', value: 9 },
  { year: '1999/04/10', value: 13 },
];

const chart = new Chart({
  container: 'container',
  autoFit: true,
  paddingBottom: 40, // 这里
});

chart
  .data(data)
  .encode('x', 'year')
  .encode('y', 'value')
  .axis('x', {
    labelAutoRotate: {
      type: 'rotate',
      /** 可选的旋转角度值 */
      optionalAngles: [0, 20, 45, 90],
    },
  })
  .scale('x', {
    range: [0, 1],
  })
  .scale('y', {
    domainMin: 0,
    nice: true,
  });

chart.line().label({
  text: 'value',
  style: {
    dx: -10,
    dy: -12,
  },
});

chart.point().style('fill', 'white').tooltip(false);

chart.render();

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.