Selectable Chart Data
Last updated
Last updated
This example demonstrates how you can use a dropdown menu to allow a user to select, or filter, the data displayed on a column chart.
Uses jQuery Selectors, the jQuery val function, and the jQuery change function.
The select
element will be used to filter the data for a column chart that will be inserted in the "chart2" div
.
Add the following code to the bottom of the setup()
function. This will "listen" for changes to the dropdown selector and re-run the composeCharts()
function when it is changed.
The following "viz.chart" function defines a column chart that will use the value selected by the user in the SQL to retrieve the right column of data to chart.