MCPcopy Create free account
hub / github.com/plotly/plotly.js / handleAxisDefaults

Function handleAxisDefaults

src/plots/ternary/layout_defaults.js:61–125  ·  view source on GitHub ↗
(containerIn, containerOut, options, ternaryLayoutOut)

Source from the content-addressed store, hash-verified

59}
60
61function handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut) {
62 var axAttrs = layoutAttributes[containerOut._name];
63
64 function coerce(attr, dflt) {
65 return Lib.coerce(containerIn, containerOut, axAttrs, attr, dflt);
66 }
67
68 coerce('uirevision', ternaryLayoutOut.uirevision);
69
70 containerOut.type = 'linear'; // no other types allowed for ternary
71
72 var dfltColor = coerce('color');
73 // if axis.color was provided, use it for fonts too; otherwise,
74 // inherit from global font color in case that was provided.
75 var dfltFontColor = (dfltColor !== axAttrs.color.dflt) ? dfltColor : options.font.color;
76
77 var axName = containerOut._name;
78 var letterUpper = axName.charAt(0).toUpperCase();
79 var dfltTitle = 'Component ' + letterUpper;
80
81 var title = coerce('title.text', dfltTitle);
82 containerOut._hovertitle = title === dfltTitle ? title : letterUpper;
83
84 Lib.coerceFont(coerce, 'title.font', options.font, { overrideDflt: {
85 size: Lib.bigFont(options.font.size),
86 color: dfltFontColor
87 }});
88
89 // range is just set by 'min' - max is determined by the other axes mins
90 coerce('min');
91
92 handleTickValueDefaults(containerIn, containerOut, coerce, 'linear');
93 handlePrefixSuffixDefaults(containerIn, containerOut, coerce, 'linear');
94 handleTickLabelDefaults(containerIn, containerOut, coerce, 'linear', {
95 noAutotickangles: true,
96 noTicklabelshift: true,
97 noTicklabelstandoff: true
98 });
99 handleTickMarkDefaults(containerIn, containerOut, coerce,
100 { outerTicks: true });
101
102 var showTickLabels = coerce('showticklabels');
103 if(showTickLabels) {
104 Lib.coerceFont(coerce, 'tickfont', options.font, { overrideDflt: {
105 color: dfltFontColor
106 }});
107 coerce('tickangle');
108 coerce('tickformat');
109 }
110
111 handleLineGridDefaults(containerIn, containerOut, coerce, {
112 dfltColor: dfltColor,
113 bgColor: options.bgColor,
114 // default grid color is darker here (60%, vs cartesian default ~91%)
115 // because the grid is not square so the eye needs heavier cues to follow
116 blend: 60,
117 showLine: true,
118 showGrid: true,

Callers 3

handleTernaryDefaultsFunction · 0.70
axis_defaults.jsFile · 0.50
layout_defaults.jsFile · 0.50

Calls 1

coerceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…