'use strict'; var Lib = require('../../lib'); // arrayOk attributes, merge them into calcdata array module.exports = function arraysToCalcdata(cd, trace) { // so each point knows which index it originally came from for(var i = 0; i < cd.length; i++) cd[i].i = i; Lib.mergeArray(trace.text, cd, 'tx'); Lib.mergeArray(trace.texttemplate, cd, 'txt'); Lib.mergeArray(trace.hovertext, cd, 'htx'); Lib.mergeArray(trace.customdata, cd, 'data'); Lib.mergeArray(trace.textposition, cd, 'tp'); if(trace.textfont) { Lib.mergeArrayCastPositive(trace.textfont.size, cd, 'ts'); Lib.mergeArray(trace.textfont.color, cd, 'tc'); Lib.mergeArray(trace.textfont.family, cd, 'tf'); Lib.mergeArray(trace.textfont.weight, cd, 'tw'); Lib.mergeArray(trace.textfont.style, cd, 'ty'); Lib.mergeArray(trace.textfont.variant, cd, 'tv'); Lib.mergeArray(trace.textfont.textcase, cd, 'tC'); Lib.mergeArray(trace.textfont.lineposition, cd, 'tE'); Lib.mergeArray(trace.textfont.shadow, cd, 'tS'); } var marker = trace.marker; if(marker) { Lib.mergeArrayCastPositive(marker.size, cd, 'ms'); Lib.mergeArrayCastPositive(marker.opacity, cd, 'mo'); Lib.mergeArray(marker.symbol, cd, 'mx'); Lib.mergeArray(marker.angle, cd, 'ma'); Lib.mergeArray(marker.standoff, cd, 'mf'); Lib.mergeArray(marker.color, cd, 'mc'); var markerLine = marker.line; if(marker.line) { Lib.mergeArray(markerLine.color, cd, 'mlc'); Lib.mergeArrayCastPositive(markerLine.width, cd, 'mlw'); } var markerGradient = marker.gradient; if(markerGradient && markerGradient.type !== 'none') { Lib.mergeArray(markerGradient.type, cd, 'mgt'); Lib.mergeArray(markerGradient.color, cd, 'mgc'); } } };