I'm seeing unexpected behavior using the numberRangeFilter on data with decimals. To illustrate, I've modified a simple dashboard from the docs to include decimal data. I've set the step
property of the numberRangeFilter to move by increments of 0.1.
See jsfiddle here: https://jsfiddle.net/tmys2aj8/
Issues (visible in the JSFiddle):
2)The label on the minimum of the range does not include the lowest data point, despite displaying that bar on the graph
var control = new google.visualization.ControlWrapper({
'controlType': 'NumberRangeFilter',
'containerId': 'numberRangeFilter_control_div',
'options': {
'minValue': 1.0,
'maxValue': 10.0,
'filterColumnIndex': 1,
'ui': {
'showRangeValues':true,
'step': 0.1
}
}
});Workaround: display the true selected range of the numberRangeFilter controller on the page using statechange events, and modifying html on page each time the event fires. Use these new text divs instead of the standard numberRangeFilter labels.
Clumsy, but it works for me.
google.visualization.events.addListener(control, 'statechange', selectHandler);
function selectHandler(e) {var range_selected = control.getState()}
document.getElementById("lower_range_label").innerHTML = "Lower Range:"+range_selected.lowValue
document.getElementById("upper_range_label").innerHTML = "Upper Range:"+range_selected.highValue