Smoothing & rounding edges
Line charts
Line charts can be smoothed by setting the lineTension attribute on the dataset. For example:
{
data: {
datasets: [
{
// ...
lineTension: 0.4,
},
];
}
}
Bar charts
A built-in plugin is available to users who want to round the corners of their bar charts. To round corners, set options.plugins.roundedBars to true:
{
// ...
options: {
plugins: {
roundedBars: true,
},
},
}
This rounds the end of each bar and works with Chart.js v2, v3, and v4. Use the cornerRadius property to set the radius in pixels (the default is 10), and allCorners to also round the base of each bar:
{
// ...
options: {
plugins: {
roundedBars: {
cornerRadius: 20,
allCorners: true,
},
},
},
}
In Chart.js v3 and v4 you can also set the borderRadius dataset property directly, which overrides roundedBars for that dataset.
Data smoothing techniques
Methods such as exponential smoothing, moving averages, weighted averages, etc, are sometimes used in statistics and data analysis to remove noise from data.
There are two ways to display smoothed data in QuickChart:
-
Perform smoothing on your data beforehand, and then pass smoothed data to QuickChart. This means you take care of smoothing however you like, on your side.
-
Smooth the data directly in the QuickChart configuration. QuickChart supports Javascript, so you can program smoothing logic directly into the configuration: