Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 条形图上的Highchart项目单击事件_Javascript_Jquery_Highcharts - Fatal编程技术网

Javascript 条形图上的Highchart项目单击事件

Javascript 条形图上的Highchart项目单击事件,javascript,jquery,highcharts,Javascript,Jquery,Highcharts,我有两个不同的功能(功能A和B)。在工具栏上单击项不能同时调用这两个函数 series: [{ name: 'Chart 1', data: [{ y: 1, name: 'apple' }, { y: 64, name: 'mango' }, { y: 89, name: 'banana'

我有两个不同的功能(功能A和B)。在工具栏上单击项不能同时调用这两个函数

series: [{
        name: 'Chart 1',
        data: [{
            y: 1,
            name: 'apple'
        }, {
            y: 64,
            name: 'mango'
        }, {
            y: 89,
            name: 'banana'
        }],
        point: { events: { click: function A, function B } }
    }]
});

上面的代码抛出了错误,因为我可以在我的浏览器上看到空白屏幕

我认为您应该像这里一样使用click事件。 定义一个同时调用a和B的函数

point: { events: { click: function (e) {
   A();B();
 }}
我已经更新了你的例子。。有很多错误

我做了一些编辑,只是为了在单击第一个图表时显示图表3


请参阅click Event的文档我在FireBug上找不到任何错误这不是我想要的:(你想要什么?完美的同步?是的..两个函数都应该同步调用为什么你需要这个?你确定吗?我认为在你的场景中,我的解决方案很好…先隐藏然后绘制新图表。这是个问题吗?B在A结束后执行。)
$(function () {
var data = {
        animal: [2,3,1,6],                                                    
        vehicle: [03, 15, 14],
        fruits: [20,50 ,100]
    };
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            type: 'bar'
        },
        plotOptions: {
            bar: {
                point: {
                    events: {
                        click:     function (e) {
   hideChart(e);Chart3(e);
 }
                    }
                }
            }
        },
        series: [
{
            data: [{
                y: 100,
                name: 'animal'
            }, {
                y: 34,
                name: 'vehicle'
            }, {
                y: 67,
                name: 'fruits'
            }]
        }]
    });
function hideChart(e) {

                    $("#container").toggle();
             }

    function Chart2(e) {

        var point = this;

        $("#detail").highcharts({
    chart: {
        type: 'column'
     },
plotOptions: {
            series: {

                point: {
                    events: {
                        click: function (e) {
   Chart3(e);
 }
                    }
                }
            }
        }, title: {
                text: point.name + ':' + point.y
            },

           series: [{
        name: 'series 2',
        colorByPoint: true,
                data: data[point.name]
            }]
        });
    }
function Chart3(e) { 
            var data = [[1, 9], [1],[4,6,7,2,9],[0,5,10],[3,7]];
            $("#sub_detail").highcharts({
                chart: {
                type: 'column',
                useHTML: true,

            },
            plotOptions: {
                series: {

                point: {
                events: {
                click: function() {
                            alert ('Category: ');
                        }
            }
                        },
                    allowPointSelect: true,
                            states: {
                                    select: {
                                        color: null,
                                        borderWidth:5,
                                        borderColor:'Blue'
                                    }
                                }
                    }
            }, 
            title: {
                text: this.x 
            },

            series: [{
                name: 'series 3',
                colorByPoint: true,
                data: data[this.x] 
            }]
            });
        }
});