Skip to content

Commit d83547b

Browse files
committed
phased out, removed, deleted the filterbar attribute
1 parent 29e5adf commit d83547b

File tree

5 files changed

+35
-127
lines changed

5 files changed

+35
-127
lines changed

src/traces/parcoords/attributes.js

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -207,90 +207,5 @@ module.exports = {
207207
role: 'style',
208208
description: 'Setting it to `1` offsets the extreme points on integer axes by half pitch.'
209209
}
210-
},
211-
212-
filterbar: {
213-
214-
width: {
215-
valType: 'number',
216-
dflt: 4,
217-
min: 2,
218-
max: 20,
219-
role: 'style',
220-
description: 'Visible width of the filter bar.'
221-
},
222-
223-
fillcolor: {
224-
valType: 'color',
225-
dflt: 'magenta',
226-
role: 'style',
227-
description: 'Color of the filter bar fill.'
228-
},
229-
230-
fillopacity: {
231-
valType: 'number',
232-
dflt: 1,
233-
min: 0,
234-
max: 1,
235-
role: 'style',
236-
description: 'Filter bar fill opacity.'
237-
},
238-
239-
strokecolor: {
240-
valType: 'color',
241-
dflt: 'white',
242-
role: 'style',
243-
description: 'Color of the filter bar side lines.'
244-
},
245-
246-
strokeopacity: {
247-
valType: 'number',
248-
dflt: 1,
249-
min: 0,
250-
max: 1,
251-
arrayOk: true,
252-
role: 'style',
253-
description: 'Filter bar side stroke opacity.'
254-
},
255-
256-
strokewidth: {
257-
valType: 'number',
258-
dflt: 1,
259-
min: 0,
260-
max: 2,
261-
role: 'style',
262-
description: 'Filter bar side stroke width.'
263-
},
264-
265-
handleheight: {
266-
valType: 'number',
267-
dflt: 16,
268-
min: 2,
269-
max: 20,
270-
role: 'style',
271-
description: 'Height of the filter bar vertical resize areas on top and bottom.'
272-
},
273-
274-
handleopacity: {
275-
valType: 'number',
276-
dflt: 1,
277-
min: 0,
278-
max: 1,
279-
arrayOk: true,
280-
role: 'style',
281-
description: 'Opacity of the filter bar vertical resize areas on top and bottom.'
282-
},
283-
284-
handleoverlap: {
285-
valType: 'number',
286-
dflt: 0,
287-
min: 0,
288-
max: 4,
289-
role: 'style',
290-
description: [
291-
'If zero, the vertical resize areas on top and bottom are just above and below the filter bar itself.',
292-
'A larger than zero value causes overlaps with the filter bar. The overlap is represented as pixels.'
293-
].join(' ')
294-
}
295210
}
296211
};

src/traces/parcoords/calc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ module.exports = function calc(gd, trace) {
8181
return polylinearUnitScales.map(function(s) {
8282
return s(cScale(d));
8383
});
84-
},
85-
filterbar: trace.filterbar
84+
}
8685
}];
8786
};

src/traces/parcoords/defaults.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var attributes = require('./attributes');
1313
var hasColorscale = require('../../components/colorscale/has_colorscale');
1414
var colorscaleDefaults = require('../../components/colorscale/defaults');
1515

