Bar width for BarChart has wrong width until something triggers re-render
See original GitHub issueHello,
I have following data and chart:
const platformProductData = {
keys: ['CPU', 'Storage', 'Hosting', 'Email'],
chartData: [
{
platform: 'Plesk',
CPU: 2000,
Storage: 1000,
Hosting: 1500,
Email: 1500
},
{
platform: 'Odin',
CPU: 1000,
Storage: 800,
Hosting: 1500,
Email: 3000
},
{
platform: 'Interworks',
CPU: 1000,
Storage: 3000,
Hosting: 2500,
Email: 1800
}
]
};
<ResponsiveBar
theme={chartTheme}
data={data.chartData}
keys={data.keys}
indexBy={indexBy}
padding={0.2}
margin={{ top: 10, right: 10, bottom: 70, left: 10 }}
valueFormat=" >-$.2d"
colors={{ scheme: 'blue_green' }}
borderColor={{
from: 'color',
modifiers: [['darker', 1.6]]
}}
labelTextColor={{
from: 'color',
modifiers: [['darker', 1.6]]
}}
legends={[
{
dataFrom: 'keys',
anchor: 'bottom',
direction: 'row',
justify: false,
translateX: 0,
translateY: 70,
itemsSpacing: 2,
itemWidth: 100,
itemHeight: 20,
itemDirection: 'left-to-right',
itemOpacity: 0.85,
symbolSize: 20,
effects: [
{
on: 'hover',
style: {
itemOpacity: 1
}
}
]
}
]}
/>
The issue I’m facing is that bar widths are not rendered correctly until some trigger is not fired which affects their state (like changing application theme mode from light to dark through UI or changing data through code). Any suggestions? I’m using a lot of different charts on that page (sunburst, chord…) and they do not show this behavior, however, both bar charts on the page are having this issue. Data are fake and local, they are not rendered from server if that helps. Images are attached
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:8 (1 by maintainers)
Top Results From Across the Web
SSRS bar/range chart rendering incorrectly when amount of ...
We're experiencing some problems using a bar/range chart in SSRS. ... The report shows the performance data for a specific machine.
Read more >reportviewer bar chart, bar width incorrect - sql - Stack Overflow
The problem is that the bars are wider then they should be. Each bar should be as width as 1 hour. The x-axis...
Read more >Charts aren't full-size until page is refreshed - CanvasJS.com
I'm using some charts in a 3dcart-hosted site. When the page is first loaded, the charts don't load full-size.
Read more >Visualization: Pie Chart - Google Developers
Width of the third bar in the first series of a bar or column chart: cli.getBoundingBox('bar#0#2').width; Bounding box of the fifth wedge of...
Read more >Bar Charts: The Good, the Bad, and the Ugly - Biztory
With powerful visual analytics tools at the ready, we're capable of building dashboards at high speed and with great diversity in terms of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Had the same problem, but fixed it by setting
animate={false}
In the meantime, this is helping me getting fully rendered chart, just put it on the page where you are using your barchart (you will even get animated render 💯 :