blob: f25ce6e1949ad5fd91be67ef084efac7349f97ea [file] [log] [blame]
/*
* echarts默认配置项
* Copyright 2013 Baidu Inc. All rights reserved.
*
* @desc echarts基于Canvas,纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据统计图表。
* @author Kener (@Kener-林峰, linzhifeng@baidu.com)
*
*/
//define(function() {
// 请原谅我这样写,这显然可以直接返回个对象,但那样的话outline就显示不出来了~~
var echartsConfig = {
// 图例
legend: {
orient: 'horizontal', // 布局方式,默认为水平布局,可选为:
// 'horizontal' ¦ 'vertical'
x: 'center', // 水平安放位置,默认为全图居中,可选为:
// 'center' ¦ 'left' ¦ 'right'
// ¦ {number}(x坐标,单位px)
y: 'top', // 垂直安放位置,默认为全图顶端,可选为:
// 'top' ¦ 'bottom' ¦ 'center'
// ¦ {number}(y坐标,单位px)
backgroundColor: 'rgba(0,0,0,0)',
borderColor: '#ccc', // 图例边框颜色
borderWidth: 0, // 图例边框线宽,单位px,默认为0(无边框)
padding: 5, // 图例内边距,单位px,默认各方向内边距为5,
// 接受数组分别设定上右下左边距,同css
itemGap: 10, // 各个item之间的间隔,单位px,默认为10,
// 横向布局时为水平间隔,纵向布局时为纵向间隔
// data: [] // 图例内容(详见legend.data,数组中每一项代表一个item
itemWidth: 20, // 图例图形宽度,非标准参数
itemHeight: 14, // 图例图形高度,非标准参数
textStyle: {
color: '#333' // 图例文字颜色
}
},
toolbox: {
show : false,
orient: 'horizontal', // 布局方式,默认为水平布局,可选为:
// 'horizontal' ¦ 'vertical'
x: 'right', // 水平安放位置,默认为全图右对齐,可选为:
// 'center' ¦ 'left' ¦ 'right'
// ¦ {number}(x坐标,单位px)
y: 'top', // 垂直安放位置,默认为全图顶端,可选为:
// 'top' ¦ 'bottom' ¦ 'center'
// ¦ {number}(y坐标,单位px)
color : ['#1e90ff','#22bb22','#4b0082','#d2691e'],
backgroundColor: 'rgba(0,0,0,0)', // 工具箱背景颜色
borderColor: '#ccc', // 工具箱边框颜色
borderWidth: 0, // 工具箱边框线宽,单位px,默认为0(无边框)
padding: 5, // 工具箱内边距,单位px,默认各方向内边距为5,
// 接受数组分别设定上右下左边距,同css
itemGap: 10, // 各个item之间的间隔,单位px,默认为10,
// 横向布局时为水平间隔,纵向布局时为纵向间隔
itemSize: 16, // 工具箱图形宽度,非标准参数
feature : {
//mark : false,
//refresh : false,
//magicType: []
}
},
// 提示框
tooltip: {
show: true,
trigger: 'item', // 触发类型,默认数据触发,见下图,可选为:'item' ¦ 'axis'
// formatter: null // 内容格式器:{string}(Template) ¦ {Function}
islandFormatter: '{a} <br/>{b} : {c}', // 数据孤岛内容格式器,非标准参数
backgroundColor: 'rgba(0,0,0,0.7)', // 提示背景颜色,默认为透明度为0.7的黑色
borderColor: '#333', // 提示边框颜色
borderRadius: 4, // 提示边框圆角,单位px,默认为4
borderWidth: 0, // 提示边框线宽,单位px,默认为0(无边框)
padding: 5, // 提示内边距,单位px,默认各方向内边距为5,
// 接受数组分别设定上右下左边距,同css
textStyle: {
color: '#fff'
}
},
// 区域缩放控制器
dataZoom: {
show: false,
realtime: false,
orient: 'horizontal', // 布局方式,默认为水平布局,可选为:
// 'horizontal' ¦ 'vertical'
backgroundColor: '#eee', // 背景颜色
dataBackgroundColor: '#ccc', // 数据背景颜色
fillerColor: 'rgba(50,205,50,0.4)', // 填充颜色
handleColor: 'rgba(70,130,180,0.8)' // 手柄颜色
// x: {number}, // 水平安放位置,默认为根据grid参数适配,可选为:
// {number}(x坐标,单位px)
// y: {number}, // 垂直安放位置,默认为根据grid参数适配,可选为:
// {number}(y坐标,单位px)
// width: {number}, // 指定宽度,横向布局时默认为根据grid参数适配
// height: {number}, // 指定高度,纵向布局时默认为根据grid参数适配
// xAxisIndex: [], // 默认控制所有横向类目
// yAxisIndex: [], // 默认控制所有横向类目
// start: 0, // 默认为0
// end: 100, // 默认为全部 100%
// zoomLock: false // 是否锁定选择区域大小
},
// 网格
grid: {
x: 80,
y: 60,
// width: {totalWidth} - (2 * x),
// height: {totalHeight} - (2 * y)
backgroundColor: '#fff',
borderWidth: 1,
borderColor: '#ccc'
},
// 类目轴
categoryAxis: {
position: 'bottom', // 位置
boundaryGap: true, // 类目起始和结束两端空白策略
axisLine: { // 坐标轴线
show: true, // 默认显示,属性show控制显示与否
lineStyle: { // 属性lineStyle控制线条样式
color: '#48b',
width: 2,
style: 'solid'
}
},
axisTick: { // 坐标轴小标记
show: false, // 属性show控制显示与否,默认不显示
length :4, // 属性length控制线长
lineStyle: { // 属性lineStyle控制线条样式
color: '#ccc',
width: 1
}
},
axisLabel: { // 坐标轴文本标签,详见axis.axisLabel
show: true,
interval: 'auto',
rotate: 0,
margin: 8,
// formatter: null,
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
color: '#333'
}
},
splitLine: { // 分隔线
show: true, // 默认显示,属性show控制显示与否
lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
color: '#ccc',
width: 1,
style: 'solid'
}
},
splitArea: { // 分隔区域
show: false, // 默认不显示,属性show控制显示与否
areaStyle: { // 属性areaStyle(详见areaStyle)控制区域样式
color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'],
type: 'default'
}
}
},
// 数值型坐标轴默认参数
valueAxis: {
position: 'left', // 位置
boundaryGap: [0, 0], // 数值起始和结束两端空白策略
// min: null, // 最小值
// max: null, // 最大值
precision: 0, // 小数精度,默认为0,无小数点
power: 100, // 整数精度,默认为100,个位和百位为0
splitNumber: 5, // 分割段数,默认为5
axisLine: { // 坐标轴线
show: true, // 默认显示,属性show控制显示与否
lineStyle: { // 属性lineStyle控制线条样式
color: '#48b',
width: 2,
style: 'solid'
}
},
axisTick: { // 坐标轴小标记
show: false, // 属性show控制显示与否,默认不显示
length :4, // 属性length控制线长
lineStyle: { // 属性lineStyle控制线条样式
color: '#ccc',
width: 1
}
},
axisLabel: { // 坐标轴文本标签,详见axis.axisLabel
show: true,
rotate: 0,
margin: 8,
// formatter: null,
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
color: '#333'
}
},
splitLine: { // 分隔线
show: true, // 默认显示,属性show控制显示与否
lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
color: '#ccc',
width: 1,
style: 'solid'
}
},
splitArea: { // 分隔区域
show: false, // 默认不显示,属性show控制显示与否
areaStyle: { // 属性areaStyle(详见areaStyle)控制区域样式
color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'],
type: 'default'
}
}
},
// 柱形图默认参数
bar: {
// stack: null
xAxisIndex: 0,
yAxisIndex: 0,
barMinHeight: 20
// barWidth: null // 默认自适应
},
// 折线图默认参数
line: {
// stack: null
xAxisIndex: 0,
yAxisIndex: 0,
itemStyle: {
normal: {
// color: 各异,
lineStyle: {
width: 1,
style: 'solid'
}
},
emphasis: {
// color: 各异,
}
},
//brokenPoint: null, // 拐点图形类型,非标准参数
brokenPointSize: 4 // 可计算特性参数,空数据拖拽提示图形大小
},
// 饼图默认参数
pie: {
// center: null, // 默认全局居中
// radius: [0, min(width,height) - 50],
startAngle: 0,
minAngle: 5,
itemStyle: {
normal: {
label: {
show: true,
position: 'outer'
// textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
},
labelLine: {
show: true,
length: 30,
lineStyle: {
// color: 各异,
width: 1,
style: 'solid'
}
}
},
emphasis: {
label: {
show: false,
position: 'outer'
// textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
},
labelLine: {
show: false,
length: 40,
lineStyle: {
// color: 各异,
width: 1,
style: 'solid'
}
}
}
}
},
island: {
r: 15,
calculateStep: 0.1 // 滚轮可计算步长 0.1 = 10%
},
textStyle: {
decoration: 'none',
fontFamily: 'Arial, Verdana, sans-serif',
fontSize: 12,
fontStyle: 'normal',
fontWeight: 'normal'
},
// 默认色板
color: ['#ff7f50','#87cefa','#da70d6','#32cd32','#6495ed',
'#ff69b4','#ba55d3','#cd5c5c','#ffa500','#40e0d0',
'#1e90ff','#ff6347','#7b68ee','#00fa9a','#ffd700',
'#6b8e23','#ff00ff','#3cb371','#b8860b','#30e0e0'],
// 可计算特性配置,孤岛,提示颜色
calculable: false, // 默认开启可计算特性
calculableColor: 'rgba(255,165,0,0.6)', // 拖拽提示边框颜色
calculableHolderColor: '#ccc', // 可计算占位提示颜色
nameConnector: ' & ',
valueConnector: ' : ',
animation: true,
animationDuration: 2000,
animationEasing: 'BounceOut',
// 图表类型
CHART_TYPE_LINE: 'line',
CHART_TYPE_BAR: 'bar',
// CHART_TYPE_SCATTER: 'scatter',
CHART_TYPE_PIE: 'pie',
// CHART_TYPE_RADAR: 'radar',
// CHART_TYPE_ISLAND: 'island',
// 事件类型
EVENT: {
REFRESH: 'refresh',
CLICK: 'click',
HOVER: 'hover',
// -------
DATA_CHANGED: 'dataChanged',
DATA_ZOOM: 'dataZoom',
LEGEND_SELECTED: 'legendSelected',
MAGIC_TYPE_CHANGED: 'magicTypeChanged',
DATA_VIEW_CHANGED: 'dataViewChanged'
}
};
// return config;
//});