16-
// todo unify with scatter/line_defaults.js (which needs to handle line width and dash as well)
1716
var handleLineDefaults = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce) {
1817
var markerColor = (traceIn.marker || {}).color;
1918

@@ -83,16 +82,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
8382
coerce('domain.x');
8483
coerce('domain.y');
8584

86-
87-
coerce('filterbar.width');
88-
coerce('filterbar.fillcolor');
89-
coerce('filterbar.fillopacity');
90-
coerce('filterbar.strokecolor');
91-
coerce('filterbar.strokeopacity');
92-
coerce('filterbar.strokewidth');
93-
coerce('filterbar.handleheight');
94-
coerce('filterbar.handleoverlap');
95-
9685
coerce('line.color');
9786

9887
coerce('lines.contextcolor');

src/traces/parcoords/parcoords.js

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ var d3 = require('d3');
1515
var overdrag = 40;
1616
var legendWidth = 80;
1717

18+
var filterBar = {
19+
width: 4, // Visible width of the filter bar
20+
capturewidth: 20, // Mouse-sensitive width for interaction (Fitts law)
21+
fillcolor: 'magenta', // Color of the filter bar fill
22+
fillopacity: 1, // Filter bar fill opacity
23+
strokecolor: 'white', // Color of the filter bar side lines
24+
strokeopacity: 1, // Filter bar side stroke opacity
25+
strokewidth: 1, // Filter bar side stroke width in pixels
26+
handleheight: 16, // Height of the filter bar vertical resize areas on top and bottom
27+
handleopacity: 1, // Opacity of the filter bar vertical resize areas on top and bottom
28+
handleoverlap: 0 // A larger than 0 value causes overlaps with the filter bar, represented as pixels.'
29+
};
30+
1831
function keyFun(d) {return d.key;}
1932

2033
function repeat(d) {return [d];}
@@ -98,10 +111,6 @@ function model(layout, d, i) {
98111
var canvasWidth = width * canvasPixelRatio + 2 * lines.canvasOverdrag;
99112
var canvasHeight = height * canvasPixelRatio;
100113

101-
var resizeHeight = d.filterbar.handleheight;
102-
var brushVisibleWidth = d.filterbar.width;
103-
var brushCaptureWidth = d.filterbar.capturewidth || Math.min(32, brushVisibleWidth + 16);
104-
105114
return {
106115
key: i,
107116
dimensions: data,
@@ -115,11 +124,7 @@ function model(layout, d, i) {
115124
canvasHeight: canvasHeight,
116125
width: width,
117126
height: height,
118-
brushVisibleWidth: brushVisibleWidth,
119-
brushCaptureWidth: brushCaptureWidth,
120-
resizeHeight: resizeHeight,
121-
canvasPixelRatio: canvasPixelRatio,
122-
filterBar: d.filterbar
127+
canvasPixelRatio: canvasPixelRatio
123128
};
124129
}
125130

@@ -197,9 +202,9 @@ module.exports = function(root, styledData, layout, callbacks) {
197202
filterBarPattern.enter()
198203
.append('pattern')
199204
.attr('id', 'filterBarPattern')
200-
.attr('width', function(d) {return d.model.brushCaptureWidth;})
205+
.attr('width', filterBar.capturewidth)
201206
.attr('height', function(d) {return d.model.height;})
202-
.attr('x', function(d) {return -d.model.brushVisibleWidth;})
207+
.attr('x', -filterBar.width)
203208
.attr('patternUnits', 'userSpaceOnUse');
204209

205210
var filterBarPatternGlyph = filterBarPattern.selectAll('rect')
@@ -208,14 +213,14 @@ module.exports = function(root, styledData, layout, callbacks) {
208213
filterBarPatternGlyph.enter()
209214
.append('rect')
210215
.attr('shape-rendering', 'crispEdges')
211-
.attr('width', function(d) {return d.model.brushVisibleWidth;})
216+
.attr('width', filterBar.width)
212217
.attr('height', function(d) {return d.model.height;})
213-
.attr('x', function(d) {return d.model.brushVisibleWidth / 2;})
214-
.attr('fill', function(d) {return d.model.filterBar.fillcolor;})
215-
.attr('fill-opacity', function(d) {return d.model.filterBar.fillopacity;})
216-
.attr('stroke', function(d) {return d.model.filterBar.strokecolor;})
217-
.attr('stroke-opacity', function(d) {return d.model.filterBar.strokeopacity;})
218-
.attr('stroke-width', function(d) {return d.model.filterBar.strokewidth;});
218+
.attr('x', filterBar.width / 2)
219+
.attr('fill', filterBar.fillcolor)
220+
.attr('fill-opacity', filterBar.fillopacity)
221+
.attr('stroke', filterBar.strokecolor)
222+
.attr('stroke-opacity', filterBar.strokeopacity)
223+
.attr('stroke-width', filterBar.strokewidth);
219224
}
220225

221226
var parcoordsModel = d3.select(root).selectAll('.parcoordsModel')
@@ -419,7 +424,7 @@ module.exports = function(root, styledData, layout, callbacks) {
419424
axisTitle.enter()
420425
.append('text')
421426
.classed('axisTitle', true)
422-
.attr('transform', function(d) {return 'translate(0,' + -(d.model.filterBar.handleheight + 20) + ')';})
427+
.attr('transform', 'translate(0,' + -(filterBar.handleheight + 20) + ')')
423428
.text(function(d) {return d.label;})
424429
.attr('text-anchor', 'middle')
425430
.style('font-family', 'sans-serif')
@@ -440,7 +445,7 @@ module.exports = function(root, styledData, layout, callbacks) {
440445
axisExtentTop.enter()
441446
.append('g')
442447
.classed('axisExtentTop', true)
443-
.attr('transform', function(d) {return 'translate(' + 0 + ',' + -(d.model.filterBar.handleheight - 2) + ')';});
448+
.attr('transform', 'translate(' + 0 + ',' + -(filterBar.handleheight - 2) + ')');
444449

445450
var axisExtentTopText = axisExtentTop.selectAll('.axisExtentTopText')
446451
.data(repeat, keyFun);
@@ -462,7 +467,7 @@ module.exports = function(root, styledData, layout, callbacks) {
462467
axisExtentBottom.enter()
463468
.append('g')
464469
.classed('axisExtentBottom', true)
465-
.attr('transform', function(d) {return 'translate(' + 0 + ',' + (d.model.height + d.model.filterBar.handleheight - 2) + ')';});
470+
.attr('transform', function(d) {return 'translate(' + 0 + ',' + (d.model.height + filterBar.handleheight - 2) + ')';});
466471

467472
var axisExtentBottomText = axisExtentBottom.selectAll('.axisExtentBottomText')
468473
.data(repeat, keyFun);
@@ -498,8 +503,8 @@ module.exports = function(root, styledData, layout, callbacks) {
498503

499504
axisBrushEnter
500505
.selectAll('rect')
501-
.attr('x', function() {var d = this.parentElement.parentElement.__data__; return -d.model.brushCaptureWidth / 2;})
502-
.attr('width', function() {var d = this.parentElement.parentElement.__data__; return d.model.brushCaptureWidth;});
506+
.attr('x', -filterBar.capturewidth / 2)
507+
.attr('width', filterBar.capturewidth);
503508

504509
axisBrushEnter
505510
.selectAll('rect.extent')
@@ -509,17 +514,17 @@ module.exports = function(root, styledData, layout, callbacks) {
509514

510515
axisBrushEnter
511516
.selectAll('.resize rect')
512-
.attr('height', function() {var d = this.parentElement.parentElement.__data__; return d.model.resizeHeight;})
517+
.attr('height', filterBar.handleheight)
513518
.attr('opacity', 0)
514519
.style('visibility', 'visible');
515520

516521
axisBrushEnter
517522
.selectAll('.resize.n rect')
518-
.attr('y', function() {var d = this.parentElement.parentElement.__data__; return -d.model.resizeHeight + d.model.filterBar.handleoverlap;});
523+
.attr('y', filterBar.handleoverlap - filterBar.handleheight);
519524

520525
axisBrushEnter
521526
.selectAll('.resize.s rect')
522-
.attr('y', function() {var d = this.parentElement.parentElement.__data__; return -d.model.filterBar.handleoverlap;});
527+
.attr('y', filterBar.handleoverlap);
523528

524529
var justStarted = false;
525530
var contextShown = false;

test/jasmine/tests/parcoords_test.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)