Skip to content

Commit f869b1f

Browse files
committed
Extract the default values for width/height onto the config object
1 parent 36f3e3d commit f869b1f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pygal.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export const config = {
22
renderChart: (chart) => { throw new Error("The config.renderChart function has not been set for pygal."); }
3+
availableWidth: 400,
4+
availableHeight: 300,
35
};
46

57
const COLORS = [
@@ -69,8 +71,8 @@ class Chart {
6971
});
7072
}
7173

72-
const defaultWidth = config.availableWidth || 400;
73-
const defaultHeight = Math.min(defaultWidth, config.availableHeight || 300);
74+
const defaultWidth = config.availableWidth;
75+
const defaultHeight = Math.min(defaultWidth, config.availableHeight);
7476

7577
let chart = {
7678
chart: {

0 commit comments

Comments
 (0)