Home > 개발가이드 > 언어별 개발가이드

<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://code.highcharts.com/highcharts.js" /></script>
<script type="text/javascript" src="https://code.highcharts.com/modules/exporting.js" /></script>
<script type="text/javascript">
	function getChartData() {
	    $.ajax({
	        url: 'https://open.assembly.go.kr/portal/openapi/ncocpgfiaoituanbr?AGE=21&BILL_NO=2106221&Type=json',
	        type: 'GET',
	        dataType: 'json',
	        success: function (result) {
	            drawBarChart(result);
	        },
	        error: function (result) {}
	    });
	}

	function drawBarChart(jsonData) {
	    var data = jsonData.ncocpgfiaoituanbr[1].row;
	
	    $('#barChart').highcharts({
	        credits: {enabled: false},
	        chart:  {type: 'column'},
	        title:  {text: data[0].BILL_NAME},
	        legend: {enabled: false},
	        xAxis:  {type: 'category'},
	        yAxis: {
	            title: {
	                text: ""
	            }
	
	        },
	        series: [{
	            name: "",
	            colorByPoint: true,
	            data: [{name: "찬성", y: data[0].YES_TCNT},
	                   {name: "반대", y: data[0].NO_TCNT},
	                   {name: "기권", y: data[0].BLANK_TCNT}
	                  ]
	               }]
	    });
	
	}
</script>

<div id="barChart" style="min-width:300px;height:400px;margin:0 auto;"></div>