jquery - HighCharts 参数含义 - plotX,plotLeft,shapeArgs

标签 jquery css highcharts

谁能告诉我从哪里知道不同系列对象的含义,如 plotX、plotLeft 和 all..in highcharts???

我搜索了文档但找不到。

我正在尝试理解这段代码。

$(function () {
$('#container').highcharts({

    chart: {
        type: 'column'
    },


    plotOptions: {
        column: {
            stacking: 'normal',
            point: {
                events: {
                    mouseOver: function () {
                        var chart = this.series.chart,
                            r = chart.renderer,
                            shape = this.shapeArgs,
                            xAxis = this.series.xAxis,
                            yAxis = this.series.yAxis,
                            y = yAxis.toPixels(this.total),
                            x = this.plotX + chart.plotLeft - shape.width / 2,
                            height = yAxis.toPixels(yAxis.min) - y;

                        if (chart.hoverStack) {
                            chart.hoverStack.destroy()
                        }

                        chart.hoverStack = r.rect(x, y, shape.width, height).attr({
                            'stroke-width': 6,
                                'stroke': 'black',
                            fill: 'transparent',
                        }).add();

                    },
                    mouseOut: function () {
                        if (this.series.chart.hoverStack) {
                            this.series.chart.hoverStack.destroy();
                            this.series.chart.hoverStack = false
                        }
                    }
                }
            }
        }
    },
    series: [{
        type: 'column',
        name: 'John',
        data: [3, 3, 3, 3, 3]
    }, {
        type: 'column',
        name: 'Bob',
        data: [5, 3, 4, 7, 2]
    }, {
        type: 'column',
        name: 'Joe',
        data: [2, 2, 2, 2, 2]
    }, {
        type: 'column',
        name: 'Ken',
        data: [3, 4, 4, 2, 5]
    }]
});

});

http://jsfiddle.net/3Utat/25/

最佳答案

对于栏而不是列,使用:

plotOptions: {
        bar: {
            point: {
                events: {
                    mouseOver: function(){
                        console.info(this);
                    }
                }
            }
        }
    }

并查看将鼠标悬停在栏上时获得的值。希望这有帮助

关于jquery - HighCharts 参数含义 - plotX,plotLeft,shapeArgs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28703949/

相关文章:

javascript - 绘制图形后如何更新 highcharts 中的 renderer.text()?

javascript - 如何将 Highcharts 图表嵌入到 jekyll 博客文章中?

jquery - 使用 Jquery 交换表的行

javascript - 如何以现有服务的 Angular 创建工厂

css - 下划线 css3 过渡

html - 容器的 IE8 问题?

javascript - HighCharts 到 2 个或更多相同的 div

javascript - leaflet 使用 jquery 和选择器更改圆半径

jQuery-File-Upload - TypeError : $(. ..).fileupload 不是函数

css - 是否有 CSS 父级选择器?