| 118 | * beside it, which is why the legend uses point-style swatches. |
| 119 | */ |
| 120 | export function applyChartDefaults(Chart) { |
| 121 | const { defaults } = Chart; |
| 122 | defaults.font.family = |
| 123 | "'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"; |
| 124 | defaults.font.size = 12; |
| 125 | defaults.color = MUTED; |
| 126 | defaults.borderColor = GRID; |
| 127 | defaults.maintainAspectRatio = false; |
| 128 | defaults.animation.duration = 180; |
| 129 | |
| 130 | defaults.plugins.legend.position = 'bottom'; |
| 131 | defaults.plugins.legend.align = 'start'; |
| 132 | defaults.plugins.legend.labels.usePointStyle = true; |
| 133 | defaults.plugins.legend.labels.pointStyle = 'circle'; |
| 134 | defaults.plugins.legend.labels.boxWidth = 8; |
| 135 | defaults.plugins.legend.labels.boxHeight = 8; |
| 136 | defaults.plugins.legend.labels.padding = 14; |
| 137 | defaults.plugins.legend.labels.color = SECONDARY; |
| 138 | |
| 139 | defaults.plugins.tooltip.backgroundColor = INK; |
| 140 | defaults.plugins.tooltip.padding = 10; |
| 141 | defaults.plugins.tooltip.cornerRadius = 0; |
| 142 | defaults.plugins.tooltip.displayColors = true; |
| 143 | defaults.plugins.tooltip.usePointStyle = true; |
| 144 | defaults.plugins.tooltip.boxWidth = 8; |
| 145 | defaults.plugins.tooltip.boxHeight = 8; |
| 146 | |
| 147 | defaults.elements.line.borderWidth = 2; |
| 148 | defaults.elements.line.borderJoinStyle = 'round'; |
| 149 | defaults.elements.line.borderCapStyle = 'round'; |
| 150 | defaults.elements.line.tension = 0; |
| 151 | defaults.elements.point.hoverBorderWidth = 2; |
| 152 | defaults.elements.bar.borderRadius = 4; |
| 153 | defaults.elements.arc.borderColor = SURFACE; |
| 154 | // The 2px surface gap between touching fills — white doing the separating, |
| 155 | // rather than a stroke drawn around each mark. |
| 156 | defaults.elements.arc.borderWidth = 2; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * `ticks` is merged rather than replaced: spreading an override on top would |