// 路径配置
require.config({
paths: {
echarts: 'http://echarts.baidu.com/build/dist'
}
});
// 使用
require(['echarts', 'echarts/chart/line','echarts/chart/map', ],
function (ec) {
// 基于准备好的dom,初始化echarts图表
var myChart = ec.init(document.getElementById('main'));
option = {
grid: {
y:60,
y2:100
},
tooltip: {
trigger: 'axis'
},
calculable: true,
xAxis: [{
type: 'category',
boundaryGap: false,
data: ["2018-01","2018-02","2018-03","2018-04","2018-05","2018-06","2018-07","2018-08","2018-09","2018-10","2018-11","2018-12","2019-01","2019-02","2019-03","2019-04","2019-05","2019-06"],
}],
yAxis: [{
type: 'value',
axisLabel: {
formatter: '{value}'
},
max:15000+5000//设置最大值
}],
series: [{
name: '房价(单位:元/㎡)',
type: 'line',
data: [7758,8059,8258,8635,9163,9260,9835,10380,11005,11325,11005,10750,11035,10890,10332,10810,9935,10690],
markPoint: {
data: [{
type: 'max',
name: '最高价格'
},
{
type: 'min',
name: '最低价格'
}]
},
}]
};
// 为echarts对象加载数据
myChart.setOption(option);
});
document.getElementById('tj').innerHTML = '{$CATEGORYS[$catid][catname]}新房均价:10690元/㎡环比上月:↑1.22%';