jqplot:设置x轴标签max-height

时间:2013-12-30 15:06:08

标签: jqplot

如何减少jqplot的标签高度?

我希望标签分为两个“行”而不是一个。 它将允许max-height,如果label更长,那么它将被分成更多“行”。

var chartData = [[['Portfolio Risk', 1]],
    [['Model Risk', 4]],
    [['Recovery Risk', 3]],
    [['Capability Risk', 1]],
    [['Forward flow risk', 5]]];    
var ticks = ['Portfolio Risk', 'Model Risk', 'Recovery Risk', 'Capability Risk', 'Forward flow risk'];

plot2 = $.jqplot('chart1', chartData, {
    seriesColors: ['#85802b', '#00749F', '#73C774', '#C7754C', '#17BDB8'],
    seriesDefaults: {
        renderer: $.jqplot.BarRenderer,
        rendererOptions: {

        }
    },
    axesDefaults: {
        tickRenderer: $.jqplot.CanvasAxisTickRenderer,
        tickOptions: {
            fontSize: '10pt'
        }
    },
    axes: {
        xaxis: {
            renderer: $.jqplot.CategoryAxisRenderer,
            tickOptions: {
                angle: 90
            },    
        },
        yaxis: {
            tickOptions: {
                formatString: '%d'
            },
            max: 5,
            min: 0
        }
    },
    legend: {
        show: true,
        placement: 'outside',
        labels: ticks
    },
});

在jsfiddle中播放:http://jsfiddle.net/renatevidruska/27EPk/

enter image description here

0 个答案:

没有答案