diff --git a/lib/index-strict.js b/lib/index-strict.js index cac9738bff8..c5d1c092056 100644 --- a/lib/index-strict.js +++ b/lib/index-strict.js @@ -52,6 +52,7 @@ Plotly.register([ require('../src/traces/scatterpolargl/strict'), require('./barpolar'), require('./scattersmith'), + require('./quiver'), // components require('./calendars'), diff --git a/lib/index.js b/lib/index.js index d4cb5bdcc87..73f4f0a29b8 100644 --- a/lib/index.js +++ b/lib/index.js @@ -52,6 +52,7 @@ Plotly.register([ require('./scatterpolargl'), require('./barpolar'), require('./scattersmith'), + require('./quiver'), // components require('./calendars'), diff --git a/lib/quiver.js b/lib/quiver.js new file mode 100644 index 00000000000..12179a54900 --- /dev/null +++ b/lib/quiver.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../src/traces/quiver'); diff --git a/src/traces/quiver/attributes.js b/src/traces/quiver/attributes.js new file mode 100644 index 00000000000..88eb603a999 --- /dev/null +++ b/src/traces/quiver/attributes.js @@ -0,0 +1,258 @@ +'use strict'; + +var baseAttrs = require('../../plots/attributes'); +var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; +var fontAttrs = require('../../plots/font_attributes'); +var dash = require('../../components/drawing/attributes').dash; + +var extendFlat = require('../../lib/extend').extendFlat; +var colorScaleAttrs = require('../../components/colorscale/attributes'); + +var attrs = { + x: { + valType: 'data_array', + editType: 'calc+clearAxisTypes', + anim: true, + description: 'Sets the x coordinates of the arrow locations.' + }, + y: { + valType: 'data_array', + editType: 'calc+clearAxisTypes', + anim: true, + description: 'Sets the y coordinates of the arrow locations.' + }, + u: { + valType: 'data_array', + editType: 'calc', + anim: true, + description: 'Sets the x components of the arrow vectors.' + }, + v: { + valType: 'data_array', + editType: 'calc', + anim: true, + description: 'Sets the y components of the arrow vectors.' + }, + // Optional scalar field used for colorscale mapping. If omitted, |(u,v)| is used. + c: { + valType: 'data_array', + editType: 'calc', + anim: true, + description: 'Sets the scalar values used to map colors via the colorscale. If not provided, the magnitude sqrt(u^2 + v^2) is used.' + }, + sizemode: { + valType: 'enumerated', + values: ['scaled', 'absolute', 'raw'], + editType: 'calc', + dflt: 'scaled', + description: [ + 'Determines whether `sizeref` is set as a *scaled* (unitless) scalar', + '(normalized by the max u/v norm in the vector field), as an *absolute*', + 'value (in the same units as the vector field), or *raw* to use the', + 'raw vector lengths.' + ].join(' ') + }, + sizeref: { + valType: 'number', + min: 0, + editType: 'calc', + description: [ + 'Adjusts the arrow size scaling.', + 'The arrow length is determined by the vector norm multiplied by `sizeref`,', + 'optionally normalized when `sizemode` is *scaled*.' + ].join(' ') + }, + anchor: { + valType: 'enumerated', + values: ['tip', 'tail', 'cm', 'center', 'middle'], + dflt: 'tail', + editType: 'calc', + description: [ + 'Sets the arrows\' anchor with respect to their (x,y) positions.', + 'Use *tail* to place (x,y) at the base, *tip* to place (x,y) at the head,', + 'or *cm*/*center*/*middle* to center the arrow on (x,y).' + ].join(' ') + }, + hoverdistance: { + valType: 'number', + min: -1, + dflt: 20, + editType: 'calc', + description: 'Maximum distance (in pixels) to look for nearby arrows on hover.' + }, + + // Arrowhead sizing, consistent with annotations API naming + arrowsize: { + valType: 'number', + min: 0.3, + dflt: 1, + editType: 'calc', + description: [ + 'Scales the size of the arrow head relative to a base size.', + 'Higher values produce larger heads.' + ].join(' ') + }, + // Back-compat alias + arrow_scale: { + valType: 'number', + min: 0, + max: 1, + editType: 'calc', + description: 'Deprecated alias for `arrowsize`-based sizing. Prefer using `arrowsize`.' + }, + + // Line styling for arrows + line: { + color: { + valType: 'color', + dflt: '#000', + editType: 'style', + description: 'Sets the color of the arrow lines.' + }, + width: { + valType: 'number', + min: 0, + dflt: 1, + editType: 'style', + description: 'Sets the width (in px) of the arrow lines.' + }, + dash: dash, + shape: { + valType: 'enumerated', + values: ['linear', 'spline', 'hv', 'vh', 'hvh', 'vhv'], + dflt: 'linear', + editType: 'plot', + description: 'Determines the line shape.' + }, + smoothing: { + valType: 'number', + min: 0, + max: 1.3, + dflt: 1, + editType: 'plot', + description: 'Has an effect only if `shape` is set to *spline*. Sets the amount of smoothing.' + }, + simplify: { + valType: 'boolean', + dflt: true, + editType: 'plot', + description: 'Simplifies lines by removing nearly-overlapping points.' + }, + editType: 'style' + }, + + // Alias consistent with annotations; maps to line.width + arrowwidth: { + valType: 'number', + min: 0.1, + editType: 'style', + description: 'Sets the width (in px) of the arrow line (alias of `line.width`).' + }, + + // Text and labels + text: { + valType: 'data_array', + editType: 'calc', + anim: true, + description: 'Sets text elements associated with each (x,y) pair.' + }, + textposition: { + valType: 'enumerated', + values: [ + 'top left', 'top center', 'top right', + 'middle left', 'middle center', 'middle right', + 'bottom left', 'bottom center', 'bottom right' + ], + dflt: 'middle center', + editType: 'calc', + description: 'Sets the positions of the `text` elements with respects to the (x,y) coordinates.' + }, + // Text font + textfont: fontAttrs({ + editType: 'calc', + colorEditType: 'style', + arrayOk: true, + description: 'Sets the text font.' + }), + + // Selection and styling + selected: { + line: { + color: { + valType: 'color', + editType: 'style', + description: 'Sets the line color of selected points.' + }, + width: { + valType: 'number', + min: 0, + editType: 'style', + description: 'Sets the line width of selected points.' + }, + editType: 'style' + }, + textfont: { + color: { + valType: 'color', + editType: 'style', + description: 'Sets the text font color of selected points, applied only when a selection exists.' + }, + editType: 'style' + }, + editType: 'style' + }, + unselected: { + line: { + color: { + valType: 'color', + editType: 'style', + description: 'Sets the line color of unselected points.' + }, + width: { + valType: 'number', + min: 0, + editType: 'style', + description: 'Sets the line width of unselected points.' + }, + editType: 'style' + }, + textfont: { + color: { + valType: 'color', + editType: 'style', + description: 'Sets the text font color of unselected points, applied only when a selection exists.' + }, + editType: 'style' + }, + editType: 'style' + } +}; + +// Extend with base attributes (includes hoverinfo, etc.) +extendFlat(attrs, baseAttrs); + +// Colorscale attributes to color arrows by |(u,v)| magnitude +extendFlat( + attrs, + colorScaleAttrs('', { + colorAttr: 'u/v norm', + showScaleDflt: true, + editTypeOverride: 'calc' + }) +); + +// Add hoverinfo with proper flags for quiver +// We need to create a new object to avoid mutating the shared base attributes +attrs.hoverinfo = extendFlat({}, baseAttrs.hoverinfo, { + flags: ['x', 'y', 'u', 'v', 'text', 'name'], + dflt: 'all' +}); + +// Add hovertemplate +attrs.hovertemplate = extendFlat({}, hovertemplateAttrs({}, { + keys: ['x', 'y', 'u', 'v', 'text', 'name'] +})); + +module.exports = attrs; + + diff --git a/src/traces/quiver/calc.js b/src/traces/quiver/calc.js new file mode 100644 index 00000000000..4484de6960b --- /dev/null +++ b/src/traces/quiver/calc.js @@ -0,0 +1,79 @@ +'use strict'; + +var Lib = require('../../lib'); +var Axes = require('../../plots/cartesian/axes'); +var isNumeric = require('fast-isnumeric'); +var BADNUM = require('../../constants/numerical').BADNUM; +var scatterCalc = require('../scatter/calc'); +var colorscaleCalc = require('../../components/colorscale/calc'); + +/** + * Main calculation function for quiver trace + * Creates calcdata with arrow path data for each vector + */ +module.exports = function calc(gd, trace) { + // Map x/y through axes so category/date values become numeric calcdata + var xa = trace._xA = Axes.getFromId(gd, trace.xaxis || 'x', 'x'); + var ya = trace._yA = Axes.getFromId(gd, trace.yaxis || 'y', 'y'); + + var xVals = xa.makeCalcdata(trace, 'x'); + var yVals = ya.makeCalcdata(trace, 'y'); + + // u/v are read in plot using the original trace arrays via cdi.i + + var len = Math.min(xVals.length, yVals.length); + trace._length = len; + var cd = new Array(len); + + var normMin = Infinity; + var normMax = -Infinity; + var cMin = Infinity; + var cMax = -Infinity; + var hasC = Array.isArray(trace.c); + + for(var i = 0; i < len; i++) { + var cdi = cd[i] = { i: i }; + var xValid = isNumeric(xVals[i]); + var yValid = isNumeric(yVals[i]); + + if(xValid && yValid) { + cdi.x = xVals[i]; + cdi.y = yVals[i]; + } else { + cdi.x = BADNUM; + cdi.y = BADNUM; + } + + // track ranges for colorscale + if(hasC) { + var ci = trace.c[i]; + if(isNumeric(ci)) { + if(ci < cMin) cMin = ci; + if(ci > cMax) cMax = ci; + } + } else { + var ui = (trace.u && trace.u[i]) || 0; + var vi = (trace.v && trace.v[i]) || 0; + var n = Math.sqrt(ui * ui + vi * vi); + if(isFinite(n)) { + if(n < normMin) normMin = n; + if(n > normMax) normMax = n; + } + } + } + + // Ensure axes are expanded and categories registered like scatter traces do + scatterCalc.calcAxisExpansion(gd, trace, xa, ya, xVals, yVals); + + // Colorscale cmin/cmax computation: prefer provided c, else magnitude + var vals = hasC ? [cMin, cMax] : [normMin, normMax]; + colorscaleCalc(gd, trace, { + vals: vals, + containerStr: '', + cLetter: 'c' + }); + + return cd; +}; + + diff --git a/src/traces/quiver/defaults.js b/src/traces/quiver/defaults.js new file mode 100644 index 00000000000..e03df991d97 --- /dev/null +++ b/src/traces/quiver/defaults.js @@ -0,0 +1,90 @@ +'use strict'; + +var Lib = require('../../lib'); +var attributes = require('./attributes'); +var Colorscale = require('../../components/colorscale'); +var colorscaleDefaults = Colorscale.handleDefaults; +var hasColorscale = Colorscale.hasColorscale; + +module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { + // Selection styling - use coerce to set proper defaults + function coerce(attr, dflt) { + return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + } + + // Coerce x and y data arrays (this ensures proper data structure for category ordering) + var x = coerce('x'); + var y = coerce('y'); + var u = coerce('u'); + var v = coerce('v'); + + // Simple validation - check if we have the required arrays + if(!x || !Array.isArray(x) || x.length === 0 || + !y || !Array.isArray(y) || y.length === 0) { + traceOut.visible = false; + return; + } + + // If u/v are missing, default to zeros so the trace participates in calc/category logic + var len = Math.min(x.length, y.length); + if(!Array.isArray(u) || u.length === 0) { + traceOut.u = new Array(len); + for(var i = 0; i < len; i++) traceOut.u[i] = 0; + } + if(!Array.isArray(v) || v.length === 0) { + traceOut.v = new Array(len); + for(var j = 0; j < len; j++) traceOut.v[j] = 0; + } + + // Set basic properties + traceOut.type = 'quiver'; + + // Sizing API similar to cone + var sizemode = coerce('sizemode'); + coerce('sizeref', sizemode === 'raw' ? 1 : 0.5); + coerce('anchor'); + + // Set default values using coerce + coerce('arrowsize', 1); + // back-compat + coerce('arrow_scale'); + coerce('hoverdistance', 20); + + // Line styling + traceOut.line = { + color: traceIn.line && traceIn.line.color ? traceIn.line.color : defaultColor, + width: (traceIn.arrowwidth !== undefined) ? traceIn.arrowwidth : (traceIn.line && traceIn.line.width ? traceIn.line.width : 1), + dash: traceIn.line && traceIn.line.dash ? traceIn.line.dash : 'solid', + shape: traceIn.line && traceIn.line.shape ? traceIn.line.shape : 'linear', + smoothing: traceIn.line && traceIn.line.smoothing ? traceIn.line.smoothing : 1, + simplify: traceIn.line && traceIn.line.simplify !== undefined ? traceIn.line.simplify : true + }; + + // Hover and interaction - let the plots module handle hoverinfo defaults + // traceOut.hoverinfo will be set by Lib.coerceHoverinfo in plots.js + traceOut.hovertemplate = traceIn.hovertemplate; + + // Colorscale defaults (adds colorscale, showscale, colorbar, etc.) + // Keep colorscale enabled by default for quiver + traceOut._hasColorscale = hasColorscale(traceIn) || true; + colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: '', cLetter: 'c' }); + + // Text + traceOut.text = traceIn.text; + traceOut.textposition = traceIn.textposition || 'middle center'; + + // Use Lib.coerceFont to set textfont properly + Lib.coerceFont(coerce, 'textfont', layout.font); + + coerce('selected.line.color'); + coerce('selected.line.width'); + coerce('selected.textfont.color'); + coerce('unselected.line.color'); + coerce('unselected.line.width'); + coerce('unselected.textfont.color'); + + // Set the data length + traceOut._length = len; +}; + + diff --git a/src/traces/quiver/event_data.js b/src/traces/quiver/event_data.js new file mode 100644 index 00000000000..c744a23a152 --- /dev/null +++ b/src/traces/quiver/event_data.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function eventData(out, pt, trace, cd, pointNumber) { + out.x = pt.x; + out.y = pt.y; + out.u = trace.u[pointNumber]; + out.v = trace.v[pointNumber]; + out.pointNumber = pointNumber; + out.trace = trace; +}; + + diff --git a/src/traces/quiver/hover.js b/src/traces/quiver/hover.js new file mode 100644 index 00000000000..d9a3d4573fb --- /dev/null +++ b/src/traces/quiver/hover.js @@ -0,0 +1,77 @@ +'use strict'; + +var Lib = require('../../lib'); +var Fx = require('../../components/fx'); +var Registry = require('../../registry'); + +module.exports = function hoverPoints(pointData, xval, yval, hovermode) { + var cd = pointData.cd; + var trace = cd[0].trace; + var xa = pointData.xa; + var ya = pointData.ya; + var xpx = xa.c2p(xval); + var ypx = ya.c2p(yval); + + // Find the closest arrow base point to the hover point + var minDistance = Infinity; + var closestPoint = null; + var closestIndex = -1; + + // Each cd[i] is a calcdata point object with x/y + for(var i = 0; i < cd.length; i++) { + var cdi = cd[i]; + if(cdi.x === undefined || cdi.y === undefined) continue; + + var px = xa.c2p(cdi.x); + var py = ya.c2p(cdi.y); + + var distance = Math.sqrt((xpx - px) * (xpx - px) + (ypx - py) * (ypx - py)); + + if(distance < minDistance) { + minDistance = distance; + closestPoint = cdi; + closestIndex = i; + } + } + + var maxHoverDist = pointData.distance === Infinity ? Infinity : (trace.hoverdistance || 20); + if(!closestPoint || minDistance > maxHoverDist) return; + + // Create hover point data with proper label values and spikeline support + var hoverPoint = { + x: closestPoint.x, + y: closestPoint.y, + u: trace.u ? trace.u[closestIndex] : undefined, + v: trace.v ? trace.v[closestIndex] : undefined, + text: Array.isArray(trace.text) ? trace.text[closestIndex] : trace.text, + name: trace.name || '', + trace: trace, + index: closestIndex, + // Label values for formatting + xLabelVal: closestPoint.x, + yLabelVal: closestPoint.y, + uLabelVal: trace.u ? trace.u[closestIndex] : undefined, + vLabelVal: trace.v ? trace.v[closestIndex] : undefined, + // Spikeline support + xa: pointData.xa, + ya: pointData.ya, + x0: closestPoint.x, + x1: closestPoint.x, + y0: closestPoint.y, + y1: closestPoint.y, + distance: minDistance, + spikeDistance: minDistance, + curveNumber: trace.index, + color: trace.line ? trace.line.color : 'blue' + }; + + // Set hover text + var hovertext = trace.hovertext || trace.text; + if(hovertext && hovertext[closestIndex]) { + hoverPoint.hovertext = hovertext[closestIndex]; + } + + return [hoverPoint]; +}; + + diff --git a/src/traces/quiver/index.js b/src/traces/quiver/index.js new file mode 100644 index 00000000000..82850f0840b --- /dev/null +++ b/src/traces/quiver/index.js @@ -0,0 +1,33 @@ +'use strict'; + +module.exports = { + moduleType: 'trace', + name: 'quiver', + basePlotModule: require('../../plots/cartesian'), + categories: [ + 'cartesian', 'svg', 'showLegend', 'scatter-like', 'zoomScale' + ], + + attributes: require('./attributes'), + supplyDefaults: require('./defaults'), + calc: require('./calc'), + plot: require('./plot'), + style: require('./style'), + styleOnSelect: require('../scatter/style').styleOnSelect, + hoverPoints: require('./hover'), + eventData: require('./event_data'), + selectPoints: require('./select_points'), + animatable: true, + + meta: { + description: [ + 'The quiver trace type visualizes vector fields using arrows.', + 'Specify a vector field using 4 1D arrays:', + '2 position arrays `x`, `y` and 2 vector component arrays `u`, `v`.', + 'The arrows are drawn exactly at the positions given by `x` and `y`.', + 'Arrow length and direction are determined by `u` and `v` components.' + ].join(' ') + } +}; + + diff --git a/src/traces/quiver/plot.js b/src/traces/quiver/plot.js new file mode 100644 index 00000000000..c092e0e40ed --- /dev/null +++ b/src/traces/quiver/plot.js @@ -0,0 +1,216 @@ +'use strict'; + +var d3 = require('@plotly/d3'); + +var Registry = require('../../registry'); +var Lib = require('../../lib'); +var Drawing = require('../../components/drawing'); +var Colorscale = require('../../components/colorscale'); + +module.exports = function plot(gd, plotinfo, cdscatter, scatterLayer, transitionOpts, makeOnCompleteCallback) { + var join, onComplete; + + // If transition config is provided, then it is only a partial replot and traces not + // updated are removed. + var isFullReplot = !transitionOpts; + var hasTransition = !!transitionOpts && transitionOpts.duration > 0; + + join = scatterLayer.selectAll('g.trace') + .data(cdscatter, function(d) { return d[0].trace.uid; }); + + // Append new traces: + join.enter().append('g') + .attr('class', function(d) { + return 'trace quiver trace' + d[0].trace.uid; + }) + .style('stroke-miterlimit', 2); + join.order(); + + if(hasTransition) { + if(makeOnCompleteCallback) { + onComplete = makeOnCompleteCallback(); + } + + var transition = d3.transition() + .duration(transitionOpts.duration) + .ease(transitionOpts.easing) + .each('end', function() { + onComplete && onComplete(); + }) + .each('interrupt', function() { + onComplete && onComplete(); + }); + + transition.each(function() { + scatterLayer.selectAll('g.trace').each(function(d, i) { + plotOne(gd, i, plotinfo, d, cdscatter, this, transitionOpts); + }); + }); + } else { + join.each(function(d, i) { + plotOne(gd, i, plotinfo, d, cdscatter, this, transitionOpts); + }); + } + + if(isFullReplot) { + join.exit().remove(); + } +}; + +function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transitionOpts) { + var trace = cdscatter[0].trace; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var fullLayout = gd._fullLayout; + + // Create line group for arrows + var lines = d3.select(element).selectAll('g.lines') + .data([cdscatter]); + + lines.enter().append('g') + .classed('lines', true); + + Drawing.setClipUrl(lines, plotinfo.layerClipId, gd); + + // Create one path per data point (arrow) + var lineSegments = lines.selectAll('path.js-line') + .data(cdscatter); + + lineSegments.enter().append('path') + .classed('js-line', true) + .style('vector-effect', 'non-scaling-stroke'); + + lineSegments.exit().remove(); + + // Precompute norms for sizing + var uArr = trace.u || []; + var vArr = trace.v || []; + var maxNorm = 0; + for (var ni = 0; ni < trace._length; ni++) { + var uu = uArr[ni] || 0; + var vv = vArr[ni] || 0; + var nrm = Math.sqrt(uu * uu + vv * vv); + if (nrm > maxNorm) maxNorm = nrm; + } + var sizemode = trace.sizemode || 'scaled'; + var sizeref = (trace.sizeref !== undefined) ? trace.sizeref : (sizemode === 'raw' ? 1 : 0.5); + var anchor = trace.anchor || 'tail'; + + // Update line segments + lineSegments.each(function(cdi) { + var path = d3.select(this); + + // Skip invalid points + if(cdi.x === undefined || cdi.y === undefined) { + path.attr('d', null); + return; + } + + // Compute arrow in data space + // Derive pixel-per-data scaling from axes at this point + var pxPerX = Math.abs(xa.c2p(cdi.x + 1) - xa.c2p(cdi.x)); + var pxPerY = Math.abs(ya.c2p(cdi.y + 1) - ya.c2p(cdi.y)); + var scaleRatio = (pxPerX && pxPerY) ? (pxPerY / pxPerX) : 1; + var baseHeadScale = 0.2; + var arrowScale = (trace.arrowsize !== undefined) + ? (baseHeadScale * trace.arrowsize) + : (trace.arrow_scale !== undefined ? trace.arrow_scale : baseHeadScale); + // Fixed arrowhead wedge angle (radians). + // Arrow direction is fully determined by u,v (see barbAng below); + // this constant only controls the opening of the head. + var headAngle = Math.PI / 12; + + var u = (trace.u && trace.u[cdi.i]) || 0; + var v = (trace.v && trace.v[cdi.i]) || 0; + + var norm = Math.sqrt(u * u + v * v); + var unitx = norm ? (u / norm) : 0; + var unity = norm ? (v / norm) : 0; + var baseLen; + if (sizemode === 'scaled') { + var n = maxNorm ? (norm / maxNorm) : 0; + baseLen = n * sizeref; + } else { + baseLen = norm * sizeref; + } + + var dxBase = unitx * baseLen; + var dyBase = unity * baseLen; + var dx = dxBase * scaleRatio; + var dy = dyBase; + var barbLen = Math.sqrt((dx * dx) / scaleRatio + dy * dy); + var arrowLen = barbLen * arrowScale; + var barbAng = Math.atan2(dy, dx / scaleRatio); + + var ang1 = barbAng + headAngle; + var ang2 = barbAng - headAngle; + + var x0, y0, x1, y1; + if (anchor === 'tip') { + x1 = cdi.x; + y1 = cdi.y; + x0 = x1 - dx; + y0 = y1 - dy; + } else if (anchor === 'cm' || anchor === 'center' || anchor === 'middle') { + x0 = cdi.x - dx / 2; + y0 = cdi.y - dy / 2; + x1 = cdi.x + dx / 2; + y1 = cdi.y + dy / 2; + } else { // tail + x0 = cdi.x; + y0 = cdi.y; + x1 = x0 + dx; + y1 = y0 + dy; + } + + var xh1 = x1 - arrowLen * Math.cos(ang1) * scaleRatio; + var yh1 = y1 - arrowLen * Math.sin(ang1); + var xh2 = x1 - arrowLen * Math.cos(ang2) * scaleRatio; + var yh2 = y1 - arrowLen * Math.sin(ang2); + + // Convert to pixels + var p0x = xa.c2p(x0); + var p0y = ya.c2p(y0); + var p1x = xa.c2p(x1); + var p1y = ya.c2p(y1); + var ph1x = xa.c2p(xh1); + var ph1y = ya.c2p(yh1); + var ph2x = xa.c2p(xh2); + var ph2y = ya.c2p(yh2); + + var pathData = 'M' + p0x + ',' + p0y + 'L' + p1x + ',' + p1y + 'L' + ph1x + ',' + ph1y + 'L' + p1x + ',' + p1y + 'L' + ph2x + ',' + ph2y; + path.attr('d', pathData); + }); + + // Apply styling using Plotly's standard styling system + Drawing.lineGroupStyle(lineSegments, trace.line && trace.line.width, trace.line && trace.line.color, trace.line && trace.line.dash); + + // If colorscale present, color arrows by magnitude |(u,v)| + if (trace._hasColorscale) { + var colorFunc = Colorscale.makeColorScaleFuncFromTrace(trace); + lineSegments.style('stroke', function(cdi) { + var cArr = trace.c; + var value; + if (Array.isArray(cArr) && cArr.length > cdi.i && isFinite(cArr[cdi.i])) { + value = cArr[cdi.i]; + } else { + var uVal = (trace.u && trace.u[cdi.i]) || 0; + var vVal = (trace.v && trace.v[cdi.i]) || 0; + value = Math.sqrt(uVal * uVal + vVal * vVal); + } + return colorFunc(value); + }); + } + + // Handle transitions + if(transitionOpts && transitionOpts.duration > 0) { + var transition = d3.transition() + .duration(transitionOpts.duration) + .ease(transitionOpts.easing); + + lineSegments.transition(transition) + .style('opacity', 1); + } +} + + diff --git a/src/traces/quiver/select_points.js b/src/traces/quiver/select_points.js new file mode 100644 index 00000000000..d2dfa2d1dab --- /dev/null +++ b/src/traces/quiver/select_points.js @@ -0,0 +1,41 @@ +'use strict'; + +module.exports = function selectPoints(searchInfo, selectionTester) { + var cd = searchInfo.cd; + var xa = searchInfo.xaxis; + var ya = searchInfo.yaxis; + var selection = []; + var trace = cd[0].trace; + var i; + var segment; + var x; + var y; + + if(selectionTester === false) { // clear selection + for(i = 0; i < cd.length; i++) { + cd[i].selected = 0; + } + } else { + for(i = 0; i < cd.length; i++) { + segment = cd[i]; + // Use the start point of the arrow for selection testing + x = xa.c2p(segment[0].x); + y = ya.c2p(segment[0].y); + + if((segment[0].i !== null) && selectionTester.contains([x, y], false, i, searchInfo)) { + selection.push({ + pointNumber: segment[0].i, + x: xa.c2d(segment[0].x), + y: ya.c2d(segment[0].y) + }); + segment.selected = 1; + } else { + segment.selected = 0; + } + } + } + + return selection; +}; + + diff --git a/src/traces/quiver/style.js b/src/traces/quiver/style.js new file mode 100644 index 00000000000..30da22034c9 --- /dev/null +++ b/src/traces/quiver/style.js @@ -0,0 +1,18 @@ +'use strict'; + +var d3 = require('@plotly/d3'); + +var Drawing = require('../../components/drawing'); +var Lib = require('../../lib'); + +module.exports = function style(gd, calcTrace) { + if(!calcTrace || !calcTrace.length || !calcTrace[0]) return; + + var trace = calcTrace[0].trace; + var s = d3.select(gd).selectAll('g.trace' + trace.uid); + + s.selectAll('path.js-line') + .call(Drawing.lineGroupStyle, trace.line || {}); +}; + + diff --git a/test/plot-schema.json b/test/plot-schema.json index fa9a2fff787..3387a74276f 100644 --- a/test/plot-schema.json +++ b/test/plot-schema.json @@ -57505,6 +57505,1569 @@ }, "type": "pie" }, + "quiver": { + "animatable": true, + "attributes": { + "anchor": { + "description": "Sets the arrows' anchor with respect to their (x,y) positions. Use *tail* to place (x,y) at the base, *tip* to place (x,y) at the head, or *cm*/*center*/*middle* to center the arrow on (x,y).", + "dflt": "tail", + "editType": "calc", + "valType": "enumerated", + "values": [ + "tip", + "tail", + "cm", + "center", + "middle" + ] + }, + "arrow_scale": { + "description": "Deprecated alias for `arrowsize`-based sizing. Prefer using `arrowsize`.", + "editType": "calc", + "max": 1, + "min": 0, + "valType": "number" + }, + "arrowsize": { + "description": "Scales the size of the arrow head relative to a base size. Higher values produce larger heads.", + "dflt": 1, + "editType": "calc", + "min": 0.3, + "valType": "number" + }, + "arrowwidth": { + "description": "Sets the width (in px) of the arrow line (alias of `line.width`).", + "editType": "style", + "min": 0.1, + "valType": "number" + }, + "autocolorscale": { + "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `colorscale`. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", + "dflt": true, + "editType": "calc", + "impliedEdits": {}, + "valType": "boolean" + }, + "c": { + "anim": true, + "description": "Sets the scalar values used to map colors via the colorscale. If not provided, the magnitude sqrt(u^2 + v^2) is used.", + "editType": "calc", + "valType": "data_array" + }, + "cauto": { + "description": "Determines whether or not the color domain is computed with respect to the input data (here u/v norm) or the bounds set in `cmin` and `cmax` Defaults to `false` when `cmin` and `cmax` are set by the user.", + "dflt": true, + "editType": "calc", + "impliedEdits": {}, + "valType": "boolean" + }, + "cmax": { + "description": "Sets the upper bound of the color domain. Value should have the same units as u/v norm and if set, `cmin` must be set as well.", + "dflt": null, + "editType": "calc", + "impliedEdits": { + "cauto": false + }, + "valType": "number" + }, + "cmid": { + "description": "Sets the mid-point of the color domain by scaling `cmin` and/or `cmax` to be equidistant to this point. Value should have the same units as u/v norm. Has no effect when `cauto` is `false`.", + "dflt": null, + "editType": "calc", + "impliedEdits": {}, + "valType": "number" + }, + "cmin": { + "description": "Sets the lower bound of the color domain. Value should have the same units as u/v norm and if set, `cmax` must be set as well.", + "dflt": null, + "editType": "calc", + "impliedEdits": { + "cauto": false + }, + "valType": "number" + }, + "coloraxis": { + "description": "Sets a reference to a shared color axis. References to these shared color axes are *coloraxis*, *coloraxis2*, *coloraxis3*, etc. Settings for these shared color axes are set in the layout, under `layout.coloraxis`, `layout.coloraxis2`, etc. Note that multiple color scales can be linked to the same color axis.", + "dflt": null, + "editType": "calc", + "regex": "/^coloraxis([2-9]|[1-9][0-9]+)?$/", + "valType": "subplotid" + }, + "colorbar": { + "bgcolor": { + "description": "Sets the color of padded area.", + "dflt": "rgba(0,0,0,0)", + "editType": "colorbars", + "valType": "color" + }, + "bordercolor": { + "description": "Sets the axis line color.", + "dflt": "#444", + "editType": "colorbars", + "valType": "color" + }, + "borderwidth": { + "description": "Sets the width (in px) or the border enclosing this color bar.", + "dflt": 0, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "dtick": { + "description": "Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to *log* and *date* axes. If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. *log* has several special values; *L*, where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5). `tick0` is ignored for *D1* and *D2*. If the axis `type` is *date*, then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. *date* also has special values *M* gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*. To set ticks every 4 years, set `dtick` to *M48*", + "editType": "colorbars", + "impliedEdits": { + "tickmode": "linear" + }, + "valType": "any" + }, + "editType": "colorbars", + "exponentformat": { + "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B. *SI* uses prefixes from \"femto\" f (10^-15) to \"tera\" T (10^12). *SI extended* covers instead the full SI range from \"quecto\" q (10^-30) to \"quetta\" Q (10^30). If *SI* or *SI extended* is used and the exponent is beyond the above ranges, the formatting rule will automatically be switched to the power notation.", + "dflt": "B", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "none", + "e", + "E", + "power", + "SI", + "B", + "SI extended" + ] + }, + "labelalias": { + "description": "Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. For negative numbers the minus sign symbol used (U+2212) is wider than the regular ascii dash. That means you need to use −1 instead of -1. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax.", + "dflt": false, + "editType": "colorbars", + "valType": "any" + }, + "len": { + "description": "Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends.", + "dflt": 1, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "lenmode": { + "description": "Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot *fraction* or in *pixels. Use `len` to set the value.", + "dflt": "fraction", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "fraction", + "pixels" + ] + }, + "minexponent": { + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*.", + "dflt": 3, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "nticks": { + "description": "Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.", + "dflt": 0, + "editType": "colorbars", + "min": 0, + "valType": "integer" + }, + "orientation": { + "description": "Sets the orientation of the colorbar.", + "dflt": "v", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "h", + "v" + ] + }, + "outlinecolor": { + "description": "Sets the axis line color.", + "dflt": "#444", + "editType": "colorbars", + "valType": "color" + }, + "outlinewidth": { + "description": "Sets the width (in px) of the axis line.", + "dflt": 1, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "role": "object", + "separatethousands": { + "description": "If \"true\", even 4-digit integers are separated", + "dflt": false, + "editType": "colorbars", + "valType": "boolean" + }, + "showexponent": { + "description": "If *all*, all exponents are shown besides their significands. If *first*, only the exponent of the first tick is shown. If *last*, only the exponent of the last tick is shown. If *none*, no exponents appear.", + "dflt": "all", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "all", + "first", + "last", + "none" + ] + }, + "showticklabels": { + "description": "Determines whether or not the tick labels are drawn.", + "dflt": true, + "editType": "colorbars", + "valType": "boolean" + }, + "showtickprefix": { + "description": "If *all*, all tick labels are displayed with a prefix. If *first*, only the first tick is displayed with a prefix. If *last*, only the last tick is displayed with a suffix. If *none*, tick prefixes are hidden.", + "dflt": "all", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "all", + "first", + "last", + "none" + ] + }, + "showticksuffix": { + "description": "Same as `showtickprefix` but for tick suffixes.", + "dflt": "all", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "all", + "first", + "last", + "none" + ] + }, + "thickness": { + "description": "Sets the thickness of the color bar This measure excludes the size of the padding, ticks and labels.", + "dflt": 30, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "thicknessmode": { + "description": "Determines whether this color bar's thickness (i.e. the measure in the constant color direction) is set in units of plot *fraction* or in *pixels*. Use `thickness` to set the value.", + "dflt": "pixels", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "fraction", + "pixels" + ] + }, + "tick0": { + "description": "Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is *log*, then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L* (see `dtick` for more info). If the axis `type` is *date*, it should be a date string, like date data. If the axis `type` is *category*, it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears.", + "editType": "colorbars", + "impliedEdits": { + "tickmode": "linear" + }, + "valType": "any" + }, + "tickangle": { + "description": "Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically.", + "dflt": "auto", + "editType": "colorbars", + "valType": "angle" + }, + "tickcolor": { + "description": "Sets the tick color.", + "dflt": "#444", + "editType": "colorbars", + "valType": "color" + }, + "tickfont": { + "color": { + "editType": "colorbars", + "valType": "color" + }, + "description": "Sets the color bar's tick label font", + "editType": "colorbars", + "family": { + "description": "HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.", + "editType": "colorbars", + "noBlank": true, + "strict": true, + "valType": "string" + }, + "lineposition": { + "description": "Sets the kind of decoration line(s) with text, such as an *under*, *over* or *through* as well as combinations e.g. *under+over*, etc.", + "dflt": "none", + "editType": "colorbars", + "extras": [ + "none" + ], + "flags": [ + "under", + "over", + "through" + ], + "valType": "flaglist" + }, + "role": "object", + "shadow": { + "description": "Sets the shape and color of the shadow behind text. *auto* places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.", + "dflt": "none", + "editType": "colorbars", + "valType": "string" + }, + "size": { + "editType": "colorbars", + "min": 1, + "valType": "number" + }, + "style": { + "description": "Sets whether a font should be styled with a normal or italic face from its family.", + "dflt": "normal", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "normal", + "italic" + ] + }, + "textcase": { + "description": "Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.", + "dflt": "normal", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "normal", + "word caps", + "upper", + "lower" + ] + }, + "variant": { + "description": "Sets the variant of the font.", + "dflt": "normal", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "normal", + "small-caps", + "all-small-caps", + "all-petite-caps", + "petite-caps", + "unicase" + ] + }, + "weight": { + "description": "Sets the weight (or boldness) of the font.", + "dflt": "normal", + "editType": "colorbars", + "extras": [ + "normal", + "bold" + ], + "max": 1000, + "min": 1, + "valType": "integer" + } + }, + "tickformat": { + "description": "Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: *%h* for half of the year as a decimal number as well as *%{n}f* for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat *%H~%M~%S.%2f* would display *09~15~23.46*", + "dflt": "", + "editType": "colorbars", + "valType": "string" + }, + "tickformatstops": { + "items": { + "tickformatstop": { + "dtickrange": { + "description": "range [*min*, *max*], where *min*, *max* - dtick values which describe some zoom level, it is possible to omit *min* or *max* value by passing *null*", + "editType": "colorbars", + "items": [ + { + "editType": "colorbars", + "valType": "any" + }, + { + "editType": "colorbars", + "valType": "any" + } + ], + "valType": "info_array" + }, + "editType": "colorbars", + "enabled": { + "description": "Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`.", + "dflt": true, + "editType": "colorbars", + "valType": "boolean" + }, + "name": { + "description": "When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications (including `visible: false` or `enabled: false` to hide it). Has no effect outside of a template.", + "editType": "colorbars", + "valType": "string" + }, + "role": "object", + "templateitemname": { + "description": "Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (including `visible: false` or `enabled: false` to hide it). If there is no template or no matching item, this item will be hidden unless you explicitly show it with `visible: true`.", + "editType": "colorbars", + "valType": "string" + }, + "value": { + "description": "string - dtickformat for described zoom level, the same as *tickformat*", + "dflt": "", + "editType": "colorbars", + "valType": "string" + } + } + }, + "role": "object" + }, + "ticklabeloverflow": { + "description": "Determines how we handle tick labels that would overflow either the graph div or the domain of the axis. The default value for inside tick labels is *hide past domain*. In other cases the default is *hide past div*.", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "allow", + "hide past div", + "hide past domain" + ] + }, + "ticklabelposition": { + "description": "Determines where tick labels are drawn relative to the ticks. Left and right options are used when `orientation` is *h*, top and bottom when `orientation` is *v*.", + "dflt": "outside", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside left", + "inside left", + "outside right", + "inside right", + "outside bottom", + "inside bottom" + ] + }, + "ticklabelstep": { + "description": "Sets the spacing between tick labels as compared to the spacing between ticks. A value of 1 (default) means each tick gets a label. A value of 2 means shows every 2nd label. A larger value n means only every nth tick is labeled. `tick0` determines which labels are shown. Not implemented for axes with `type` *log* or *multicategory*, or when `tickmode` is *array*.", + "dflt": 1, + "editType": "colorbars", + "min": 1, + "valType": "integer" + }, + "ticklen": { + "description": "Sets the tick length (in px).", + "dflt": 5, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "tickmode": { + "description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided).", + "editType": "colorbars", + "impliedEdits": {}, + "valType": "enumerated", + "values": [ + "auto", + "linear", + "array" + ] + }, + "tickprefix": { + "description": "Sets a tick label prefix.", + "dflt": "", + "editType": "colorbars", + "valType": "string" + }, + "ticks": { + "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", + "dflt": "", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "outside", + "inside", + "" + ] + }, + "ticksuffix": { + "description": "Sets a tick label suffix.", + "dflt": "", + "editType": "colorbars", + "valType": "string" + }, + "ticktext": { + "description": "Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to *array*. Used with `tickvals`.", + "editType": "colorbars", + "valType": "data_array" + }, + "ticktextsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `ticktext`.", + "editType": "none", + "valType": "string" + }, + "tickvals": { + "description": "Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used with `ticktext`.", + "editType": "colorbars", + "valType": "data_array" + }, + "tickvalssrc": { + "description": "Sets the source reference on Chart Studio Cloud for `tickvals`.", + "editType": "none", + "valType": "string" + }, + "tickwidth": { + "description": "Sets the tick width (in px).", + "dflt": 1, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "title": { + "editType": "colorbars", + "font": { + "color": { + "editType": "colorbars", + "valType": "color" + }, + "description": "Sets this color bar's title font.", + "editType": "colorbars", + "family": { + "description": "HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.", + "editType": "colorbars", + "noBlank": true, + "strict": true, + "valType": "string" + }, + "lineposition": { + "description": "Sets the kind of decoration line(s) with text, such as an *under*, *over* or *through* as well as combinations e.g. *under+over*, etc.", + "dflt": "none", + "editType": "colorbars", + "extras": [ + "none" + ], + "flags": [ + "under", + "over", + "through" + ], + "valType": "flaglist" + }, + "role": "object", + "shadow": { + "description": "Sets the shape and color of the shadow behind text. *auto* places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.", + "dflt": "none", + "editType": "colorbars", + "valType": "string" + }, + "size": { + "editType": "colorbars", + "min": 1, + "valType": "number" + }, + "style": { + "description": "Sets whether a font should be styled with a normal or italic face from its family.", + "dflt": "normal", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "normal", + "italic" + ] + }, + "textcase": { + "description": "Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.", + "dflt": "normal", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "normal", + "word caps", + "upper", + "lower" + ] + }, + "variant": { + "description": "Sets the variant of the font.", + "dflt": "normal", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "normal", + "small-caps", + "all-small-caps", + "all-petite-caps", + "petite-caps", + "unicase" + ] + }, + "weight": { + "description": "Sets the weight (or boldness) of the font.", + "dflt": "normal", + "editType": "colorbars", + "extras": [ + "normal", + "bold" + ], + "max": 1000, + "min": 1, + "valType": "integer" + } + }, + "role": "object", + "side": { + "description": "Determines the location of color bar's title with respect to the color bar. Defaults to *top* when `orientation` if *v* and defaults to *right* when `orientation` if *h*.", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "right", + "top", + "bottom" + ] + }, + "text": { + "description": "Sets the title of the color bar.", + "editType": "colorbars", + "valType": "string" + } + }, + "x": { + "description": "Sets the x position with respect to `xref` of the color bar (in plot fraction). When `xref` is *paper*, defaults to 1.02 when `orientation` is *v* and 0.5 when `orientation` is *h*. When `xref` is *container*, defaults to *1* when `orientation` is *v* and 0.5 when `orientation` is *h*. Must be between *0* and *1* if `xref` is *container* and between *-2* and *3* if `xref` is *paper*.", + "editType": "colorbars", + "valType": "number" + }, + "xanchor": { + "description": "Sets this color bar's horizontal position anchor. This anchor binds the `x` position to the *left*, *center* or *right* of the color bar. Defaults to *left* when `orientation` is *v* and *center* when `orientation` is *h*.", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "left", + "center", + "right" + ] + }, + "xpad": { + "description": "Sets the amount of padding (in px) along the x direction.", + "dflt": 10, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "xref": { + "description": "Sets the container `x` refers to. *container* spans the entire `width` of the plot. *paper* refers to the width of the plotting area only.", + "dflt": "paper", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "container", + "paper" + ] + }, + "y": { + "description": "Sets the y position with respect to `yref` of the color bar (in plot fraction). When `yref` is *paper*, defaults to 0.5 when `orientation` is *v* and 1.02 when `orientation` is *h*. When `yref` is *container*, defaults to 0.5 when `orientation` is *v* and 1 when `orientation` is *h*. Must be between *0* and *1* if `yref` is *container* and between *-2* and *3* if `yref` is *paper*.", + "editType": "colorbars", + "valType": "number" + }, + "yanchor": { + "description": "Sets this color bar's vertical position anchor This anchor binds the `y` position to the *top*, *middle* or *bottom* of the color bar. Defaults to *middle* when `orientation` is *v* and *bottom* when `orientation` is *h*.", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "top", + "middle", + "bottom" + ] + }, + "ypad": { + "description": "Sets the amount of padding (in px) along the y direction.", + "dflt": 10, + "editType": "colorbars", + "min": 0, + "valType": "number" + }, + "yref": { + "description": "Sets the container `y` refers to. *container* spans the entire `height` of the plot. *paper* refers to the height of the plotting area only.", + "dflt": "paper", + "editType": "colorbars", + "valType": "enumerated", + "values": [ + "container", + "paper" + ] + } + }, + "colorscale": { + "description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use `cmin` and `cmax`. Alternatively, `colorscale` may be a palette name string of the following list: Blackbody,Bluered,Blues,Cividis,Earth,Electric,Greens,Greys,Hot,Jet,Picnic,Portland,Rainbow,RdBu,Reds,Viridis,YlGnBu,YlOrRd.", + "dflt": null, + "editType": "calc", + "impliedEdits": { + "autocolorscale": false + }, + "valType": "colorscale" + }, + "csrc": { + "description": "Sets the source reference on Chart Studio Cloud for `c`.", + "editType": "none", + "valType": "string" + }, + "customdata": { + "description": "Assigns extra data each datum. This may be useful when listening to hover, click and selection events. Note that, *scatter* traces also appends customdata items in the markers DOM elements", + "editType": "calc", + "valType": "data_array" + }, + "customdatasrc": { + "description": "Sets the source reference on Chart Studio Cloud for `customdata`.", + "editType": "none", + "valType": "string" + }, + "hoverdistance": { + "description": "Maximum distance (in pixels) to look for nearby arrows on hover.", + "dflt": 20, + "editType": "calc", + "min": -1, + "valType": "number" + }, + "hoverinfo": { + "arrayOk": true, + "description": "Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired.", + "dflt": "all", + "editType": "none", + "extras": [ + "all", + "none", + "skip" + ], + "flags": [ + "x", + "y", + "u", + "v", + "text", + "name" + ], + "valType": "flaglist" + }, + "hoverinfosrc": { + "description": "Sets the source reference on Chart Studio Cloud for `hoverinfo`.", + "editType": "none", + "valType": "string" + }, + "hoverlabel": { + "align": { + "arrayOk": true, + "description": "Sets the horizontal alignment of the text content within hover label box. Has an effect only if the hover label text spans more two or more lines", + "dflt": "auto", + "editType": "none", + "valType": "enumerated", + "values": [ + "left", + "right", + "auto" + ] + }, + "alignsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `align`.", + "editType": "none", + "valType": "string" + }, + "bgcolor": { + "arrayOk": true, + "description": "Sets the background color of the hover labels for this trace", + "editType": "none", + "valType": "color" + }, + "bgcolorsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `bgcolor`.", + "editType": "none", + "valType": "string" + }, + "bordercolor": { + "arrayOk": true, + "description": "Sets the border color of the hover labels for this trace.", + "editType": "none", + "valType": "color" + }, + "bordercolorsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `bordercolor`.", + "editType": "none", + "valType": "string" + }, + "editType": "none", + "font": { + "color": { + "arrayOk": true, + "editType": "none", + "valType": "color" + }, + "colorsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `color`.", + "editType": "none", + "valType": "string" + }, + "description": "Sets the font used in hover labels.", + "editType": "none", + "family": { + "arrayOk": true, + "description": "HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.", + "editType": "none", + "noBlank": true, + "strict": true, + "valType": "string" + }, + "familysrc": { + "description": "Sets the source reference on Chart Studio Cloud for `family`.", + "editType": "none", + "valType": "string" + }, + "lineposition": { + "arrayOk": true, + "description": "Sets the kind of decoration line(s) with text, such as an *under*, *over* or *through* as well as combinations e.g. *under+over*, etc.", + "dflt": "none", + "editType": "none", + "extras": [ + "none" + ], + "flags": [ + "under", + "over", + "through" + ], + "valType": "flaglist" + }, + "linepositionsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `lineposition`.", + "editType": "none", + "valType": "string" + }, + "role": "object", + "shadow": { + "arrayOk": true, + "description": "Sets the shape and color of the shadow behind text. *auto* places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.", + "dflt": "none", + "editType": "none", + "valType": "string" + }, + "shadowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `shadow`.", + "editType": "none", + "valType": "string" + }, + "size": { + "arrayOk": true, + "editType": "none", + "min": 1, + "valType": "number" + }, + "sizesrc": { + "description": "Sets the source reference on Chart Studio Cloud for `size`.", + "editType": "none", + "valType": "string" + }, + "style": { + "arrayOk": true, + "description": "Sets whether a font should be styled with a normal or italic face from its family.", + "dflt": "normal", + "editType": "none", + "valType": "enumerated", + "values": [ + "normal", + "italic" + ] + }, + "stylesrc": { + "description": "Sets the source reference on Chart Studio Cloud for `style`.", + "editType": "none", + "valType": "string" + }, + "textcase": { + "arrayOk": true, + "description": "Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.", + "dflt": "normal", + "editType": "none", + "valType": "enumerated", + "values": [ + "normal", + "word caps", + "upper", + "lower" + ] + }, + "textcasesrc": { + "description": "Sets the source reference on Chart Studio Cloud for `textcase`.", + "editType": "none", + "valType": "string" + }, + "variant": { + "arrayOk": true, + "description": "Sets the variant of the font.", + "dflt": "normal", + "editType": "none", + "valType": "enumerated", + "values": [ + "normal", + "small-caps", + "all-small-caps", + "all-petite-caps", + "petite-caps", + "unicase" + ] + }, + "variantsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `variant`.", + "editType": "none", + "valType": "string" + }, + "weight": { + "arrayOk": true, + "description": "Sets the weight (or boldness) of the font.", + "dflt": "normal", + "editType": "none", + "extras": [ + "normal", + "bold" + ], + "max": 1000, + "min": 1, + "valType": "integer" + }, + "weightsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `weight`.", + "editType": "none", + "valType": "string" + } + }, + "namelength": { + "arrayOk": true, + "description": "Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than that many characters, but if it is longer, will truncate to `namelength - 3` characters and add an ellipsis.", + "dflt": 15, + "editType": "none", + "min": -1, + "valType": "integer" + }, + "namelengthsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `namelength`.", + "editType": "none", + "valType": "string" + }, + "role": "object", + "showarrow": { + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + } + }, + "hovertemplate": { + "arrayOk": true, + "description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example \"Day: %{2019-01-01|%A}\". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Variables that can't be found will be replaced with the specifier. For example, a template of \"data: %{x}, %{y}\" will result in a value of \"data: 1, %{y}\" if x is 1 and y is missing. Variables with an undefined value will be replaced with the fallback value. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, all attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Finally, the template string has access to variables `x`, `y`, `u`, `v`, `text` and `name`. Anything contained in tag `` is displayed in the secondary box, for example `%{fullData.name}`. To hide the secondary box completely, use an empty tag ``.", + "dflt": "", + "editType": "none", + "valType": "string" + }, + "hovertemplatesrc": { + "description": "Sets the source reference on Chart Studio Cloud for `hovertemplate`.", + "editType": "none", + "valType": "string" + }, + "ids": { + "anim": true, + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", + "editType": "calc", + "valType": "data_array" + }, + "idssrc": { + "description": "Sets the source reference on Chart Studio Cloud for `ids`.", + "editType": "none", + "valType": "string" + }, + "legend": { + "description": "Sets the reference to a legend to show this trace in. References to these legends are *legend*, *legend2*, *legend3*, etc. Settings for these legends are set in the layout, under `layout.legend`, `layout.legend2`, etc.", + "dflt": "legend", + "editType": "style", + "valType": "subplotid" + }, + "legendgroup": { + "description": "Sets the legend group for this trace. Traces and shapes part of the same legend group hide/show at the same time when toggling legend items.", + "dflt": "", + "editType": "style", + "valType": "string" + }, + "legendgrouptitle": { + "editType": "style", + "font": { + "color": { + "editType": "style", + "valType": "color" + }, + "description": "Sets this legend group's title font.", + "editType": "style", + "family": { + "description": "HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.", + "editType": "style", + "noBlank": true, + "strict": true, + "valType": "string" + }, + "lineposition": { + "description": "Sets the kind of decoration line(s) with text, such as an *under*, *over* or *through* as well as combinations e.g. *under+over*, etc.", + "dflt": "none", + "editType": "style", + "extras": [ + "none" + ], + "flags": [ + "under", + "over", + "through" + ], + "valType": "flaglist" + }, + "role": "object", + "shadow": { + "description": "Sets the shape and color of the shadow behind text. *auto* places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.", + "dflt": "none", + "editType": "style", + "valType": "string" + }, + "size": { + "editType": "style", + "min": 1, + "valType": "number" + }, + "style": { + "description": "Sets whether a font should be styled with a normal or italic face from its family.", + "dflt": "normal", + "editType": "style", + "valType": "enumerated", + "values": [ + "normal", + "italic" + ] + }, + "textcase": { + "description": "Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.", + "dflt": "normal", + "editType": "style", + "valType": "enumerated", + "values": [ + "normal", + "word caps", + "upper", + "lower" + ] + }, + "variant": { + "description": "Sets the variant of the font.", + "dflt": "normal", + "editType": "style", + "valType": "enumerated", + "values": [ + "normal", + "small-caps", + "all-small-caps", + "all-petite-caps", + "petite-caps", + "unicase" + ] + }, + "weight": { + "description": "Sets the weight (or boldness) of the font.", + "dflt": "normal", + "editType": "style", + "extras": [ + "normal", + "bold" + ], + "max": 1000, + "min": 1, + "valType": "integer" + } + }, + "role": "object", + "text": { + "description": "Sets the title of the legend group.", + "dflt": "", + "editType": "style", + "valType": "string" + } + }, + "legendrank": { + "description": "Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with *reversed* `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items. When having unranked or equal rank items shapes would be displayed after traces i.e. according to their order in data and layout.", + "dflt": 1000, + "editType": "style", + "valType": "number" + }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, + "line": { + "color": { + "description": "Sets the color of the arrow lines.", + "dflt": "#000", + "editType": "style", + "valType": "color" + }, + "dash": { + "description": "Sets the dash style of lines. Set to a dash type string (*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*) or a dash length list in px (eg *5px,10px,2px,2px*).", + "dflt": "solid", + "editType": "style", + "valType": "string", + "values": [ + "solid", + "dot", + "dash", + "longdash", + "dashdot", + "longdashdot" + ] + }, + "editType": "style", + "role": "object", + "shape": { + "description": "Determines the line shape.", + "dflt": "linear", + "editType": "plot", + "valType": "enumerated", + "values": [ + "linear", + "spline", + "hv", + "vh", + "hvh", + "vhv" + ] + }, + "simplify": { + "description": "Simplifies lines by removing nearly-overlapping points.", + "dflt": true, + "editType": "plot", + "valType": "boolean" + }, + "smoothing": { + "description": "Has an effect only if `shape` is set to *spline*. Sets the amount of smoothing.", + "dflt": 1, + "editType": "plot", + "max": 1.3, + "min": 0, + "valType": "number" + }, + "width": { + "description": "Sets the width (in px) of the arrow lines.", + "dflt": 1, + "editType": "style", + "min": 0, + "valType": "number" + } + }, + "meta": { + "arrayOk": true, + "description": "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.", + "editType": "plot", + "valType": "any" + }, + "metasrc": { + "description": "Sets the source reference on Chart Studio Cloud for `meta`.", + "editType": "none", + "valType": "string" + }, + "name": { + "description": "Sets the trace name. The trace name appears as the legend item and on hover.", + "editType": "style", + "valType": "string" + }, + "opacity": { + "description": "Sets the opacity of the trace.", + "dflt": 1, + "editType": "style", + "max": 1, + "min": 0, + "valType": "number" + }, + "reversescale": { + "description": "Reverses the color mapping if true. If true, `cmin` will correspond to the last color in the array and `cmax` will correspond to the first color.", + "dflt": false, + "editType": "plot", + "valType": "boolean" + }, + "selected": { + "editType": "style", + "line": { + "color": { + "description": "Sets the line color of selected points.", + "editType": "style", + "valType": "color" + }, + "editType": "style", + "role": "object", + "width": { + "description": "Sets the line width of selected points.", + "editType": "style", + "min": 0, + "valType": "number" + } + }, + "role": "object", + "textfont": { + "color": { + "description": "Sets the text font color of selected points, applied only when a selection exists.", + "editType": "style", + "valType": "color" + }, + "editType": "style", + "role": "object" + } + }, + "selectedpoints": { + "description": "Array containing integer indices of selected points. Has an effect only for traces that support selections. Note that an empty array means an empty selection where the `unselected` are turned on for all points, whereas, any other non-array values means no selection all where the `selected` and `unselected` styles have no effect.", + "editType": "calc", + "valType": "any" + }, + "showlegend": { + "description": "Determines whether or not an item corresponding to this trace is shown in the legend.", + "dflt": true, + "editType": "style", + "valType": "boolean" + }, + "showscale": { + "description": "Determines whether or not a colorbar is displayed for this trace.", + "dflt": true, + "editType": "calc", + "valType": "boolean" + }, + "sizemode": { + "description": "Determines whether `sizeref` is set as a *scaled* (unitless) scalar (normalized by the max u/v norm in the vector field), as an *absolute* value (in the same units as the vector field), or *raw* to use the raw vector lengths.", + "dflt": "scaled", + "editType": "calc", + "valType": "enumerated", + "values": [ + "scaled", + "absolute", + "raw" + ] + }, + "sizeref": { + "description": "Adjusts the arrow size scaling. The arrow length is determined by the vector norm multiplied by `sizeref`, optionally normalized when `sizemode` is *scaled*.", + "editType": "calc", + "min": 0, + "valType": "number" + }, + "stream": { + "editType": "calc", + "maxpoints": { + "description": "Sets the maximum number of points to keep on the plots from an incoming stream. If `maxpoints` is set to *50*, only the newest 50 points will be displayed on the plot.", + "dflt": 500, + "editType": "calc", + "max": 10000, + "min": 0, + "valType": "number" + }, + "role": "object", + "token": { + "description": "The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.", + "editType": "calc", + "noBlank": true, + "strict": true, + "valType": "string" + } + }, + "text": { + "anim": true, + "description": "Sets text elements associated with each (x,y) pair.", + "editType": "calc", + "valType": "data_array" + }, + "textfont": { + "color": { + "arrayOk": true, + "editType": "style", + "valType": "color" + }, + "colorsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `color`.", + "editType": "none", + "valType": "string" + }, + "description": "Sets the text font.", + "editType": "calc", + "family": { + "arrayOk": true, + "description": "HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.", + "editType": "calc", + "noBlank": true, + "strict": true, + "valType": "string" + }, + "familysrc": { + "description": "Sets the source reference on Chart Studio Cloud for `family`.", + "editType": "none", + "valType": "string" + }, + "lineposition": { + "arrayOk": true, + "description": "Sets the kind of decoration line(s) with text, such as an *under*, *over* or *through* as well as combinations e.g. *under+over*, etc.", + "dflt": "none", + "editType": "calc", + "extras": [ + "none" + ], + "flags": [ + "under", + "over", + "through" + ], + "valType": "flaglist" + }, + "linepositionsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `lineposition`.", + "editType": "none", + "valType": "string" + }, + "role": "object", + "shadow": { + "arrayOk": true, + "description": "Sets the shape and color of the shadow behind text. *auto* places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.", + "dflt": "none", + "editType": "calc", + "valType": "string" + }, + "shadowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `shadow`.", + "editType": "none", + "valType": "string" + }, + "size": { + "arrayOk": true, + "editType": "calc", + "min": 1, + "valType": "number" + }, + "sizesrc": { + "description": "Sets the source reference on Chart Studio Cloud for `size`.", + "editType": "none", + "valType": "string" + }, + "style": { + "arrayOk": true, + "description": "Sets whether a font should be styled with a normal or italic face from its family.", + "dflt": "normal", + "editType": "calc", + "valType": "enumerated", + "values": [ + "normal", + "italic" + ] + }, + "stylesrc": { + "description": "Sets the source reference on Chart Studio Cloud for `style`.", + "editType": "none", + "valType": "string" + }, + "textcase": { + "arrayOk": true, + "description": "Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.", + "dflt": "normal", + "editType": "calc", + "valType": "enumerated", + "values": [ + "normal", + "word caps", + "upper", + "lower" + ] + }, + "textcasesrc": { + "description": "Sets the source reference on Chart Studio Cloud for `textcase`.", + "editType": "none", + "valType": "string" + }, + "variant": { + "arrayOk": true, + "description": "Sets the variant of the font.", + "dflt": "normal", + "editType": "calc", + "valType": "enumerated", + "values": [ + "normal", + "small-caps", + "all-small-caps", + "all-petite-caps", + "petite-caps", + "unicase" + ] + }, + "variantsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `variant`.", + "editType": "none", + "valType": "string" + }, + "weight": { + "arrayOk": true, + "description": "Sets the weight (or boldness) of the font.", + "dflt": "normal", + "editType": "calc", + "extras": [ + "normal", + "bold" + ], + "max": 1000, + "min": 1, + "valType": "integer" + }, + "weightsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `weight`.", + "editType": "none", + "valType": "string" + } + }, + "textposition": { + "description": "Sets the positions of the `text` elements with respects to the (x,y) coordinates.", + "dflt": "middle center", + "editType": "calc", + "valType": "enumerated", + "values": [ + "top left", + "top center", + "top right", + "middle left", + "middle center", + "middle right", + "bottom left", + "bottom center", + "bottom right" + ] + }, + "textsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `text`.", + "editType": "none", + "valType": "string" + }, + "type": "quiver", + "u": { + "anim": true, + "description": "Sets the x components of the arrow vectors.", + "editType": "calc", + "valType": "data_array" + }, + "uid": { + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.", + "editType": "plot", + "valType": "string" + }, + "uirevision": { + "description": "Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves.", + "editType": "none", + "valType": "any" + }, + "unselected": { + "editType": "style", + "line": { + "color": { + "description": "Sets the line color of unselected points.", + "editType": "style", + "valType": "color" + }, + "editType": "style", + "role": "object", + "width": { + "description": "Sets the line width of unselected points.", + "editType": "style", + "min": 0, + "valType": "number" + } + }, + "role": "object", + "textfont": { + "color": { + "description": "Sets the text font color of unselected points, applied only when a selection exists.", + "editType": "style", + "valType": "color" + }, + "editType": "style", + "role": "object" + } + }, + "usrc": { + "description": "Sets the source reference on Chart Studio Cloud for `u`.", + "editType": "none", + "valType": "string" + }, + "v": { + "anim": true, + "description": "Sets the y components of the arrow vectors.", + "editType": "calc", + "valType": "data_array" + }, + "visible": { + "description": "Determines whether or not this trace is visible. If *legendonly*, the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).", + "dflt": true, + "editType": "calc", + "valType": "enumerated", + "values": [ + true, + false, + "legendonly" + ] + }, + "vsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `v`.", + "editType": "none", + "valType": "string" + }, + "x": { + "anim": true, + "description": "Sets the x coordinates of the arrow locations.", + "editType": "calc+clearAxisTypes", + "valType": "data_array" + }, + "xaxis": { + "description": "Sets a reference between this trace's x coordinates and a 2D cartesian x axis. If *x* (the default value), the x coordinates refer to `layout.xaxis`. If *x2*, the x coordinates refer to `layout.xaxis2`, and so on.", + "dflt": "x", + "editType": "calc+clearAxisTypes", + "valType": "subplotid" + }, + "xsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `x`.", + "editType": "none", + "valType": "string" + }, + "y": { + "anim": true, + "description": "Sets the y coordinates of the arrow locations.", + "editType": "calc+clearAxisTypes", + "valType": "data_array" + }, + "yaxis": { + "description": "Sets a reference between this trace's y coordinates and a 2D cartesian y axis. If *y* (the default value), the y coordinates refer to `layout.yaxis`. If *y2*, the y coordinates refer to `layout.yaxis2`, and so on.", + "dflt": "y", + "editType": "calc+clearAxisTypes", + "valType": "subplotid" + }, + "ysrc": { + "description": "Sets the source reference on Chart Studio Cloud for `y`.", + "editType": "none", + "valType": "string" + } + }, + "categories": [ + "cartesian", + "svg", + "showLegend", + "scatter-like", + "zoomScale" + ], + "meta": { + "description": "The quiver trace type visualizes vector fields using arrows. Specify a vector field using 4 1D arrays: 2 position arrays `x`, `y` and 2 vector component arrays `u`, `v`. The arrows are drawn exactly at the positions given by `x` and `y`. Arrow length and direction are determined by `u` and `v` components." + }, + "type": "quiver" + }, "sankey": { "animatable": false, "attributes": {