Dim Products As List(Of String)
Products = DataTables("表A").GetValues("machineId","日期 >= '" & d1 & "' and 日期 < '" & d1.AddDays(1) & "'")
Dim jo As New JObject
For Each Product As String In Products
Dim count As String = DataTables("表A").compute("count(machineId)","machineid = '" & product & "' and 日期 >= '" & d1 & "' and 日期 < '" & d1.AddDays(1) & "'")
str22 &= "{value:" & count & ", name:'" & product & "'},"
Next
str22 = str22.trim(",")
JO("cpclfb") = "[" & str22 & "]"
以下是 option
title : {
text: '某站点用户访问来源',
subtext: '纯属虚构',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
left: 'left',
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
},
series : [
{
name: '访问来源',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:mydata.cpclfb
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
以下JS
var getData = function getData(){
var myChart2 = echarts.init(document.getElementById('chart_map'), 'macarons');
$.get('getdata.htm?type=1').done(function (jsonstr) {
var mydata = eval('(' + jsonstr + ')');
myChart2.setOption({
title : {
text: '来源',
subtext: '纯属虚构',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
left: 'left',
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
},
series : [
{
name: '访问来源',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:mydata.cpclfb
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
});
});
setTimeout("getData()",2000);
}
setTimeout(function () {
getData();
}, 2000);