Skip to content

Add ability to rename grouped traces #1919

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 19 commits into from
Aug 15, 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
12 changes: 6 additions & 6 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {

for(i = 0; i < dataIn.length; i++) {
trace = dataIn[i];
fullTrace = plots.supplyTraceDefaults(trace, cnt, fullLayout, i, dataIn.length);
fullTrace = plots.supplyTraceDefaults(trace, cnt, fullLayout, i);

fullTrace.index = i;
fullTrace._input = trace;
Expand All @@ -809,7 +809,7 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {

for(var j = 0; j < expandedTraces.length; j++) {
var expandedTrace = expandedTraces[j];
var fullExpandedTrace = plots.supplyTraceDefaults(expandedTrace, cnt, fullLayout, i, dataIn.length);
var fullExpandedTrace = plots.supplyTraceDefaults(expandedTrace, cnt, fullLayout, i);

// The group key gets cleared. If set, pass it forward
if(expandedTrace._group) {
Expand Down Expand Up @@ -945,7 +945,7 @@ plots.supplyFrameDefaults = function(frameIn) {
return frameOut;
};

plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInIndex, inputTraceCount) {
plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInIndex) {
var traceOut = {},
defaultColor = Color.defaults[traceOutIndex % Color.defaults.length];

Expand Down Expand Up @@ -1018,13 +1018,13 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde
traceOut.visible = !!traceOut.visible;
}

plots.supplyTransformDefaults(traceIn, traceOut, layout, inputTraceCount);
plots.supplyTransformDefaults(traceIn, traceOut, layout);
}

return traceOut;
};

plots.supplyTransformDefaults = function(traceIn, traceOut, layout, inputTraceCount) {
plots.supplyTransformDefaults = function(traceIn, traceOut, layout) {
var globalTransforms = layout._globalTransforms || [];
var transformModules = layout._transformModules || [];

Expand All @@ -1043,7 +1043,7 @@ plots.supplyTransformDefaults = function(traceIn, traceOut, layout, inputTraceCo
if(!_module) Lib.warn('Unrecognized transform type ' + type + '.');

if(_module && _module.supplyDefaults) {
transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn, inputTraceCount);
transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn);
transformOut.type = type;
transformOut._module = _module;

Expand Down
4 changes: 2 additions & 2 deletions src/transforms/groupby.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ exports.attributes = {
* @return {object} transformOut
* copy of transformIn that contains attribute defaults
*/
exports.supplyDefaults = function(transformIn, traceOut, layout, traceIn, inputTraceCount) {
exports.supplyDefaults = function(transformIn, traceOut, layout, traceIn) {
var i;
var transformOut = {};

Expand All @@ -113,7 +113,7 @@ exports.supplyDefaults = function(transformIn, traceOut, layout, traceIn, inputT
if(!enabled) return transformOut;

coerce('groups');
coerce('nameformat', inputTraceCount > 1 ? '%g (%t)' : '%g');
coerce('nameformat', layout._dataLength > 1 ? '%g (%t)' : '%g');
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes me very happy.


var nameFormatIn = transformIn.groupnames;
var nameFormatOut = transformOut.groupnames = [];
Expand Down