Giter Site home page Giter Site logo

散点图中画三根线 about g2 HOT 2 CLOSED

sherlockmisterZ avatar sherlockmisterZ commented on August 28, 2024
散点图中画三根线

from g2.

Comments (2)

sherlockmisterZ avatar sherlockmisterZ commented on August 28, 2024

import { Scatter } from '@ant-design/plots'
import React from 'react'

const data = [
{ x: 1, y: 0 },
{ x: 2, y: 1 },
{ x: 3, y: 1 },
{ x: 4, y: 1 },
{ x: 5, y: 2 },
{ x: 6, y: 3 },
{ x: 7, y: 2 },
{ x: 8, y: -1 },
{ x: 9, y: 0 },
{ x: 10, y: 1 },
{ x: 11, y: 2 },
{ x: 12, y: 2 },
{ x: 13, y: 2 },
{ x: 14, y: 3 },
{ x: 15, y: 2 },
{ x: 16, y: 0 },
{ x: 17, y: -1 },
{ x: 18, y: 2 },
{ x: 19, y: 4 },
{ x: 20, y: 3 },
{ x: 21, y: 0 },
{ x: 22, y: -1 },
{ x: 23, y: 2 },
{ x: 24, y: 2 },
{ x: 25, y: 1 },
{ x: 26, y: -2 },
{ x: 27, y: 1 },
{ x: 28, y: 3 },
{ x: 29, y: 1 },
{ x: 30, y: 2 },
]

const DemoScatter = () => {
const config = {
data,
xField: 'x',
yField: 'y',
sizeField: 5,
style: {
stroke: '#777777',
lineWidth: 1,
fill: '#5B8FF9',
},
line: {
data: [
{ x: 1, y: 2 },
{ x: 30, y: 5 },
{ x: 1, y: 0 },
{ x: 30, y: 2 },
{ x: 1, y: -1 },
{ x: 30, y: 1 },
],
xField: 'x',
yField: 'y',
style: { stroke: '#c7cbc7', lineWidth: 2 },
tooltip: false,
},
}
return <Scatter {...config} />
}

function App() {
return (
<>






</>
)
}

export default App

from g2.

hustcc avatar hustcc commented on August 28, 2024

参考这个 demo:https://g2.antv.antgroup.com/examples/general/link/#link-annotation

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.