This commit is contained in:
parent
fa76c9c76d
commit
22ede2c394
|
@ -65,7 +65,7 @@ function init(){
|
|||
var lineChart = echarts.init(document.getElementById('lineChart'));
|
||||
lineChart.setOption({
|
||||
|
||||
color:["#87cefa","#ff7f50","#32cd32","#da70d6",],
|
||||
color:["#ff7f50","#32cd32","#da70d6","#87cefa",],
|
||||
legend: {
|
||||
y : '260',
|
||||
x : 'center',
|
||||
|
@ -73,7 +73,7 @@ function init(){
|
|||
color : '#ffffff',
|
||||
|
||||
},
|
||||
data : ['厦门第一医院','厦门中山医院','厦门中医院','厦门第五医院',],
|
||||
data : ['评论量'],
|
||||
},
|
||||
calculable : false,
|
||||
tooltip : {
|
||||
|
@ -109,7 +109,7 @@ function init(){
|
|||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
data : ['8:00','10:00','12:00','14:00','16:00','18:00','20:00','22:00'],
|
||||
data : ['四天前','三天前','二天前','昨天','今天'],
|
||||
axisLine:{
|
||||
lineStyle:{
|
||||
color: '#034c6a'
|
||||
|
@ -142,7 +142,7 @@ function init(){
|
|||
},
|
||||
series : [
|
||||
{
|
||||
name:'厦门第一医院',
|
||||
name:'评论量',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {
|
||||
|
@ -152,47 +152,9 @@ function init(){
|
|||
}
|
||||
}
|
||||
},
|
||||
data:[15, 0, 20, 45, 22.1, 25, 70, 55, 76]
|
||||
data: last_day_comment
|
||||
},
|
||||
{
|
||||
name:'厦门中山医院',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
lineStyle: {
|
||||
shadowColor : 'rgba(0,0,0,0.4)'
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[25, 10, 30, 55, 32.1, 35, 80, 65, 76]
|
||||
},
|
||||
{
|
||||
name:'厦门中医院',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
lineStyle: {
|
||||
shadowColor : 'rgba(0,0,0,0.4)'
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[35, 20, 40, 65, 42.1, 45, 90, 75, 96]
|
||||
},
|
||||
{
|
||||
name:'厦门第五医院',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
lineStyle: {
|
||||
shadowColor : 'rgba(0,0,0,0.4)'
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[45, 30, 50, 75, 52.1, 55, 100, 85, 106]
|
||||
}
|
||||
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -304,7 +266,7 @@ function init(){
|
|||
color : '#ffffff',
|
||||
|
||||
},
|
||||
data : ['手机','笔记本',],
|
||||
data : ['评论'],
|
||||
},
|
||||
calculable : false,
|
||||
tooltip : {
|
||||
|
@ -373,7 +335,7 @@ function init(){
|
|||
},
|
||||
series : [
|
||||
{
|
||||
name:'手机',
|
||||
name:'评论',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {
|
||||
|
@ -383,22 +345,10 @@ function init(){
|
|||
}
|
||||
}
|
||||
},
|
||||
data:[15, 0, 20, 45, 22.1,]
|
||||
},
|
||||
{
|
||||
name:'笔记本',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
lineStyle: {
|
||||
shadowColor : 'rgba(0,0,0,0.4)'
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[25, 10, 30, 55, 32.1, ]
|
||||
data: last_day_product
|
||||
},
|
||||
|
||||
|
||||
]
|
||||
});
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
var platform_info = {{platform_info|safe}};
|
||||
|
||||
var last_day_product = {{last_day_product|safe}};
|
||||
var last_day_comment = {{last_day_comment|safe}};
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -13,10 +13,19 @@ def crawl(request):
|
|||
crawl_info = CrawlInfos.objects.order_by('-id').first()
|
||||
platform_info = get_platform_info()
|
||||
news = News.objects.order_by('-id').all()[0:20]
|
||||
last_day_counts = LastDayCounts.objects.all()
|
||||
last_day_counts = LastDayCounts.objects.order_by("last_day").all()
|
||||
|
||||
last_day_product = []
|
||||
last_day_comment = []
|
||||
for last_day in last_day_counts:
|
||||
last_day_product.append(last_day.product_c)
|
||||
last_day_comment.append(last_day.comment_c)
|
||||
|
||||
return render(request, 'myapp/crawl.html', {"crawl_info": crawl_info,
|
||||
"platform_info":json.dumps(platform_info),
|
||||
"news": news})
|
||||
"news": news,
|
||||
"last_day_product":json.dumps(last_day_product),
|
||||
"last_day_comment": json.dumps(last_day_comment)})
|
||||
|
||||
def result(request):
|
||||
return render(request, 'myapp/result.html')
|
|
@ -73,6 +73,8 @@ def get_last_day_count(spark):
|
|||
df = spark.sql("select count(*) as N from jd_comment where created_at like '"+getYesterday(i+1)+"%'")
|
||||
jd_comment_last_count = df.rdd.collect()[0]["N"]
|
||||
|
||||
mysql_execute("update last_day_counts set product_c = {}, comment_c = {} where last_day = {}".format(
|
||||
jd_last_count, jd_comment_last_count, i+1))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -91,6 +93,8 @@ if __name__ == "__main__":
|
|||
collect_crawl_info(spark)
|
||||
collect_news(spark)
|
||||
|
||||
get_last_day_count(spark)
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
spark.stop()
|
Loading…
Reference in New Issue