当我点击堆叠的高位图条时,触发一个引导模态

sur*_*oju 1 javascript jquery highcharts twitter-bootstrap

当我点击堆叠的highcharts列时,我试图触发一个bootstrap模式.正如我试图弄清楚当我点击高图中的不同列时,模态值必须根据1s中的值进行更改

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'area',
			options2d: {
                enabled: true,
                alpha: 45,
                beta: 0
            }
        },
		title: {
            text: 'Exams Report'
        },
        xAxis: {
		    title: {
                text: 'Classes'
            },
            categories: ['1st class', '2nd class', '3rd class', '4th class', '5th class','6th class', '7th class', '8th class', '9th class', '10th class']
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Exams Report'
            },			
            stackLabels: {
                enabled: false,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
                }
            }
        },
        legend: {
            align: 'right',
            x: -30,
            verticalAlign: 'top',
            y: 25,
            floating: true,
            backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
            borderColor: '#CCC',
            borderWidth: 1,
            shadow: false
        },
        tooltip: {
            formatter: function () {
                return '<b>' + this.x + '</b><br/>' +
                    this.series.name + ': ' + this.y + '<br/>' +
                    'Total: ' + this.point.stackTotal;
            }
        },

        plotOptions: {
            area: {
                stacking: 'normal',
                cursor: 'pointer',
                point: {
                    events: {
                        click: function () {
							window.location.href= "details_sub_reports.html?subject="+this.x+"&completed="+this.y+"&report=lesson";
                        }
                    }
                },dataLabels: {
             
          enabled: true,
          color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'black', 
          style: {
                    textShadow: '0 0 3px 0'
                 }
                }
            }
        },

        series: [{
        name: 'Passed',
        data: [5, 3, 4, 7, 4, 9, 5, 6, 8, 7],
		color:'#4DB84D'
    }, {
        name: 'Failed',
        data: [1, 2, 3, 2, 2, 5, 6, 2, 3, 4],
		color:'#FF6666'
    }]
    });	
});
 
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/datacharts.js"></script>
<script src="http://code.highcharts.com/modules/drilldown.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div id="container" data-toggle="modal" data-target="#myModal" style="height: 350px;width:600px;"><a></a></div>
		<div id="div3_example" data-toggle="modal" data-target="#myModal" style="margin:10px 0 30px 0; width:200px; height:230px;"> </div>
			<div id="myModal" class="modal fade" role="dialog">
								<div class="modal-dialog modal-dialog-lg">
									<!-- Modal content-->
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal">&times;</button>
											<h4 class="modal-title">Faculty Schedule</h4>
										</div>
										<div class="modal-body">
											<div id="container2" style="height: 350px;width:500px;"></div>
										
										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
										</div>
									</div>
								</div>
							</div>
Run Code Online (Sandbox Code Playgroud)

t堆积柱形图

Pat*_*son 5

这是两部分答案:

首先,查看highcharts API文档,您可以使用"click"方法来启动自己的javascript.

请参阅Highcharts APIHighcharts小提琴

其次,使用:

$('#myModal').modal('show');
Run Code Online (Sandbox Code Playgroud)

打开适用的bootstrap模式.

请参阅Bootstrap API另一个SE问题/答案