HIGHCHARTS - 基于先前列值

时间:2016-09-27 14:45:09

标签: javascript jquery highcharts

我在使用Highcharts时遇到了一些问题。

我需要绘制第三列的高度" C"基于列的值" B" (默认情况下,列#34; C"的高度绘制基于列" A") 我创建了一个简单的示例here

$('#container').each(function () {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: this,
                type: 'column',
                margin: 0,
                spacingTop: 0
            },
            title: {
                text: ''
            },
            xAxis: {
                categories: [
                'A',
                'B',
                'C'
                ], title: {
                    text: null
                },
                labels: {
                    style: {
                        fontSize: '9px',
                        font: '9px Arial, Helvetica'
                    },
                    enabled: false
                }
            },
            yAxis: {
                endOnTick: false,
                maxPadding: 0.1,
                gridLineColor: 'transparent',
                minorTickLength: 0,
                tickLength: 0,
                min: 0,
                title: {
                    text: ''
                },
                labels: {
                    enabled: false
                }
            }, tooltip: {
                pointFormat: ' <b>{point.val}</b> ',
                shared: true
            },
            legend: {
                enabled: true
            },
            plotOptions: {
                bar: {
                    slicedOffset: 0,
                    size: '100%',
                    dataLabels: {
                        enabled: false
                    }
                },
                series: {
                    slicedOffset: 0,
                    shadow: false,
                    borderWidth: 0,
                    dataLabels: {
                        enabled: true,
                        formatter: function () {
                            return this.y + '%';
                        }
                    }
                }
            },
            legend: {
                itemStyle: {
                    fontSize: '8px',
                    font: '8px Arial, Helvetica'
                },
                enabled: false
            },
            credits: {
                enabled: false
            },
            series: [{
                data: [
                    { y:100, val: 2111, color: '#199ED8' },
                    { y: Math.round(748 / 2111 * 100), val: 748, color: '#6CF' },
                    { y: Math.round(433 / 748 * 100), val: 433, color: '#6FF' }
                ],
                connectNulls: true,
                pointWidth: 58
            }], exporting: {
                buttons: {
                    contextButton: {
                        enabled: false
                    }
                }
            }
        });
    });

1 个答案:

答案 0 :(得分:1)

我在这种情况下与Julio合作,我们解决了这个问题。 决议:http://jsfiddle.net/JVNjs/1203/

?colMeans