

To do this, you use the applyRangeFilter method,įinally, you can clear the filters. See countries where the GDP is greater than $40K, but less than $60K. You can create a filter for the x-axis, the "F: GDP per capita (curr $)" field, and specify that you only want to However, you can also create new filters.

The filters you've seen so far have all had associated quick filters in the view. You can also include all values in the filter by using ALL. Similarly, you can remove values from the filter by using REMOVE: Which instructs the view to add additional criteria to the filter instead of replacing the values that are currently filtered: Also note that ADD is used instead of REPLACE, Specifying an array of values instead of a single value. The next code sample shows you how to add two more values to the filter, using the same syntax but instead

You should now see that the view is filtered and only "The Americas" check box is selected under the Region The following code filters the "Region" field to show only "The Americas": On a Worksheet object, which was cached in the activeSheet variable in step 1. This is done using the applyFilterAsync method In the view above, there are already Region and Year quick filter controls,īut you can use the API to more tightly control what gets filtered. Using jQuery, this can be done using jQuery's ready handler:įiltering is a core capability of Tableau Server. Typically you'll want to create the view when the page has finished loading and the browser is ready. Variables were declared as global variables in the actual In this case, theįunction caches the workbook and activeSheet variables so they can be used later on. OnFirstInteractive option allows you to perform actions once the view has finished loading. In the code above, the constructor for the Viz object handles loading the view. If you don't seeĪ view above, it may need a few more moments to load, or you may need to use a different web browser. You should now see a view with which you can interact, just like you can with views on Tableau Server. Viz = new tableau.Viz(placeholderDiv, url, options)

Var placeholderDiv = document.getElementById("tableauViz") To do this, you create a new Viz object, passing the required parentElement ( document.getElementByID) and url parameters, along withĪny options, such as hideTabs and hideToolbar. As you build your web application, the first step is to create, or instantiate the view.
