test
配置项如下
$.get('data/asset/data/life-expectancy-table.json', function (data) {
var worddata = [
["gna", "-0.035905", "0.002209", "-0.015315"],
["zweites", "-0.025823", "-0.006780", "0.011724"],
["keweenaw", "-0.021058", "-0.010679", "-0.004187"],
["misreading", "-0.030361", "0.002338", "-0.001213"],
["isleofman", "-0.011365", "-0.011155", "0.001345"],
["doubts", "-0.003093", "0.002143", "0.008387"],
["mongus", "-0.022055", "0.016065", "-0.006209"],
["solitary", "-0.014913", "0.001220", "-0.007663"],
["sheahen", "0.016099", "-0.004453", "-0.005072"],
["sipher", "-0.034139", "-0.005816", "-0.002514"],
["detlev", "-0.015601", "-0.008360", "0.006073"],
["minuteness", "-0.008098", "-0.006130", "-0.017807"],
["seele", "-0.032885", "-0.001934", "-0.003763"],
["aldoses", "-0.023707", "-0.012010", "-0.008682"],
["squinting", "-0.046406", "-0.006852", "-0.004316"],
["maglemosian", "-0.028395", "-0.006637", "-0.006153"],
["defiling", "-0.030487", "0.002074", "-0.010580"],
["autogenocide", "0.042306", "-0.022513", "0.025338"],
["bacille", "-0.030313", "0.004614", "-0.003864"],
["cantillon", "-0.002450", "0.022366", "0.029641"],
["yrz", "-0.042292", "-0.013650", "-0.008609"],
["bradymetabolism", "-0.013725", "0.005759", "-0.002311"],
["noh", "0.007783", "-0.002498", "-0.001322"],
["wart", "-0.028592", "0.004702", "0.005707"],
["dacier", "-0.025127", "-0.004163", "0.008243"],
["yatai", "0.125539", "-0.054987", "0.002765"],
["leonwood", "-0.000701", "-0.001416", "0.009819"],
["baocheng", "-0.053537", "-0.018568", "-0.003648"],
["pembrok", "-0.035359", "0.002876", "0.005208"],
["furgora", "0.061945", "0.037002", "-0.028765"],
["zulilu", "0.445174", "-0.123753", "0.084157"],
["besoin", "-0.032303", "-0.009584", "-0.008748"],
["adduct", "-0.025861", "0.003146", "-0.004628"],
["malmberg", "-0.037584", "-0.000330", "-0.001091"],
["oengusa", "-0.024094", "0.006664", "-0.004581"],
["stense", "0.020619", "0.027079", "0.025596"],
["ontarian", "-0.029444", "-0.002857", "-0.002818"],
["hyssop", "-0.008436", "0.011204", "-0.001263"],
["liuhard", "0.001842", "-0.005039", "-0.005138"],
["cinerea", "-0.024362", "0.000714", "-0.011925"],
["airscan", "-0.024331", "-0.002482", "-0.000617"],
["ydowska", "0.080178", "0.030835", "-0.014711"],
["thacker", "0.012916", "0.008825", "0.001168"],
["connexxion", "-0.043191", "-0.002119", "0.000413"],
["praga", "-0.027525", "-0.002720", "-0.000895"],
["giantesses", "-0.018537", "-0.007368", "-0.005750"],
["bhattis", "-0.035829", "-0.006542", "-0.005473"],
["margins", "0.011720", "0.028203", "0.016211"],
["tarnegol", "-0.028130", "-0.002245", "-0.005392"],
["hinamatsuri", "-0.028398", "-0.001237", "-0.005470"],
["kenny", "-0.038110", "-0.004964", "-0.005977"],
["nunn", "-0.008793", "-0.004363", "-0.006851"],
["elphame", "0.009466", "0.003852", "0.005326"],
["eurasianism", "-0.022075", "-0.004222", "-0.000517"],
["clarify", "-0.028613", "-0.006306", "-0.001771"],
["shortlived", "-0.002680", "0.004566", "0.001118"],
["shah", "-0.039947", "0.004423", "-0.005600"],
["alhaje", "-0.028986", "-0.006297", "-0.005375"],
["footstompin", "-0.031106", "-0.003569", "-0.010861"],
["retorica", "-0.020102", "0.004061", "0.001951"],
["heut", "-0.034969", "-0.002273", "-0.002033"],
["calculus", "-0.017439", "0.001509", "0.012310"],
["agbome", "-0.027789", "0.003776", "0.000285"],
["brs", "-0.006290", "0.006228", "0.005799"],
["hangetsu", "-0.028136", "-0.008223", "-0.003797"],
["elitist", "0.282330", "0.057619", "0.280473"],
["nietzsche", "0.259769", "0.014907", "-0.109952"],
["petm", "-0.001432", "0.041018", "0.043813"],
["isamuddin", "-0.027273", "-0.007864", "-0.001445"],
["jcik", "-0.024908", "-0.001388", "0.001630"],
["carignan", "-0.016678", "-0.006626", "-0.002244"],
["eadgyth", "-0.028539", "-0.000292", "-0.006035"],
["holmdel", "-0.029182", "-0.007119", "-0.004322"],
["cdemusic", "-0.026688", "-0.008006", "-0.008015"],
["dresner", "-0.020698", "0.011893", "0.002749"],
["yield", "0.178500", "0.000292", "-0.072203"],
["menad", "-0.014748", "-0.008503", "-0.013757"],
["came", "-0.039504", "-0.002500", "0.001691"],
["reschke", "0.196253", "-0.248035", "-0.080905"],
["tinsmith", "-0.036103", "-0.003556", "-0.008069"],
["sorbets", "-0.042408", "-0.006005", "-0.000898"],
["sarcopterygii", "-0.037099", "-0.001529", "-0.004396"],
["chydenius", "-0.039150", "0.000194", "-0.000765"],
["lindau", "0.071129", "0.008264", "-0.004014"],
["alfama", "-0.035690", "-0.002871", "-0.008767"],
["ond", "-0.036507", "-0.004449", "-0.002509"],
["nrdna", "0.000614", "0.008007", "0.002439"],
["ayatollahs", "0.307384", "-0.285874", "0.309582"],
["ndervold", "-0.017171", "-0.005862", "0.002688"],
["barbette", "-0.031093", "0.000277", "-0.007487"],
["immigration", "0.003070", "-0.008523", "-0.012391"],
["jeyaraj", "-0.004787", "-0.021270", "0.017002"],
["uskoreniye", "0.196652", "0.081954", "-0.100967"],
["auvergne", "-0.035419", "-0.004405", "-0.007922"],
["machiques", "0.015238", "0.049980", "0.040386"],
["wettach", "-0.029878", "-0.009888", "0.004311"],
["borneo", "0.008305", "-0.030513", "0.039540"],
["hexahydrate", "-0.035017", "-0.003711", "-0.002506"],
["leprosa", "-0.011657", "-0.003475", "-0.011335"],
["radhika", "-0.038951", "-0.007395", "0.000640"]
];
worddata = worddata.map(item => {
return [Number(item[1]) * 10000, Number(item[2]) * 10000, Number(item[3]) * 10000, item[0]];
})
console.log(worddata);
var sizeValue = '57%';
var symbolSize = 2.5;
option = {
tooltip: {},
grid3D: {
width: '50%'
},
xAxis3D: {},
yAxis3D: {},
zAxis3D: {},
grid: [
{left: '50%', width: '20%', bottom: sizeValue},
{left: '75%', width: '20%', bottom: sizeValue},
{left: '50%', width: '20%', top: sizeValue},
{left: '75%', width: '20%', top: sizeValue}
],
xAxis: [
{type: 'value', gridIndex: 0, name: 'x', axisLabel: {rotate: 50, interval: 0}},
{type: 'value', gridIndex: 1, name: 'y', boundaryGap: false, axisLabel: {rotate: 50, interval: 0}},
{type: 'value', gridIndex: 2, name: 'z', axisLabel: {rotate: 50, interval: 0}},
{type: 'value', gridIndex: 3, name: 'word', axisLabel: {rotate: 50, interval: 0}}
],
yAxis: [
{type: 'value', gridIndex: 0, name: 'y'},
{type: 'value', gridIndex: 1, name: 'z'},
{type: 'value', gridIndex: 2, name: 'x'},
{type: 'value', gridIndex: 3, name: 'word'}
],
dataset: {
dimensions: [
'x',
'y',
'z',
'word',
{name: 'Year', type: 'ordinal'}
],
source: worddata
},
series: [
{
type: 'scatter3D',
symbolSize: 3,
encode: {
x: 'x',
y: 'y',
z: 'z',
tooltip: [0, 1, 2, 3, 4]
}
},
{
type: 'scatter',
symbolSize: symbolSize,
xAxisIndex: 0,
yAxisIndex: 0,
encode: {
x: 'x',
y: 'y',
tooltip: [0, 1, 2, 3, 4]
}
},
{
type: 'scatter',
symbolSize: symbolSize,
xAxisIndex: 1,
yAxisIndex: 1,
encode: {
x: 'y',
y: 'z',
tooltip: [0, 1, 2, 3, 4]
}
},
{
type: 'scatter',
symbolSize: symbolSize,
xAxisIndex: 2,
yAxisIndex: 2,
encode: {
x: 'z',
y: 'x',
tooltip: [0, 1, 2, 3, 4]
}
},
{
type: "wordCloud",
gridSize:6,
shape:'diamond',
sizeRange: [12, 50],
textStyle: {
normal: {
color: function() {
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
shadowBlur: 10,
shadowColor: '#333'
},
data: worddata.map(item => ({name: item[3], value: 1}))
},
}
]
};
myChart.setOption(option);
});