这个x轴宽度的设置整了好久,被老板催的要死
highcharts的api文档很难找,找了半天也没找到,网上资料少,说的试了下,也没有,我用的图里api文档里没有介绍,这个属性不知道的话,根本不好找。为此,记录下这次事件
实例代码:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/jsp/include/include_taglibs.jsp"%> { "code":0, "data":{ "content":" <script type='text/javascript'> try{ var options = { chart: { renderTo: '${biz}Trend', type: 'spline', height: 215, 460 }, exporting: { enabled: false }, title: { text: '', x: -20 }, subtitle: { text: '趋势分析', x: -160 }, xAxis: { maxPadding : 0.1, minPadding : 0.1, tickWidth:5, type: 'datetime', labels: { rotation: -20, y: 30, formatter: function() { return Highcharts.dateFormat('%Y-%m-%d', this.value); } } }, yAxis: { title: { text: '' }, min: 0 }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ Highcharts.dateFormat('%Y-%m-%d', this.x) +': '+ this.y; } }, series: [ <s:iterator id='aqtsMap' value='#request.quoteTrendsSeries' status='astat'> { <s:iterator id='bqtsKey' value='#aqtsMap.keySet()' status='bstat'> <s:set name='cqtsList' value='#aqtsMap.get(#bqtsKey)'></s:set> name: '${bqtsKey}', data: [ <s:iterator id='dqts' value='#cqtsList' status='dstat'> [Date.UTC(<s:date name='#dqts.time' format='yyyy'/>,Highcharts.numberFormat(<s:date name='#dqts.time' format='MM'></s:date>,0)-1,<s:date name='#dqts.time' format='dd'/>),<s:property value='#dqts.count'/>]<s:if test='!#dstat.last'>,</s:if> </s:iterator> ] </s:iterator> } <s:if test='!#astat.last'>,</s:if> </s:iterator> ] }; var chart = new Highcharts.Chart(options); }catch(e){} </script> "}}