Note that there are some explanatory texts on larger screens.

plurals
  1. POget the type of Category filter control
    text
    copied!<p>I have a simple Google visualization dashboard with following code.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8"/&gt; &lt;title&gt; Google Visualization API Sample &lt;/title&gt; &lt;script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.load('visualization', '1.1', {packages: ['controls']}); &lt;/script&gt; &lt;script type="text/javascript"&gt; function drawVisualization() { // Prepare the data var data = google.visualization.arrayToDataTable([ ['Name', 'Gender', 'Age', 'Donuts eaten'], ['Michael' , 'Male', 12, 5], ['Elisa', 'Female', 20, 7], ['Robert', 'Male', 7, 3], ['John', 'Male', 54, 2], ['Jessica', 'Female', 22, 6], ['Aaron', 'Male', 3, 1], ['Margareth', 'Female', 42, 8], ['Miranda', 'Female', 33, 6] ]); // Define a category picker control for the Gender column var categoryPicker = new google.visualization.ControlWrapper({ 'controlType': 'CategoryFilter', 'containerId': 'control1', 'options': { 'filterColumnLabel': 'Gender', 'ui': { 'labelStacking': 'vertical', 'allowTyping': false, 'allowMultiple': false } } }); // Define a table var table = new google.visualization.ChartWrapper({ 'chartType': 'Table', 'containerId': 'chart1', 'options': { 'width': '300px' } }); // Create a dashboard new google.visualization.Dashboard(document.getElementById('dashboard')). bind(categoryPicker,table). // Draw the entire dashboard. draw(data); } google.setOnLoadCallback(drawVisualization); &lt;/script&gt; &lt;/head&gt; &lt;body style="font-family: Arial;border: 0 none;"&gt; &lt;div id="dashboard"&gt; &lt;table&gt; &lt;tr style='vertical-align: top'&gt; &lt;td style='width: 300px; font-size: 0.9em;'&gt; &lt;div id="control1"&gt;&lt;/div&gt; &lt;/td&gt; &lt;td style='width: 600px'&gt; &lt;div style="float: left;" id="chart1"&gt;&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I want to access the categoryfilter using an if condition in my javascript (assume I have 5 category filters bound each other). That is, I want something like </p> <pre><code>function myfunction() { var whereClauses = []; if (categorypicker1.statechange) { whereClauses.push("something1 = '" + categorypicker1.changedstate + "'") } if (categorypicker2.statechange) { whereClauses.push("something2 = '" + categorypicker2.changedstate + "'") } whereClause = whereClauses.join(" AND "); //do something... } </code></pre> <p>But I unable to get the correct format. So what is the correct format to use if condition? ​</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload