-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotlyTheme.js
More file actions
62 lines (58 loc) · 1.7 KB
/
Copy pathplotlyTheme.js
File metadata and controls
62 lines (58 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Plotly layout/config factory enforcing the design system on every chart.
// See DESIGN_SYSTEM.md section 6.
import { C } from "./theme.js";
const FONT = '"Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif';
export function baseLayout(overrides = {}) {
const layout = {
font: { family: FONT, size: 12.5, color: C.ink },
paper_bgcolor: "rgba(0,0,0,0)",
plot_bgcolor: "rgba(0,0,0,0)",
margin: { l: 56, r: 18, t: 12, b: 44 },
colorway: ["#0099cc", "#003366", "#006699", "#7fb2d9", "#b3c7e6"],
hoverlabel: {
bgcolor: C.white,
bordercolor: C.mist,
font: { family: FONT, size: 12.5, color: C.ink },
align: "left",
},
hovermode: "closest",
legend: {
orientation: "h",
x: 0,
y: 1.12,
font: { size: 12, color: C.inkMuted },
bgcolor: "rgba(0,0,0,0)",
},
xaxis: axis(),
yaxis: axis(),
...overrides,
};
// deep-merge axis overrides if caller passed partial axes
if (overrides.xaxis) layout.xaxis = { ...axis(), ...overrides.xaxis };
if (overrides.yaxis) layout.yaxis = { ...axis(), ...overrides.yaxis };
return layout;
}
export function axis(extra = {}) {
return {
gridcolor: "rgba(179,199,230,0.5)",
zerolinecolor: "rgba(179,199,230,0.9)",
linecolor: C.mist,
tickfont: { size: 11.5, color: C.inkMuted },
titlefont: { size: 13, color: C.ink },
automargin: true,
...extra,
};
}
export const baseConfig = {
displaylogo: false,
responsive: true,
modeBarButtonsToRemove: [
"lasso2d",
"select2d",
"autoScale2d",
"toggleSpikelines",
"hoverClosestCartesian",
"hoverCompareCartesian",
],
toImageButtonOptions: { format: "png", scale: 2 },
};