Skip to content

extend zhoverformat to 2d histogram types #2127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/traces/contour/style_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ var Lib = require('../../lib');


module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, opts) {
if(!opts) opts = {};
var coloring = coerce('contours.coloring');

var showLines;
var lineColor = '';
if(coloring === 'fill') showLines = coerce('contours.showlines');

if(showLines !== false) {
if(coloring !== 'lines') lineColor = coerce('line.color', '#000');
coerce('line.width', 0.5);
if(coloring !== 'lines') lineColor = coerce('line.color', opts.defaultColor || '#000');
coerce('line.width', opts.defaultWidth === undefined ? 0.5 : opts.defaultWidth);
coerce('line.dash');
}

Expand All @@ -45,7 +46,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout,
coerce('contours.labelformat');
}

if(!opts || opts.hasHover !== false) {
if(opts.hasHover !== false) {
coerce('zhoverformat');
// Needed for formatting of hoverlabel if format is not explicitly specified
traceOut._separators = layout.separators;
Expand Down
6 changes: 5 additions & 1 deletion src/traces/contourcarpet/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
// If there's a fill color, use it at full opacity for the line color
var lineDfltColor = traceOut.fillcolor ? addOpacity(traceOut.fillcolor, 1) : defaultColor;

handleStyleDefaults(traceIn, traceOut, coerce, layout, lineDfltColor, 2);
handleStyleDefaults(traceIn, traceOut, coerce, layout, {
hasHover: false,
defaultColor: lineDfltColor,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔈 Shoutout to @rreusser 's numerous carpet image mocks !

defaultWidth: 2
});

if(contours.operation === '=') {
coerce('line.color', defaultColor);
Expand Down