本文共 1694 字,大约阅读时间需要 5 分钟。
把X轴改为这样 xAxis: {categories:obj.tdate, //x轴显示格式['0000-00-00','0000-00-00','0000-00-00','0000-00-00','4','5']labels: {step:2,rotation: -25, align: 'right', style: { font: 'normal 13px Verdana, sans-serif'}}},例子
function chart_line_basic(renderTo, categories, series, legendEnabled) { this.renderTo = renderTo; this.series = series; this.categories = categories; this.legendEnabled = legendEnabled; this.step=0; this.rotation=0; if(categories.length>4) { this.step=2; this.rotation=25; }}chart_line_basic.prototype.formatterTooltip = function () { }chart_line_basic.prototype.showChart = function () { var chart; chart = new Highcharts.Chart({ chart: { renderTo: this.renderTo, type: 'line',// marginRight: 130,// marginBottom: 25 }, title: { text: '', x: -20 //center }, subtitle: { text: '', x: -20 }, xAxis: { labels:{ step:this.step, rotation: this.rotation }, categories: this.categories }, yAxis: { title: { text: '' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: this.formatterTooltip }, legend: { floating: true, layout: 'vertical', align: 'right', verticalAlign: 'top', x: -10, y: 20, borderWidth: 0, enabled: this.legendEnabled }, series: this.series });};
转载地址:http://ufynb.baihongyu.com/