Skip to content

Bug: NumberRangeFilter and filtering values between 0 and 1.  #861

@orwant

Description

@orwant
What steps will reproduce the problem? Please provide a link to a
demonstration page if at all possible, or attach code.

I have a table with values between 0 and 1 (i.e. 0.33 etc) which I want to filter using
a NumberRangeFilter. Everything works fine except that the NumberRangeFilter only can
be 0 or 1... nothing in between. It seems that unitIncrement cant be smaller than 1.


Below is code you can use on Google Chart Playground to simulate the bug: 

function drawVisualization() {
  // Prepare the data
  var data = google.visualization.arrayToDataTable([
    ['Name', 'Age'],
    ['Michael' , 0.12],
    ['Elisa', 0.20],
    ['Robert', 0.7],
    ['John', 0.54],
    ['Jessica', 0.22],
    ['Aaron', 0.3],
    ['Margareth', 0.42],
    ['Miranda', 0.33]
  ]);

  // Define a NumberRangeFilter slider control for the 'Age' column.
  var slider = new google.visualization.ControlWrapper({
    'controlType': 'NumberRangeFilter',
    'containerId': 'control1',
    'options': {
      'filterColumnLabel': 'Age',
      'minValue': 0,
      'maxValue': 1,
      'ui': {'unitIncrement' : 0.01}
    }
  });

  // Define a bar chart
  var barChart = new google.visualization.ChartWrapper({
    'chartType': 'BarChart',
    'containerId': 'chart1',
    'options': {
      'width': 400,
      'height': 300,
      'hAxis': {'minValue': 0, 'maxValue': 1},
      'chartArea': {top: 0, right: 0, bottom: 0}
    }
  });

  // Create the dashboard.
  var dashboard = new
google.visualization.Dashboard(document.getElementById('dashboard')).
    // Configure the slider to affect the bar chart
    bind(slider, barChart).
    // Draw the dashboard
    draw(data);

} 


What component is this issue related to (PieChart, LineChart, DataTable,
Query, etc)?

NumberRangeFilter as far as I have tested. Might be more components that are affected.



Are you using the test environment (version 1.1)?
(If you are not sure, answer NO)

NO


What operating system and browser are you using?

Windows 7 and FF 11.0. 

*********************************************************
For developers viewing this issue: please click the 'star' icon to be
notified of future changes, and to let us know how many of you are
interested in seeing it resolved.
*********************************************************

Original issue reported on code.google.com by bassam.safar on 2012-03-23 20:48:26

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions