One of the simplest charts that we've introduced is a poll, which is a tally of votes or choice selections between a number of options, often displayed as a histogram with the option for a user to make a selection and have it added to the tally. This recipe covers the basics of how to handle that interaction and update the chart.
For setting up a basic page and installing jQuery and Highcharts, refer to the Getting ready section of the Creating your first chart recipe in Chapter 1, Getting Started with Highcharts.
To get started, perform the following steps:
In addition to our container
<div>
, create voting buttons as shown in the following code:<div id='container'></div> <div> Is it easy to create a poll? <input type='button' value='Yes' id='yes' class='vote- btn'></input> <input type='button' value='No' id='no' class='vote- btn'/></input> </div>