1.4.2 • Published 3 months ago

@ant-design/charts v1.4.2

Weekly downloads
11,577
License
MIT
Repository
github
Last release
3 months ago

@ant-design/charts

A React chart library, based on G2Plot, G6, X6, L7Plot.

build npm npm GitHub stars npm License

Case

Statistical charts

Flowchart

Maps

Relation Graphs

✨ Features

  • Easy to use
  • TypeScript
  • Pretty & Lightweight
  • Responsive
  • Storytelling

📦 Installation

$ npm install @ant-design/charts

🔨 Usage

import React from 'react';
import { Line } from '@ant-design/charts';

const Page: React.FC = () => {
  const data = [
    { year: '1991', value: 3 },
    { year: '1992', value: 4 },
    { year: '1993', value: 3.5 },
    { year: '1994', value: 5 },
    { year: '1995', value: 4.9 },
    { year: '1996', value: 6 },
    { year: '1997', value: 7 },
    { year: '1998', value: 9 },
    { year: '1999', value: 13 },
  ];

  const config = {
    data,
    width: 800,
    height: 400,
    autoFit: false,
    xField: 'year',
    yField: 'value',
    point: {
      size: 5,
      shape: 'diamond',
    },
    label: {
      style: {
        fill: '#aaa',
      },
    },
  };

  let chart;

  // Export Image
  const downloadImage = () => {
    chart?.downloadImage();
  };

  // Get chart base64 string
  const toDataURL = () => {
    console.log(chart?.toDataURL());
  };

  return (
    <div>
      <button type="button" onClick={downloadImage} style={{ marginRight: 24 }}>
        Export Image
      </button>
      <button type="button" onClick={toDataURL}>
        Get base64
      </button>
      <Line {...config} onReady={(chartInstance) => (chart = chartInstance)} />
    </div>
  );
};
export default Page;

Preview

📜 Document & API

See chart API for details. Common props:

PropertyDescriptionTypedefaultValue
onReadychart loaded callback(chart)=> void-
onEventchart events(chart, event)=> void-
loadingloading statusboolean-
loadingTemplateloading templateReact.ReactElement-
errorTemplatecustom error template(e: Error) => React.ReactNode-
classNamecontainer classstring-
stylecontainer styleReact.CSSProperties-

🤝 How to Contribute

Your contributions are always welcome! Please Do have a look at the issues first.

📧 Contact us

DingTalk group number: 44788198.

License

MIT

1.4.2

3 months ago

1.4.1

3 months ago

1.4.0

3 months ago

1.3.6

7 months ago

1.3.3-beta.0

10 months ago

1.3.5

8 months ago

1.3.4

9 months ago

1.3.3

10 months ago

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

11 months ago

1.3.0-beta.3

11 months ago

1.2.14

1 year ago

1.2.12

1 year ago

1.2.13

1 year ago

1.2.11

1 year ago

1.2.10

1 year ago

1.2.9

1 year ago

1.2.9-beta.0

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.1-beta.0

1 year ago

1.2.0

1 year ago

1.2.0-beta.0

1 year ago

1.2.0-alapa.0

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.16

1 year ago

1.1.17

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.4-alpha.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18-beta.2

2 years ago

1.0.18

2 years ago

1.0.18-beta.1

2 years ago

1.0.17-beta.1

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15-beta.1

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-beta.2

2 years ago

1.0.0-beta.1

2 years ago

0.9.13

2 years ago

0.9.12

2 years ago

0.9.11

2 years ago

0.9.10

2 years ago

0.9.9-beta.1

2 years ago

0.9.9

2 years ago

0.9.8

2 years ago

0.9.7

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.10.0-beta.0

2 years ago

0.9.4-beta.2

2 years ago

0.9.4-beta.1

2 years ago

0.9.4-beta1

2 years ago

0.9.4-beta

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.3-bata.0

2 years ago

0.9.4-bata.0

2 years ago

0.9.2

2 years ago

0.9.1

3 years ago

0.9.0

3 years ago