forked from highcharts/highcharts
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
takeseem edited this page Dec 9, 2013
·
4 revisions
- 本项目使用分支dev改进:
- maven在eclipse中正常直接配置为jdk7
- maven package增加源码,方便代码调试
- 移除log4j配置,因为log4j应该由工程来配置,而不是export-convert jar配置
- 整合corsfileter和export controller到convert jar包中,对于war工程来说更加容易配置整合
- 修复调试时phantmatjs必须在jar中,不方便调试
- 环境准备:下载phantomjs,做个符号链接到~/bin/phantomjs(即:保证在path路径中)
- spring bean配置:
<bean id="tempDir" class="com.highcharts.export.util.TempDir"/>
<bean id="serverObjectFactory" class="com.highcharts.export.pool.ServerObjectFactory">
<property name="host" value="127.0.0.1"/>
<property name="basePort" value="7788"/>
<property name="exec" value="${phantomjs.path:phantomjs}"/>
<property name="script" value="highcharts-convert.js"/>
<property name="readTimeout" value="6000"/>
<property name="connectTimeout" value="500"/>
<property name="maxTimeout" value="6500"/>
</bean>
<bean id="serverPool" class="com.highcharts.export.pool.BlockingQueuePool">
<constructor-arg name="factory" ref="serverObjectFactory"/>
<constructor-arg name="number" value="5"/>
<constructor-arg name="maxWait" value="500"/>
<constructor-arg name="retentionTime" value="30000"/>
</bean>
<context:component-scan base-package="com.highcharts.export.converter">
<context:exclude-filter type="regex" expression=".*TestCase"/>
<context:exclude-filter type="regex" expression=".*TestEnv"/>
<context:exclude-filter type="regex" expression=".*\.mvc\..*"/>
</context:component-scan>
- spring servlet配置
<context:component-scan base-package="com.highcharts.export.mvc, cn.com.talkweb.hn.ga.web.mvc">
<context:exclude-filter type="regex" expression=".*TestCase"/>
</context:component-scan>
- 项目WEB-INF/web.xml配置
<filter>
<filter-name>highcharts-cors</filter-name>
<filter-class>com.highcharts.export.mvc.filter.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>highcharts-cors</filter-name>
<url-pattern>/export/*</url-pattern>
</filter-mapping>
- js使用,先在线编辑玩玩
$('#eventChart').highcharts({
chart: conf.chart,
credits: false,
title: {
text: conf.title || '消息数统计'
},
exporting: {
filename: conf.filename,
url: '${site.highchartsExportUrl}',
width: 800
},
xAxis: {
type: 'datetime',
endOnTick: true,
dateTimeLabelFormats: {
day: '%m月%d日',
month: '%y-%m月'
}
},
yAxis: {
min: 0,
title: {
text: '数量(条)'
}
},
tooltip: {
enabled: true,
formatter: function() {
return conf.dateFormat(this.x) + ' ' + this.series.name + ' ' + UtilSite.valueFormat(this.y);
}
},
series: series
});