Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add range attribute and default to rangeslider
  • Loading branch information
mdtusz committed Apr 25, 2016
commit 63658e18766ac52ebc212f7974667b08ec9f9e4d
16 changes: 16 additions & 0 deletions src/components/rangeslider/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ module.exports = {
role: 'style',
description: 'Sets the border color of the range slider.'
},
range: {
valType: 'info_array',
role: 'info',
items: [
{valType: 'number'},
{valType: 'number'}
],
description: [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cldougl wording clear enough?

'Sets the range of the range slider.',
'If not set, defaults to the full xaxis range.',
'If the axis `type` is *log*, then you must take the',
'log of your desired range.',
'If the axis `type` is *date*, then you must convert',
'the date to unix time in milliseconds.'
].join(' ')
},
thickness: {
valType: 'number',
dflt: 0.15,
Expand Down
16 changes: 14 additions & 2 deletions src/components/rangeslider/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, axName, coun
attributes, attr, dflt);
}

coerce('visible');
coerce('thickness');
coerce('bgcolor');
coerce('bordercolor');
coerce('borderwidth');
coerce('thickness');
coerce('visible');
coerce('range');

// Expand slider range to the axis range
if(containerOut.range && !layoutOut[axName].autorange) {
var outRange = containerOut.range,
axRange = layoutOut[axName].range;

outRange[0] = Math.min(outRange[0], axRange[0]);
outRange[1] = Math.max(outRange[1], axRange[1]);
} else {
layoutOut[axName]._needsExpand = true;
}

if(containerOut.visible) {
counterAxes.forEach(function(ax) {
Expand Down