Click to accumulate [JS] --- JQuery to implement bar chart, which is applicable to multiple choice questions and other statistics. jquery bar chart
Effect:
Idea: front-end JS achieves Dynamic Data effects, and the backend can splice strings or load data with JSON
Code:
<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "tiao. aspx. cs" Inherits = "qiantaoflash. tiao" %> <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head runat =" server "> <title> green apple bar Statistics </title> <link href =" css/jQuery.spider.poll.css "rel =" stylesheet "type =" text/css "/> <script type =" text/javascript "src =" js/jquery-1.4.3.min.js "> </script> <script type =" text/javascript "src =" js/jQuery. spider. poll-min.js "> </script> <script type =" text/javascript "> var data =" {root: [{id: '000000', name: 'Get married first ', value: '50'}, {id: '000000', name: 'start', value: '50'}]} "; var data1 = "{ Root: [{id: '000000', name: 'Alliance ', value: '60'}, {id: '000000', name: 'orch', value: '25'}, {id: '000000', name: 'undead dead ', value: '15'}, {id: '000000', name: 'Night genie ', value: '10'}]} "; var data2 =" {root: [{id: '000000', name: '', value: '0 '}, {id: '000000', name: 'authorization', value: '000000'}]} "; $ (document ). ready (function () {$ ("# poll_a "). poll ("poll1", {title: 'Get married first or make a career first ', width: '600px', data: data}); $ ("# poll_ B "). poll ("poll2", {title: 'Young Apple cannot compete for each race? ', TitleColor: 'red', width: '600px', data: data1, showPoll: true, multiple: true}); $ ("# poll_c "). poll ("poll3", {title: 'important educational qualifications or important competencies ', titleColor: 'Blue', width: '600px ', data: data2, multiple: false }); $ ("# getPollData1 "). click (function () {$ ("# poll_ B "). getChecked (). each (function (I, n) {alert ($ (n ). val () ;}) ;}; $ ("# getPollData2 "). click (function () {$ ("# poll_c "). getChecked (). each (function (I, n) {alert ($ (n ). val ());});});}); </script>
Download Demo:
Http://files.cnblogs.com/files/xinchun/tongjitu.zip