Toggle navigation
豆瓣电影
By
玄魂玉
2018-03-29 03:25:58
脚本
16
21
作品使用的第三方脚本
http://gallerybox.echartsjs.com/dep/echarts/3.8.0/echarts.min.js,http://echarts.baidu.com/resource/echarts-gl-latest/dist/echarts-gl.min.js
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
$.getJSON("https://api.douban.com/v2/movie/top250?count=100&callback=?", {}, function(json) { var xx = []; var yy = ['1990~94', '1995~99', '2000~04', '2005~09', '2010~14', '2014~19']; var data = generateData(json.subjects); function generateData(value) { var arr = []; $.each(value, function(x, y) { var n = ''; if (1990 <= parseInt(y.year) && parseInt(y.year) <= 1994) { n = '1990~94' } else if (1995 <= parseInt(y.year) && parseInt(y.year) <= 1999) { n = '1995~99' } else if (2000 <= parseInt(y.year) && parseInt(y.year) <= 2004) { n = '2000~04' } else if (2005 <= parseInt(y.year) && parseInt(y.year) <= 2009) { n = '2005~09' } else if (2010 <= parseInt(y.year) && parseInt(y.year) <= 2014) { n = '2010~14' } else if (2015 <= parseInt(y.year) && parseInt(y.year) <= 2019) { n = '2014~19' } $.each(y.genres, function(i, lx) { if (lx != '剧情') { if (xx.indexOf(lx) < 0) { xx.push(lx) } arr.push([lx, n, y.collect_count, y.rating.average, parseInt(Math.random() * 8 + 2), y.year, y.title, lx]); } }) }) return arr; } function lab(val) { var num = 0; $.each(data, function(i, item) { if (item.indexOf(val) > -1) { num++ } }) return val + num; } option = { backgroundColor: '#333', tooltip: { formatter: function(obj) { var value = obj.value; return '片名' + ':' + value[6] + '
' + '类别' + ':' + value[0] + '
'; } }, visualMap: [ // { // dimension: 3, // show: false, // min: 2, // max: 10, // bottom: 0, // inRange: { // symbolSize: [10, 30] // } // }, { dimension: 4, show: false, min: 2, max: 10, top: 0, inRange: { symbolSize: [10, 40] } }, { dimension: 7, categories: xx, textStyle: { color: '#fff' }, formatter: function(value) { return lab(value); }, inRange: { color: ['#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3', '#87d465', '#4b949d', '#744b9d', '#9d4b5e', '#9a9d4b', '#8d4b9d', '#a0b84b', '#eac892', '#92eadf', '#abea92', '#ea92a5', '#abc7f1', '#dfea92'] } } ], xAxis3D: { type: 'category', name: '类别', data: xx }, yAxis3D: { type: 'category', name: '年代', data: yy }, zAxis3D: { type: 'value', name: '评论人数', }, grid3D: { boxWidth: 220, axisLine: { lineStyle: { color: '#fff' } }, axisPointer: { show: false }, viewControl: { alpha: 10, beta: 20, distance: 200 }, }, series: [{ type: 'scatter3D', name: '喜欢影片', symbolSize: 20, data: data, label: { show: true, formatter: function(params) { return params.data[6] } } }] } myChart.setOption(option) });