From 3335632573a824445bbd1f87e67b3fd643019489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 11 Jan 2017 10:29:08 -0500 Subject: [PATCH 1/2] modify frames plotschema for plotly.py v2 --- src/plot_api/plot_schema.js | 12 +++++++++++- src/plots/frame_attributes.js | 9 +++++++-- test/jasmine/tests/plotschema_test.js | 7 +++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/plot_api/plot_schema.js b/src/plot_api/plot_schema.js index 2be7c505d0b..2075674108a 100644 --- a/src/plot_api/plot_schema.js +++ b/src/plot_api/plot_schema.js @@ -69,7 +69,7 @@ exports.get = function() { transforms: transforms, - frames: formatAttributes(frameAttributes), + frames: getFramesAttributes(), animation: formatAttributes(animationAttributes) }; }; @@ -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); diff --git a/src/plots/frame_attributes.js b/src/plots/frame_attributes.js index 494851379e6..0f202c33b0e 100644 --- a/src/plots/frame_attributes.js +++ b/src/plots/frame_attributes.js @@ -9,6 +9,8 @@ 'use strict'; module.exports = { + _isLinkedToArray: 'frames_entry', + group: { valType: 'string', role: 'info', @@ -23,7 +25,8 @@ module.exports = { description: 'A label by which to identify the frame' }, traces: { - valType: 'data_array', + valType: 'info_array', + role: 'info', description: [ 'A list of trace indices that identify the respective traces in the', 'data attribute' @@ -39,7 +42,8 @@ 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.' @@ -47,6 +51,7 @@ module.exports = { }, layout: { valType: 'any', + role: 'object', description: [ 'Layout properties which this frame modifies. The format is identical', 'to the normal layout definition.' diff --git a/test/jasmine/tests/plotschema_test.js b/test/jasmine/tests/plotschema_test.js index 30523b88f33..b7b227bc8a0 100644 --- a/test/jasmine/tests/plotschema_test.js +++ b/test/jasmine/tests/plotschema_test.js @@ -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'); + }); }); From 124da94d7534d4d946d06df58e9be8984557f1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 11 Jan 2017 11:17:05 -0500 Subject: [PATCH 2/2] make frame 'traces' attribute an 'any' valType - 'traces' isn't completely compatible with the current 'info_array' coerce function. --- src/plots/frame_attributes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plots/frame_attributes.js b/src/plots/frame_attributes.js index 0f202c33b0e..cfb57e1b689 100644 --- a/src/plots/frame_attributes.js +++ b/src/plots/frame_attributes.js @@ -25,7 +25,7 @@ module.exports = { description: 'A label by which to identify the frame' }, traces: { - valType: 'info_array', + valType: 'any', role: 'info', description: [ 'A list of trace indices that identify the respective traces in the',