【问题标题】:How to create a table for legend of a Stacked Chart in Highcharts?如何在 Highcharts 中为堆积图的图例创建表格?
【发布时间】:2014-11-20 06:54:30
【问题描述】:

这是highchart中堆栈图的javascript代码-

 legend: {
 align: 'right',
 x: -70,
 verticalAlign: 'top',
 y: 20,
 floating: true,
 backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
 borderColor: '#CCC',
 borderWidth: 1,
 shadow: false
},

这是我的一系列数据-

series: [{
        name: 'A',
        data: [5]
    }, {
        name: 'B',
        data: [2]
    }, {
        name: 'C',
        data: [3]
    }]

上面的Highcharts(堆积图)数据的图例可以用表格的形式显示吗?

【问题讨论】:

  • 什么是“表格格式”?你能画出你追求的东西吗?
  • 你能附上截图吗,我真的不明白“表格格式”
  • 如果我理解正确,类似this

标签: javascript html highcharts


【解决方案1】:

表格格式的Highcharts(堆叠图表)

http://jsfiddle.net/ntg7qz3q/1/

工作小提琴

 $(function () {
        $('#container').highcharts({
            chart: {
                type: 'bar'
            },
            title: {
                text: 'Stacked bar chart'
            },
            xAxis: {
                categories: ['A', 'B', 'C']
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Total fruit consumption'
                }
            },
            legend: {
     align: 'right',
     x: -70,
     verticalAlign: 'top',
     y: 20,
     floating: true,
     backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
     borderColor: '#CCC',
     borderWidth: 1,
     shadow: false
    },
            plotOptions: {
                series: {
                    stacking: 'normal'
                }
            },
            series: [{
            name: 'A',
            data: [5]
        }, {
            name: 'B',
            data: [2]
        }, {
            name: 'C',
            data: [3]
        }]
        });
    });

【讨论】:

  • 能否以表格的形式显示Highcharts(堆叠图)的上述数据的图例?
猜你喜欢
  • 2019-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-27
  • 1970-01-01
  • 1970-01-01
  • 2020-03-21
相关资源
最近更新 更多