Authored by tanling

图标显示

function getEchartOption(title, threeContext, xData, yLeftData, yRightData, ratio){
var option = {
title:{
text: title
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
dataView: {show: true, readOnly: false},
magicType: {show: true, type: ['line', 'bar']},
restore: {show: true},
saveAsImage: {show: true}
}
},
legend: {
data:threeContext
},
xAxis: [
{
type: 'category',
data: xData,
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: threeContext[0],
min: 0,
max: 250,
interval: 50,
axisLabel: {
formatter: '{value} ¥'
}
},
{
type: 'value',
name: threeContext[1],
min: 0,
max: 25,
interval: 5,
axisLabel: {
formatter: '{value} '
}
}
],
series: [
{
name:threeContext[0],
type:'bar',
data:yLeftData
},
{
name:threeContext[1],
type:'bar',
data:yRightData
},
{
name:threeContext[2],
type:'line',
yAxisIndex: 1,
data:ratio
}
]
};
return option;
}
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- 引入 echarts.js -->
<script src="/union/js/echarts.min.js"></script>
<script src="/union/js/include.js"></script>
<script src="/union/html/reportform/echartJs.js"></script>
</head>
<body>
<table>
<tr>
<td>
<div id="exposure" style="width: 800px;height:400px;"></div>
</td>
<td>
<div id="active" style="width: 800px;height:400px;"></div>
</td>
<td>
<div id="newuser" style="width: 800px;height:400px;"></div>
</td>
</tr>
<tr>
<td>
<div id="exposure_ios" style="width: 800px;height:400px;"></div>
</td>
<td>
<div id="active_ios" style="width: 800px;height:400px;"></div>
</td>
<td>
<div id="newuser_ios" style="width: 800px;height:400px;"></div>
</td>
</tr>
<tr>
<td>
<div id="exposure_android" style="width: 800px;height:400px;"></div>
</td>
<td>
<div id="active_android" style="width: 800px;height:400px;"></div>
</td>
<td>
<div id="newuser_android" style="width: 800px;height:400px;"></div>
</td>
</tr>
</table>
<script type="text/javascript">
$(function(){
// $.ajax({
// type: "POST",
// url: contextPath + "/mktReportForm/followPriceOperate",
// data: JSON.stringify(json),
// dataType: "json",
// contentType: "application/json; charset=utf-8",
// success: function(data){
// if (data.code == CODE_SUCCESS) {
//
// } else {
// window.self.$.messager.alert("失败", data.message, "error");
// }
// }
// });
// 曝光量
var exposureOption = getEchartOption("市场费用/曝光量",['实际费用','曝光量','市场费用/曝光量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('exposure',exposureOption);
var exposureIosOption = getEchartOption("ios端市场费用/曝光量",['实际费用','曝光量','市场费用/曝光量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('exposure_ios',exposureIosOption);
var exposureAndroidOption = getEchartOption("android市场费用/曝光量",['实际费用','曝光量','市场费用/曝光量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('exposure_android',exposureAndroidOption);
// 激活
var activeOption = getEchartOption("市场费用/激活量",['实际费用','激活量','市场费用/激活量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('active',activeOption);
var activeIosOption = getEchartOption("ios端市场费用/激活量",['实际费用','激活量','市场费用/激活量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('active_ios',activeIosOption);
var activeAndroidOption = getEchartOption("android端市场费用/激活量",['实际费用','激活量','市场费用/激活量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('active_android',activeAndroidOption);
// 新客
var newuserOption = getEchartOption("市场费用/曝光量",['实际费用','曝光量','市场费用/曝光量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('newuser',newuserOption);
var newuserIosOption = getEchartOption("市场费用/曝光量",['实际费用','曝光量','市场费用/曝光量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('newuser_ios',newuserIosOption);
var newuserAndroidOption = getEchartOption("市场费用/曝光量",['实际费用','曝光量','市场费用/曝光量'],['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]);
drawEchart('newuser_android',newuserAndroidOption);
});
function drawEchart(ele, option){
var mychart = echarts.init(document.getElementById(ele));
mychart.setOption(option);
}
</script>
</body>
</html>
\ No newline at end of file
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.