问题标签 [react-d3]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1203 浏览

d3.js - 将 react-d3 添加到我的 react-native 应用程序会导致错误

我对 很陌生reactJS,并且刚刚开始使用react-native

react-d3使用 npm install --save-dev react-d3 添加,但是当我刷新或重建应用程序时,我得到:

react-d3如果我从库中删除或卸载它工作正常。

谢谢

0 投票
6 回答
25028 浏览

javascript - Upgrading React to 0.13.2 causes: "Uncaught TypeError: Cannot read property '_currentElement' of null"

I upgraded my React version from 0.12.2 to 0.13.2 and my React-Router from 0.12.4 to 0.13.2. Doing just those two upgrades and nothing else, I now get the following error when I load my webpage/app:

Any ideas what might be causing this? I have seem some references to a potential React-Router bug, but nothing definitive.

The specific line that causes the error is:

Update 1: I also just upgraded reactify from version 1.0.0 to 1.1.0 and react-router-bootstrap (which I'm not actually using yet) from 0.9.1 to 0.13.0 based on @BinaryMuse's comments - no change.

Update 2: After further testing, I have narrowed this down to an issue with react-d3. Disabling the react-d3 code from my site causes the error to go away. I am removing the routing code to make the post more concise since I am now fairly confident that react-router is not causing this issue.

Update 3: Thanks to @CoryDanielson for creating the new tag for react-d3.

package.json

0 投票
1 回答
1082 浏览

svg - React D3 x 轴文本倾斜 - 如何访问变换属性?勾选格式?

我在 React-D3 中使用条形图:

我的 x 轴标签相互碰撞,我想旋转它们以提高可读性,

没有 React 渲染的 D3 在这里解决了一个问题: http ://www.d3noob.org/2013/01/how-to-rotate-text-labels-for-x-axis-of.html

如何将此解决方案放入 React-D3 包中?

我在哪里可以访问“text”或“tick”上的“transform”属性?

我试图在 BarChart.js 上将道具作为“xAxisTransform”传递,但它没有注册。

我应该使用 tickFormat 函数来更改刻度上的文本,如果是,如何?

可以/应该从 /common/axes/AxisTicks.js 操作刻度吗? https://github.com/esbullington/react-d3/issues/162

0 投票
1 回答
74 浏览

javascript - 无法弄清楚如何自定义基于 D3 的绘图

我正在使用 react-d3 制作散点图,因为 Plotly 的反应包装器出现错误。我在使用 d3 时遇到问题,因为我无法弄清楚 api。在react-d3 网站上,您可以看到他们是如何制作散点图的,并且我可以使用它,但我无法发现还有哪些其他属性。例如,有没有办法为点设置悬停工具提示,以便可以看到 x、y 和文本值?那张图表的圆点颜色怎么样?

0 投票
2 回答
155 浏览

javascript - ReactD3:在 reactD3Basic 对象中找不到系列属性

我正在尝试在我的项目中使用 reactd3 库。我得到一个错误:

在行中(在库代码中):

因为_reactD3Basic不包含属性系列。你能帮助我吗?为什么?

0 投票
1 回答
3944 浏览

d3.js - 甘特图 react-d3

这个问题与带有 D3 的甘特图
有关我看到在https://www.angular-gantt.com/demo/
AngularJS有一个非常接近的实现。React 中有没有等价物?我检查了http://www.reactd3.org/https://github.com/FormidableLabs/victory但目前没有任何东西可以无缝地具有甘特图功能。
用 React 解决这个问题的最好方法是什么。可折叠的行和画笔是 Angular Gantt 中的吸引人的特征。
这 - http://bl.ocks.org/dk8996/5538271是我得到的最接近的,但我只是想确保在我选择使用它之前没有 React 实现。

0 投票
1 回答
197 浏览

javascript - React d3 - How to: Several ares on one line chart

I am using d3 library in react.js.

I have a line chart, which I would like to divide in three different colored areas, as shown in the picture. For example if I set the treshold of 2000, then Are should be painted in green. same goes for blue and its treshold. Once I get it to paint with the hard coded values, then I will need to implement a slider and do it a bit more dynamic, but I guess that is easy as soo as I figure out how to implement this Area coloring.enter image description here

This is the initial code that I have:

And preparation:

And data:

I imagine I need to add properties to my data model with the color zone, but that is where I am lost...

After implementing areas, they are displayed as seen in the image.enter image description here

But how can I make it display all the way to the top, and there should be no gradual decline. It should be streight line, like on the previous picture?

0 投票
1 回答
1970 浏览

d3.js - 在 React 中使 SVG 具有响应性

我正在开发一个响应式实用程序组件,以使一些 D3 组件响应响应。然而,我对 SVG 的深厚知识却让我无法理解。我已经在 github上基于这个问题提供了我的响应式实用程序。然而它并不能很好地工作,它所做的只是渲染一个图表,但不是在widthheight传入,而是在一个非常小的宽度和高度。它也不会调整大小。

0 投票
0 回答
601 浏览

javascript - 使用 react-d3-basic 创建带有月份的条形图

我无法创建在 xScale 上显示月份和在 yTicks 上显示美元的条形图。我想显示某某月的销售额。

所以我需要解决的问题是:

a- 将 xScale 设置为月份字符串 - 'jan, feb etc....'

b- 将 y 设置为以数百或数千为增量使用美元。

这是我的代码:

正如您在我的代码中看到的,如果我在 xScale 中使用月份字符串,我的订单不会被读取。

现在我有一个看起来很丑的图表,看起来像这样...... 在此处输入图像描述

0 投票
1 回答
185 浏览

reactjs - 无法以 unix 时间格式解析日期

我对编码非常陌生,并且在使用 react-d3 库制作 LineTooltip 时卡在了某个地方。我正在获取时间 unix 时间格式,例如:json 中的 1450274696000 并且需要解析它并在 x 轴上显示 d,m 我正在使用这个函数:

并将 linetooltip 称为

请帮帮我!...在此先感谢