|
6 | 6 | * LICENSE file in the root directory of this source tree. |
7 | 7 | */ |
8 | 8 |
|
9 | | - |
10 | 9 | 'use strict'; |
11 | 10 |
|
12 | 11 | var d3 = require('d3'); |
@@ -483,6 +482,10 @@ plots.supplyDefaults = function(gd, opts) { |
483 | 482 | oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); |
484 | 483 | } |
485 | 484 |
|
| 485 | + |
| 486 | + // fill in meta helpers |
| 487 | + fillMetaTextHelpers(newFullData, newFullLayout); |
| 488 | + |
486 | 489 | // relink functions and _ attributes to promote consistency between plots |
487 | 490 | relinkPrivateKeys(newFullLayout, oldFullLayout); |
488 | 491 |
|
@@ -698,6 +701,39 @@ function getFormatter(formatObj, separators) { |
698 | 701 | return d3.locale(formatObj); |
699 | 702 | } |
700 | 703 |
|
| 704 | +function fillMetaTextHelpers(newFullData, newFullLayout) { |
| 705 | + var _meta; |
| 706 | + var meta4data = []; |
| 707 | + |
| 708 | + if(newFullLayout.meta) { |
| 709 | + _meta = newFullLayout._meta = {}; |
| 710 | + _meta.meta = newFullLayout.meta; |
| 711 | + _meta.layout = {meta: newFullLayout.meta}; |
| 712 | + } |
| 713 | + |
| 714 | + for(var i = 0; i < newFullData.length; i++) { |
| 715 | + var trace = newFullData[i]; |
| 716 | + |
| 717 | + if(trace.meta) { |
| 718 | + meta4data[trace.index] = {meta: trace.meta}; |
| 719 | + } |
| 720 | + |
| 721 | + trace._meta = { |
| 722 | + meta: Lib.extendFlat({}, newFullLayout.meta || {}, trace.meta) |
| 723 | + }; |
| 724 | + if(newFullLayout.meta) { |
| 725 | + trace._meta.layout = {meta: newFullLayout.meta}; |
| 726 | + } |
| 727 | + } |
| 728 | + |
| 729 | + if(meta4data.length) { |
| 730 | + if(!_meta) { |
| 731 | + _meta = newFullLayout._meta = {}; |
| 732 | + } |
| 733 | + _meta.data = meta4data; |
| 734 | + } |
| 735 | +} |
| 736 | + |
701 | 737 | // Create storage for all of the data related to frames and transitions: |
702 | 738 | plots.createTransitionData = function(gd) { |
703 | 739 | // Set up the default keyframe if it doesn't exist: |
@@ -1236,6 +1272,7 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac |
1236 | 1272 | if(visible) { |
1237 | 1273 | coerce('customdata'); |
1238 | 1274 | coerce('ids'); |
| 1275 | + coerce('meta'); |
1239 | 1276 |
|
1240 | 1277 | if(Registry.traceIs(traceOut, 'showLegend')) { |
1241 | 1278 | traceOut._dfltShowLegend = true; |
|
0 commit comments