Skip to content
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

Frames plotschema for plotly.py v2 #1292

Merged
merged 2 commits into from
Jan 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/plot_api/plot_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ exports.get = function() {

transforms: transforms,

frames: formatAttributes(frameAttributes),
frames: getFramesAttributes(),
animation: formatAttributes(animationAttributes)
};
};
Expand Down Expand Up @@ -309,6 +309,16 @@ function getTransformAttributes(type) {
};
}

function getFramesAttributes() {
var attrs = {
frames: Lib.extendDeep({}, frameAttributes)
};

formatAttributes(attrs);

return attrs.frames;
}

function formatAttributes(attrs) {
mergeValTypeAndRole(attrs);
formatArrayContainers(attrs);
Expand Down
9 changes: 7 additions & 2 deletions src/plots/frame_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
'use strict';

module.exports = {
_isLinkedToArray: 'frames_entry',

group: {
valType: 'string',
role: 'info',
Expand All @@ -23,7 +25,8 @@ module.exports = {
description: 'A label by which to identify the frame'
},
traces: {
valType: 'data_array',
valType: 'any',
role: 'info',
description: [
'A list of trace indices that identify the respective traces in the',
'data attribute'
Expand All @@ -39,14 +42,16 @@ module.exports = {
].join(' ')
},
data: {
valType: 'data_array',
valType: 'any',
role: 'object',
description: [
'A list of traces this frame modifies. The format is identical to the',
'normal trace definition.'
].join(' ')
},
layout: {
valType: 'any',
role: 'object',
description: [
'Layout properties which this frame modifies. The format is identical',
'to the normal layout definition.'
Expand Down
7 changes: 7 additions & 0 deletions test/jasmine/tests/plotschema_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,11 @@ describe('plot schema', function() {
expect(plotSchema.defs.metaKeys)
.toEqual(['_isSubplotObj', '_isLinkedToArray', '_deprecated', 'description', 'role']);
});

it('should list the correct frame attributes', function() {
expect(plotSchema.frames).toBeDefined();
expect(plotSchema.frames.role).toEqual('object');
expect(plotSchema.frames.items.frames_entry).toBeDefined();
expect(plotSchema.frames.items.frames_entry.role).toEqual('object');
Copy link
Contributor

Choose a reason for hiding this comment

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

👌

});
});