Add padding to chart
See original GitHub issueHi guys
I’m trying to add a padding in the chart. I changed the global config like mentioned in #44 in my component file but still not working.
import { Pie, defaults } from 'react-chartjs-2';
import { merge } from 'lodash';
merge(defaults, {
global: {
layout: {
padding: 25,
},
},
});
...
<Pie data={ chartData } options={ chartOptions } height={ 300 } />
I printed the object defaults and the property is changed there, but my charts still look the same thing.
Can anyone help me with this, please? I didn’t figure out what is going wrong Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
Padding
Let's say you wanted to add 50px of padding to the left side of the chart canvas, you would do: let chart =...
Read more >chartjs - top and bottom padding of a chart area
There are a few ways to control padding between scales/legends in chart.js (some official ways documented in the docs and some "hacky" ways ......
Read more >padding - Sets Padding For Chart Title
This property allows you to set the padding for Chart Title. ... Padding can also be an object containing top, right, bottom and...
Read more >Chart Styling - Margin and Padding
padding property can be used to apply a top, right, bottom, left padding to the chart. This defines the spacing around the viewport...
Read more >Chart Paddings and Margins
For a line/area chart, canvas padding is the space between the canvas border and the position where the line/area chart begins. Specify the...
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
Wait… wait… I lied. Apparently I need more coffee 😃
Just getting back into things here: I was able add padding by simply passing the following in without actually merging the default values.
Does that work for you?