@leevan/jtui
Version:
jt Components
171 lines (155 loc) • 3.75 kB
JavaScript
var data = {
option: { //图表配置
legend: {
data: [],
},
tooltip: {
trigger: 'axis',
formatter: function (params) {
return "";
}
},
grid: {
top:"50",
left: '40',
right: '60',
bottom: '60',
// containLabel: true
},
xAxis: {
name: "年",
type: 'value',
boundaryGap: false,
minorTick: {
show: true,
lineStyle:{
}
},
axisLine:{
show:true,
lineStyle:{}
},
nameTextStyle:{},
splitLine:{
show:true,
lineStyle:{}
},
minorSplitLine: {
show: true,
lineStyle: {
}
},
axisLabel: {
textStyle: { //X轴坐标字体样式
fontSize: 12, //字体大小
// color:"red" //字体颜色
},
formatter: function (value, index) {
return value
}
}
},
yAxis: {
type: 'value',
boundaryGap: false,
name: "值",
axisLine:{
show:true,
lineStyle:{}
},
nameTextStyle:{},
minorTick: {
show: true,
lineStyle:{
color: '#ccc'
}
},
splitLine: {
lineStyle: {
color: '#999'
}
},
minorSplitLine: {
show: true,
lineStyle: {
color: '#ddd'
}
}
},
dataZoom: [{
type: 'inside',
xAxisIndex: [0],
start: 0,
end: 1000
}, ],
series: [{
data: [],
name: "曲线名", //曲线名
smooth: true,
symbolSize: 5, //标记大小
type: "line",
}
],
},
CreateChart: {
startTime: "2018-01-01 01:00:00", //开始时间
endTime: "2018-01-30 02:00:00", //结束时间
timeInterval: "day", //时间间隔单位:年/月/日/时/分:year/month/day/hour/minute/second
},
setAutomation: { //设置自动初始化
legendData: true, //是否自动初始化option.legend.data
xAxisName: true, //是否自动初始化option.xAxis.name
isOpenTable:true,//是否自动初始化表格数据并显示
},
setFormat: { //设置初始化事件
xAxis: { //设置option.xAxis.formatter事件
type: "1" //执行命令 ------->见底部配置说明
},
tooltip: { //设置option.tooltip.formatter事件
type: "1" //执行命令 ------->见底部配置说明
},
},
setCustomEvents: { //设置自定义事件
onDrag: { //拖拽
isUse: true, //是否使用
msg: [0, 2] //配置需要的曲线数据下标 注意下标必须为从小到大排序
},
onClick: { //点击
isUse:true,
func:function (params) {
console.log("echarts点击",params);
}
}
}
}
//组件说明
//所有图表配置均参考于echarts3.0
//本例仅支持echart3.0曲线/折线配置
//配置说明
//执行命令说明:type值对应的是要执行的回调函数。0表示执行option中传入的回调函数,>=1表示执行对应编号的组件初始化的回调函数,
function getJson(start, end, key) {
// let ary = [];
// for (let j = 1; j <= key; j++) {
// let arr = [];
// for (let i = start; i <= end; i++) {
// if (i % (j + 1) === 0) {
// arr.push([i, Math.floor(Number((Math.random() * 999).toFixed(2))) + 200])
// }
// }
// ary.push({
// id: "a" + j, //曲线ID (必填,数据字段代码)
// name: "数据" + j,//曲线名
// data: arr, //曲线数据
// smooth: true,
// symbolSize: 5,
// type: "line",
// z: 100,
// })
// }
// let json = data;
// json.option.series = ary;
return data
}
export {
getJson
}