Click here to Skip to main content
16,015,481 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
<script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['', 'Fill', 'Remaining'],
          ['Form 3',  <?php echo $total; ??>,      <?php echo $remain; ??>],

		
        var options = {
          title: 'Form Data Summary',
		  
          hAxis: {title: 'Form Number', titleTextStyle: {color: '#DC3912'}}
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
	 
    </script>



in the above code i want to give href="#" attribute on 'Form3' .. mean when user click on Form3 a new page open
Posted
Updated 4-May-14 22:30pm
v2

1 solution

I would add an onclick handler on 'chart_div' that would open the requested window.

Add the line below after chart.draw(data, options);
JavaScript
$("#chart_div").on("click", OpenNewWindow());


Then add this method after the google function.

JavaScript
function OpenNewWindow() {
     window.open('https://www.bing.com', '', 'width=800,left=' + ((screen.width / 2) - 400) + ',top=' + ((screen.height / 2) - 300) + ',height=600,status=yes,scrollbars=yes');
}


Note you will need jQuery for this solution.
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.min.js
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900