Last active
August 29, 2015 14:06
-
-
Save wonderbeyond/db6e8dcdde270e865af5 to your computer and use it in GitHub Desktop.
base highcharts options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 基础highcharts选项, 适用于每日行情数据 | |
| */ | |
| var baseHighChartOpts = { | |
| chart: { | |
| zoomType: $(window).width() >= 800? 'x': null, //针对宽度大于800的窗口启用x轴缩放 | |
| height: 320 | |
| }, | |
| title: { | |
| text: null | |
| }, | |
| colors: ['#4B8ED9', '#BF3B30'], //An array containing the default colors for the chart's series. | |
| plotOptions: { | |
| line: { | |
| marker: { | |
| radius: 0, lineColor: '#666666', lineWidth: 1 | |
| }, | |
| shadow: false, | |
| lineWidth: 1 | |
| } | |
| }, | |
| xAxis: { | |
| type: 'datetime', | |
| tickWidth: 0, | |
| maxZoom: 48 * 3600 * 1000, | |
| floor: moment(0).startOf('day'), | |
| minRange: 24*3600*1000, | |
| labels: { | |
| formatter: function(){ | |
| //return this.value; | |
| return moment(this.value).format('YYYY-MM-DD'); | |
| } | |
| } | |
| }, | |
| yAxis: { | |
| title: { | |
| text: null | |
| }, | |
| labels: { | |
| format: '{value}元' | |
| }, | |
| plotLines: [{ | |
| value: 0, | |
| width: 1 | |
| }] | |
| }, | |
| tooltip: { | |
| //xDateFormat: "%Y年%m月%d日(%H:%M:%S)", | |
| formatter: function(){ | |
| var s = [ moment(this.x).format('<small>YYYY-MM-DD</small>') ]; | |
| for(var i in this.points){ | |
| var item = this.points[i]; | |
| var series = item.series; | |
| s.push($.sprintf('<span style="color:%s">%s</span>: %s%s', | |
| series.color, | |
| series.name, | |
| item.y, | |
| series.tooltipOptions.valueSuffix | |
| )); | |
| } | |
| return s.join('<br/>'); | |
| }, | |
| crosshairs: true, | |
| shared: true, | |
| valueSuffix: '元' | |
| }, | |
| legend: { | |
| layout: 'horizontal', //内部布局 | |
| align: 'center', | |
| verticalAlign: 'bottom', | |
| padding: 12, | |
| backgroundColor: 'rgba(200, 200, 200, 0.1)', | |
| borderWidth: 1, | |
| borderColor: '#E6E6E6', | |
| borderRadius: 5 | |
| }, | |
| series: [], | |
| credits: { enabled: false } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment