recharts

Set height and width for responsive chart using recharts ( Barchart )

落花浮王杯 提交于 2019-12-23 08:38:09
问题 I am trying to use recharts to implement a BarChart. But the width={600} and height={300} causes the Barchart to be absolute, not responsive. How to make the Barchart a responsive one? I tried using percentage as width={'50%"} height={"40%"} but did not work. import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from 'recharts'; <BarChart className="barChart" width={600} height={300} data={data} margin={{top: 5, right: 30, left: 20, bottom: 5}} label="heaf"> <CartesianGrid

React Recharts- getting data from different objects

被刻印的时光 ゝ 提交于 2019-12-23 02:56:18
问题 I am using React Recharts for my visualization, however, I am having a challenge displaying a simple bar chart with different corresponding object contents. [ { "month": "2017-07", "commodities": [ { "name": "wheat", "moves": 100, "avg_weight": 167 }, { "name": "maize", "moves": 150, "avg_weight": 367 }, { "name": "grains", "moves": 89, "avg_weight": 467 } ] }, { "month": "2017-08", "commodities": [ { "name": "mangoes", "moves": 140, "avg_weight": 167 }, { "name": "grains", "moves": 190, "avg

React.Js - rechart zoom IN/OUT and Brush issue

只愿长相守 提交于 2019-12-19 06:45:52
问题 I am using Rechart library and using AreaChartFillByValue. I am facing following issues 1) When I zoom in the chart goes outside the x-axis and when I zoom out it just reset to where it started for example: suppose the current starting point is 1 to 15 but actual data is 30 and when I zoom in it shows 5 to 10 value in x-axis and when I zoom it takes back to 1 to 15 value. I want it should zoom till the entire data display from 1 to 30. 2) When I zoom in brush should zoom out and show the

Recharts Skip a Bar

纵饮孤独 提交于 2019-12-12 21:02:21
问题 I have some data that looks like this: [{ a: 15, b: 30, c: 25, d: 12 }, { a: 15, c: 25, d: 12 }] I want to render a barchart that skips the space in between a and c if b is undefined, but will still render b if it is defined. Basically like the two bar chart groups in this image where the orange bar is skipped because there is no data for it 来源: https://stackoverflow.com/questions/49909093/recharts-skip-a-bar

Recharts tooltip with pointer (react,tooltip) - code part

て烟熏妆下的殇ゞ 提交于 2019-12-08 07:31:36
问题 This question is the code for the question posted here:Recharts tooltip with pointer (react,tooltip). The original question: On a line graph trying to display tooltip with pointer that shows dashed lines going to x-axis and y-axis accordingly. The problem is I can use them separately but not together because onMouseMove state interferes with the display of the tooltip. Is there a solution for this? Chart.js import React, { Component } from 'react'; import moment from 'moment'; import './Chart

Recharts component to PNG

▼魔方 西西 提交于 2019-12-04 03:29:51
问题 I currently have a Recharts component that I would like to export as a PNG file. <LineChart id="currentChart" ref={(chart) => this.currentChart = chart} width={this.state.width} height={this.state.height} data={this.testData} margin={{top: 5, right: 30, left: 20, bottom: 5}} > <XAxis dataKey="name"/> <YAxis/> <CartesianGrid strokeDasharray="3 3"/> <Tooltip/> <Legend /> <Line type="monotone" dataKey="pv" stroke="#8884d8" activeDot={{r: 8}}/> <Line type="monotone" dataKey="uv" stroke="#82ca9d"/

installation of package ‘recharts’ had non-zero exit status

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Please help me to install recharts package in R. The result is: installation of package ‘recharts’ had non-zero exit status I am unable to install it. The code from R console is posted below: install.packages('recharts', repos = c('http://yihui.name/xran', 'http://cran.rstudio.com')) Warning in install.packages : cannot open: HTTP status was '404 Not Found' Warning in install.packages : cannot open: HTTP status was '404 Not Found' Warning in install.packages : unable to access index for repository http://yihui.name/xran/bin/windows/contrib/3

Recharts component to PNG

牧云@^-^@ 提交于 2019-12-01 17:48:21
I currently have a Recharts component that I would like to export as a PNG file. <LineChart id="currentChart" ref={(chart) => this.currentChart = chart} width={this.state.width} height={this.state.height} data={this.testData} margin={{top: 5, right: 30, left: 20, bottom: 5}} > <XAxis dataKey="name"/> <YAxis/> <CartesianGrid strokeDasharray="3 3"/> <Tooltip/> <Legend /> <Line type="monotone" dataKey="pv" stroke="#8884d8" activeDot={{r: 8}}/> <Line type="monotone" dataKey="uv" stroke="#82ca9d"/> </LineChart> but I'm unsure if this is directly supported by the library. I have an idea that