Skip to content

Commit 131c00c

Browse files
committed
update selected and unselected attrs to mirror normal styling attrs
1 parent 8245afd commit 131c00c

5 files changed

Lines changed: 66 additions & 53 deletions

File tree

src/traces/quiver/attributes.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,21 @@ var attrs = {
139139
editTypeOverride: 'calc'
140140
})
141141
),
142-
143-
// Selection and styling
144142
selected: {
145-
line: {
143+
marker: {
146144
color: {
147145
valType: 'color',
148146
editType: 'style',
149-
description: 'Sets the line color of selected points.'
147+
description: 'Sets the marker color of selected points.'
150148
},
151-
width: {
152-
valType: 'number',
153-
min: 0,
154-
editType: 'style',
155-
description: 'Sets the line width of selected points.'
149+
line: {
150+
width: {
151+
valType: 'number',
152+
min: 0,
153+
editType: 'style',
154+
description: 'Sets the line width of selected points.'
155+
},
156+
editType: 'style'
156157
},
157158
editType: 'style'
158159
},
@@ -167,17 +168,20 @@ var attrs = {
167168
editType: 'style'
168169
},
169170
unselected: {
170-
line: {
171+
marker: {
171172
color: {
172173
valType: 'color',
173174
editType: 'style',
174-
description: 'Sets the line color of unselected points.'
175+
description: 'Sets the marker color of unselected points, applied only when a selection exists.'
175176
},
176-
width: {
177-
valType: 'number',
178-
min: 0,
179-
editType: 'style',
180-
description: 'Sets the line width of unselected points.'
177+
line: {
178+
width: {
179+
valType: 'number',
180+
min: 0,
181+
editType: 'style',
182+
description: 'Sets the line width of unselected points, applied only when a selection exists.'
183+
},
184+
editType: 'style'
181185
},
182186
editType: 'style'
183187
},

src/traces/quiver/defaults.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
8383
};
8484

8585
// Selection styling
86-
coerce('selected.line.color');
87-
coerce('selected.line.width');
86+
coerce('selected.marker.color');
87+
coerce('selected.marker.line.width');
8888
coerce('selected.textfont.color');
89-
coerce('unselected.line.color');
90-
coerce('unselected.line.width');
89+
coerce('unselected.marker.color');
90+
coerce('unselected.marker.line.width');
9191
coerce('unselected.textfont.color');
9292

9393
};

src/traces/quiver/style.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ function styleArrows(gd, cd, sel) {
4949
if(!sel) return;
5050

5151
if(trace.selectedpoints) {
52-
var selectedAttrs = trace.selected || {};
53-
var unselectedAttrs = trace.unselected || {};
54-
var selectedLine = selectedAttrs.line || {};
55-
var unselectedLine = unselectedAttrs.line || {};
52+
var selectedMarker = (trace.selected || {}).marker || {};
53+
var unselectedMarker = (trace.unselected || {}).marker || {};
54+
var selectedMarkerLine = selectedMarker.line || {};
55+
var unselectedMarkerLine = unselectedMarker.line || {};
5656

5757
sel.selectAll('path.js-line').each(function(d) {
5858
var path = d3.select(this);
5959
var dim = !d.selected;
6060

61-
var explicitColor = dim ? unselectedLine.color : selectedLine.color;
61+
var explicitColor = dim ? unselectedMarker.color : selectedMarker.color;
6262
var lineWidth = dim ?
63-
(unselectedLine.width !== undefined ? unselectedLine.width : markerLine.width) :
64-
(selectedLine.width !== undefined ? selectedLine.width : markerLine.width);
63+
(unselectedMarkerLine.width !== undefined ? unselectedMarkerLine.width : markerLine.width) :
64+
(selectedMarkerLine.width !== undefined ? selectedMarkerLine.width : markerLine.width);
6565

6666
if(explicitColor) {
6767
Drawing.lineGroupStyle(path, lineWidth, explicitColor, markerLine.dash);

src/types/generated/schema.d.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,14 +1627,7 @@ export interface CandlestickData {
16271627
* Minimum: 0
16281628
*/
16291629
legendwidth?: number;
1630-
line?: {
1631-
/**
1632-
* Sets the width (in px) of line bounding the box(es). Note that this style setting can also be set per direction via `increasing.line.width` and `decreasing.line.width`.
1633-
* @default 2
1634-
* Minimum: 0
1635-
*/
1636-
width?: number;
1637-
};
1630+
line?: _internal.ErrorY;
16381631
/** Sets the low values. */
16391632
low?: Datum[] | Datum[][] | TypedArray;
16401633
/** 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. */
@@ -7085,7 +7078,11 @@ export interface QuiverData {
70857078
*/
70867079
opacity?: number;
70877080
selected?: {
7088-
line?: _internal.ErrorY;
7081+
marker?: {
7082+
/** Sets the marker color of selected points. */
7083+
color?: Color;
7084+
line?: _internal.ErrorY;
7085+
};
70897086
textfont?: Font;
70907087
};
70917088
/** 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. */
@@ -7124,7 +7121,11 @@ export interface QuiverData {
71247121
/** 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. */
71257122
uirevision?: any;
71267123
unselected?: {
7127-
line?: _internal.ErrorY;
7124+
marker?: {
7125+
/** Sets the marker color of unselected points, applied only when a selection exists. */
7126+
color?: Color;
7127+
line?: _internal.ErrorY;
7128+
};
71287129
textfont?: Font;
71297130
};
71307131
/** Sets the y components of the arrow vectors. */

test/plot-schema.json

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53515,20 +53515,24 @@
5351553515
},
5351653516
"selected": {
5351753517
"editType": "style",
53518-
"line": {
53518+
"marker": {
5351953519
"color": {
53520-
"description": "Sets the line color of selected points.",
53520+
"description": "Sets the marker color of selected points.",
5352153521
"editType": "style",
5352253522
"valType": "color"
5352353523
},
5352453524
"editType": "style",
53525-
"role": "object",
53526-
"width": {
53527-
"description": "Sets the line width of selected points.",
53525+
"line": {
5352853526
"editType": "style",
53529-
"min": 0,
53530-
"valType": "number"
53531-
}
53527+
"role": "object",
53528+
"width": {
53529+
"description": "Sets the line width of selected points.",
53530+
"editType": "style",
53531+
"min": 0,
53532+
"valType": "number"
53533+
}
53534+
},
53535+
"role": "object"
5353253536
},
5353353537
"role": "object",
5353453538
"textfont": {
@@ -53716,20 +53720,24 @@
5371653720
},
5371753721
"unselected": {
5371853722
"editType": "style",
53719-
"line": {
53723+
"marker": {
5372053724
"color": {
53721-
"description": "Sets the line color of unselected points.",
53725+
"description": "Sets the marker color of unselected points, applied only when a selection exists.",
5372253726
"editType": "style",
5372353727
"valType": "color"
5372453728
},
5372553729
"editType": "style",
53726-
"role": "object",
53727-
"width": {
53728-
"description": "Sets the line width of unselected points.",
53730+
"line": {
5372953731
"editType": "style",
53730-
"min": 0,
53731-
"valType": "number"
53732-
}
53732+
"role": "object",
53733+
"width": {
53734+
"description": "Sets the line width of unselected points, applied only when a selection exists.",
53735+
"editType": "style",
53736+
"min": 0,
53737+
"valType": "number"
53738+
}
53739+
},
53740+
"role": "object"
5373353741
},
5373453742
"role": "object",
5373553743
"textfont": {

0 commit comments

Comments
 (0)