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

Function handleTernaryDefaults

src/plots/ternary/layout_defaults.js:27–59  ·  view source on GitHub ↗
(ternaryLayoutIn, ternaryLayoutOut, coerce, options)

Source from the content-addressed store, hash-verified

25};
26
27function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, options) {
28 var bgColor = coerce('bgcolor');
29 var sum = coerce('sum');
30 options.bgColor = Color.combine(bgColor, options.paper_bgcolor);
31 var axName, containerIn, containerOut;
32
33 // TODO: allow most (if not all) axis attributes to be set
34 // in the outer container and used as defaults in the individual axes?
35
36 for(var j = 0; j < axesNames.length; j++) {
37 axName = axesNames[j];
38 containerIn = ternaryLayoutIn[axName] || {};
39 containerOut = Template.newContainer(ternaryLayoutOut, axName);
40 containerOut._name = axName;
41
42 handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut);
43 }
44
45 // if the min values contradict each other, set them all to default (0)
46 // and delete *all* the inputs so the user doesn't get confused later by
47 // changing one and having them all change.
48 var aaxis = ternaryLayoutOut.aaxis;
49 var baxis = ternaryLayoutOut.baxis;
50 var caxis = ternaryLayoutOut.caxis;
51 if(aaxis.min + baxis.min + caxis.min >= sum) {
52 aaxis.min = 0;
53 baxis.min = 0;
54 caxis.min = 0;
55 if(ternaryLayoutIn.aaxis) delete ternaryLayoutIn.aaxis.min;
56 if(ternaryLayoutIn.baxis) delete ternaryLayoutIn.baxis.min;
57 if(ternaryLayoutIn.caxis) delete ternaryLayoutIn.caxis.min;
58 }
59}
60
61function handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut) {
62 var axAttrs = layoutAttributes[containerOut._name];

Callers

nothing calls this directly

Calls 2

coerceFunction · 0.70
handleAxisDefaultsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…