Skip to content

Add the ability to use aggregate values for box plots #138

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,10 @@ function doCalcdata(gd) {
if (!cd[0].t) cd[0].t = {};
cd[0].trace = trace;

if (trace.calcdataOverride) {
cd[0] = _.defaults(trace.calcdataOverride, cd[0]);
}

Plotly.Lib.markTime('done with calcdata for '+i);
calcdata[i] = cd;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plots/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = {
hoverinfo: {
valType: 'flaglist',
role: 'info',
flags: ['x', 'y', 'z', 'text', 'name'],
flags: ['x', 'y', 'z', 'text', 'name', 'xtext'],
extras: ['all', 'none'],
dflt: 'all',
description: 'Determines which trace information appear on hover.'
Expand Down
2 changes: 1 addition & 1 deletion src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ axes.tickText = function(ax, x, hover){
var first_or_last;

if (showAttr===undefined) return true;
if (hover) return showAttr==='none';
if (hover) return false; // always show tick prefix/suffix on hover, *especially* if showAttr == 'none'

first_or_last = {
first: ax._tmin,
Expand Down
4 changes: 4 additions & 0 deletions src/plots/cartesian/graph_interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ function cleanPoint(d, hovermode) {
else d.xLabel = '-' + xLabelObj.text;
}
else d.xLabel = xLabelObj.text;

if (d.trace.hoverinfo.indexOf("xtext") > -1 && d.text && d.text != "") {
d.xLabel += "<br />" + d.text
}
d.xVal = d.xa.c2d(d.xLabelVal);
}

Expand Down
3 changes: 3 additions & 0 deletions src/traces/box/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,8 @@ module.exports = {
description: 'Sets the width (in px) of line bounding the box(es).'
}
},
calcdataOverride: {
valType: 'any',
},
fillcolor: scatterAttrs.fillcolor
};
1 change: 1 addition & 0 deletions src/traces/box/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ boxes.supplyDefaults = function(traceIn, traceOut, defaultColor) {

coerce('whiskerwidth');
coerce('boxmean');
coerce('calcdataOverride');

var outlierColorDflt = Plotly.Lib.coerce2(traceIn, traceOut, boxes.attributes, 'marker.outliercolor'),
lineoutliercolor = coerce('marker.line.outliercolor'),
Expand Down