Giter Site home page Giter Site logo

Positioning charts about recharts HOT 4 CLOSED

recharts avatar recharts commented on May 22, 2024
Positioning charts

from recharts.

Comments (4)

xile611 avatar xile611 commented on May 22, 2024 3

@kennetpostigo
I think you should set the cx, cy, innerRadius, outerRadius of RadarChart and RadialBarChart to be a percent value.

<ResponsiveContainer  width='100%' height='100%'>
        <AreaChart className="area" data={data}
              margin={{top: 10, right: 30, left: 0, bottom: 0}}>
            <XAxis dataKey="name"/>
            <YAxis/>
            <CartesianGrid strokeDasharray="3 3"/>
            <Tooltip/>
            <Area type='monotone' dataKey='uv' stackId="1" stroke='#8884d8' fill='#8884d8' />
            <Area type='monotone' dataKey='pv' stackId="1" stroke='#82ca9d' fill='#82ca9d' />
            <Area type='monotone' dataKey='amt' stackId="1" stroke='#ffc658' fill='#ffc658' />
        </AreaChart>
      </ResponsiveContainer>

      <ResponsiveContainer width='100%' height='100%'>
        <RadialBarChart className="radial" cx="50%" cy="70%" innerRadius="20%" outerRadius="80%" data={data2}>
          <RadialBar minAngle={15} label background clockWise={true} dataKey='uv'/>
          <Legend iconSize={10} width={90} height={140} layout='vertical' verticalAlign='middle' wrapperStyle={style}/>
        </RadialBarChart>
      </ResponsiveContainer>

      <ResponsiveContainer width='100%' height='100%'>
        <RadarChart className="radar" cx="50%" cy="50%" outerRadius="80%" data={data3}>
            <Radar name="Mike" dataKey="A" stroke="#8884d8" fill="#8884d8" fillOpacity={0.6}/>
            <Radar name="Lily" dataKey="B" stroke="#82ca9d" fill="#82ca9d" fillOpacity={0.6}/>
            <PolarGrid />
            <Legend />
            <PolarAngleAxis dataKey="subject" />
            <PolarRadiusAxis angle={30} domain={[0, 150]}/>
          </RadarChart>
      </ResponsiveContainer>
    </div>

You can see the demo.

from recharts.

Cloudo avatar Cloudo commented on May 22, 2024

@kennetpostigo can you show some code?

from recharts.

kennetpostigo avatar kennetpostigo commented on May 22, 2024

I have the following:

    <div className="DashCharts">
      <ResponsiveContainer  width='100%' height='100%'>
        <AreaChart className="area" data={data}
              margin={{top: 10, right: 30, left: 0, bottom: 0}}>
            <XAxis dataKey="name"/>
            <YAxis/>
            <CartesianGrid strokeDasharray="3 3"/>
            <Tooltip/>
            <Area type='monotone' dataKey='uv' stackId="1" stroke='#8884d8' fill='#8884d8' />
            <Area type='monotone' dataKey='pv' stackId="1" stroke='#82ca9d' fill='#82ca9d' />
            <Area type='monotone' dataKey='amt' stackId="1" stroke='#ffc658' fill='#ffc658' />
        </AreaChart>
      </ResponsiveContainer>

      <ResponsiveContainer width='100%' height='100%'>
        <RadialBarChart className="radial" cx={150} cy={150} innerRadius={20} outerRadius={140} barSize={10} data={data2}>
          <RadialBar minAngle={15} label background clockWise={true} dataKey='uv'/>
          <Legend iconSize={10} width={90} height={140} layout='vertical' verticalAlign='middle' wrapperStyle={style}/>
        </RadialBarChart>
      </ResponsiveContainer>

      <ResponsiveContainer width='100%' height='100%'>
        <RadarChart className="radar" cx={300} cy={250} outerRadius={90} data={data3}>
            <Radar name="Mike" dataKey="A" stroke="#8884d8" fill="#8884d8" fillOpacity={0.6}/>
            <Radar name="Lily" dataKey="B" stroke="#82ca9d" fill="#82ca9d" fillOpacity={0.6}/>
            <PolarGrid />
            <Legend />
            <PolarAngleAxis dataKey="subject" />
            <PolarRadiusAxis angle={30} domain={[0, 150]}/>
          </RadarChart>
      </ResponsiveContainer>
    </div>

from recharts.

kennetpostigo avatar kennetpostigo commented on May 22, 2024

Okay thank you!

from recharts.

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.