高图表类别中的多行(长文本)



我有这个图:http://jsfiddle.net/ZKGZb/

$(document).ready(function() {
    chart16 = new Highcharts.Chart({
    "chart": {
        "renderTo": "right-22",
        "type": "column",
        "width": 550,
        "height": 400,
    },
    "xAxis": {
        "categories": ["a very long long text ", "2another long text", "dda", "bbb", "aaa"],
        "allowDecimals": "0",
        "title": {
            "text": "Hello world",
            "offset": -350,
            "align": "left",
            "style": {
                "color": "red"
            }
        },    
        "labels":{"useHtml": true       }
    },
    "yAxis": {
        "allowDecimals": false,
        "labels": {
            "overflow": "justify"
        },
        "title": {
            "text": " "
        },
        "max": 20
    },
    "tooltip": {
        "formatter": function() {
            return this.series.name + this.y + "";
        }
    },
    "title": {
        "text": "a very long long text",
        "margin": 50
    },
    "plotOptions": {
        "column": {
            "groupPadding": null,
            "borderWidth": null,
            "dataLabels": {
                "enabled": null,
                "color": null,
                "style": {
                    "fontSize": null,
                    "font-weight": "bold"
                },
                "formatter": function() {
                    return this.series.name + this.y + "";
                }
            }
        }
    },
    "exporting": {
        "enabled": false
    },
    "credits": {
        "enabled": false
    },
    "labels": {
        "enabled": null
    },
    "legend": {
        "enabled": 0,
        "layout": "vertical",
        "align": "top",
        "verticalAlign": "top",
        "y": 0,
        "x": 0,
        "floating": false,
        "borderWidth": 1,
        "backgroundColor": "#FFFFFF",
        "shadow": true
    },
    "series": [{
        "data": [{
            "y": 19,
            },
        {
            "y": 0,
            "name": ""},
        {
            "y": 0,
            "name": ""},
        {
            "y": 1,
            "name": ""},
        {
            "y": 0,
            "name": ""}],
        "name": "Total: "}]
}, function(chartObj) {});
});

如何使类别标签看起来不错?我需要能够显示每个类别的全文,但我找不到一种方法来做到这一点。我尝试添加
并使用"useHtml"选项,但它不起作用提前致谢

"xAxis": {
    "categories": ["a very long long text ", "2another long text", "dda", "bbb", "aaa"],
    "allowDecimals": "0",
    "title": {
        "text": "Hello world",
        "offset": -350,
        "align": "left",
        "style": {
            "color": "red"
        }
    },    

删除"title=>offset"可以修复它。

相关内容

  • 没有找到相关文章

最新更新