如何使用ui-bootstrap指令在打开的模态窗口中绘制Highcharts?

时间:2015-11-02 03:59:16

标签: highcharts angular-ui-bootstrap bootstrap-modal

我的代码是

public void onEnable() {
    try {
        setupConfig(getConfig());
        saveConfig();
    } catch (Exception e) {
        e.printStackTrace();
    }

模态控制器

  factory('modalWindowFactory', function ($modal) {

     var modalWindowController = _modalWindowController;

     return {
        show: function (title, name,data,confirmCallback, cancelCallback) {


        // Show window
        var modalInstance = $modal.open({
            animation : true,
            templateUrl: '/static/views/common/modal-view.html',
            controller: modalWindowController,
            size: 'lg',
            resolve: {
                title: function () {
                    return title;
                },
                name :function(){
                    return name;
                },
                data :function(){
                    return data;
                }
            }
        });

我绑定了一个单击函数来打开这个模态,但当我点击打开模态窗口时,只有没有任何高级图表的文本,我的高图代码也单独工作,http://jsfiddle.net/3a33rqdv/

我不知道现在该做什么

我通过使用$ ModalInstance.rendered解决了它。然后,它是一个承诺类型,谢谢大家

1 个答案:

答案 0 :(得分:0)

从以下代码中获取参考,并在指令中使用相同的逻辑:

 $('[data-toggle=popover]').popover({
content: "<div id='container' style='min-width: 300px;display:none;
height: 200px; margin: 0'> <div id='Austin' style='width: 300px; height:
200px;'></div></div>",
 html: true
 })
.click(function() {
var chart_data = getChartData();
var chart = new Highcharts.Chart( chart_data );
$('#container').show();
});

Here is my fiddle for refrence