Comments (5)
Hey thanks for the report!
The graph should fill out the whole axis right?
And this happens if you resize the parent component?
I will check it out tomorrow when I am back at work.
from react-d3-components.
Yes, the graph should fill out the whole axis, and yes, it happens when the parent resizes. The axis resizes correctly, but not all the children (which my highlight shows). Thanks.
from react-d3-components.
I am looking at the code here but didn't find anything yet.
BTW did you use the default scales or provide your own ones? I think I found a (not related problem) there too hehe.
Since when you pass a timestamp the problem is fixed that means the data is correct but it doesn't get re-rendered I guess?
Need to find a way to replicate this.
from react-d3-components.
I make my own scales. The graph is actually data from the three last years, where I modify the previous years to set them the same as the latest year, so the scale is always one full year. And yes, the timestamps are correct. If I keep resizing (back to portrait on mobiles for instance) it renders correctly again. The way I've worked around this bug in my current app is I set a timestamp as the key for the graph element, so whenever resize events happens the graph will get recreated (forcefully). I do not currently have a minimal example demonstrating the problem. Not yet at least.
from react-d3-components.
FWIW, here's the actual code that create the structure that is fed straight into LineChart:
createCharts: function(datas, width) {
if (!width)
return null;
let firstSet = datas[0];
let lastSet = datas[datas.length-1];
const rmargin = 0;
const lmargin = 26;
const lastdate = lastSet.values[ lastSet.values.length-1 ].x;
const endDate = new Date(lastdate.getFullYear(), 11, 31, 23, 59, 59);
const startDate = new Date(lastdate.getFullYear(), 0, 1);
let xScale = d3.time.scale().domain([startDate,
endDate])
.range([0, width-lmargin-rmargin]);
let colors = d3.scale.ordinal()
.domain(this.state.chart_wl_keys)
.range(['#ffe0e0', '#ffb0b0', '#ff0000']);
let chart_wl = {
data: datas,
margin: {top: 10, bottom: 50, left: lmargin, right: rmargin},
width: width,
height: 180,
xScale: xScale,
key: (new Date()).getTime(),
stroke: {strokeWidth: '3', strokeLinecap: 'round'},
colorScale: colors,
xAxis: {tickValues: xScale.ticks(d3.time.month, 1),
tickFormat: d3.time.format("%b")}
};
return chart_wl;
},
This gets called after each update with the updated width parameter.
from react-d3-components.
Related Issues (20)
- Feature Suggestion: Having a line when hovering over the chart HOT 1
- Responsive chart HOT 1
- Series colors
- X-axis is not showing in the graph with smaller Y-axis value
- PieChart not rendering HOT 1
- Documentation HOT 1
- Bar Chart Tootlip & tickFormat with image
- dots in tooltip not showing correctlly while hovering HOT 1
- toolTip not working properly on line chart
- Q: Is support react native?
- Is this repo still maintained? HOT 2
- I want to pass xscale value to Bar Chart, how to achieve that!
- PieChart hides label when data is unevenly distributed HOT 4
- Interested to maintain the project HOT 4
- How to customize strokeColor for LineChart? HOT 1
- how to increase column width of barchar and yAix value default like 0 to 100
- How to add stroke color for area chart HOT 1
- NPM vulnerability HOT 1
- 同学,您这个项目引入了615个开源组件,存在27个漏洞,辛苦升级一下
- Integrating D3 into a Vite-TS Project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-d3-components.