Skip to content

Instantly share code, notes, and snippets.

@buddalee
Created September 18, 2018 02:54
Show Gist options
  • Save buddalee/c7b71f0a1b1e8a61d40020eb9966c682 to your computer and use it in GitHub Desktop.
Save buddalee/c7b71f0a1b1e8a61d40020eb9966c682 to your computer and use it in GitHub Desktop.
for Echarts GL(sample data)
var xStr = `
0.000
0.000
0.043
0.162
0.393
0.769
1.323
2.116
3.336
5.000
7.304
10.445
14.596
19.887
26.425
34.298
43.503
54.128
66.191
79.593
93.935
108.662
123.050
136.226
147.572
156.884
162.963
164.434
159.777
147.403
125.679
93.147
48.988
-6.966
-75.566
-157.299
-252.301
-360.349
-480.944
-613.303
-756.423
-909.112
-1070.110
-1238.122
-1411.835
-1589.967
-1771.250
-1954.413
-2138.760
-2323.974
-2508.671
-2691.408
-2870.720
-3045.091
-3212.954
-3372.756
-3523.512
-3664.945
-3795.632
-3914.374
-4020.299
-4112.962
-4192.307
-4258.646
-4312.595
-4354.980
-4386.794
-4409.064
-4422.634
-4428.626
-4428.041
-4421.774
-4410.355
-4393.920
-4373.127
-4348.488
-4320.472
-4289.565
-4256.171
-4220.638
-4183.188
-4143.799
-4102.425
-4058.950
-4013.196
-3964.935
-3913.954
-3860.029
-3802.872
-3742.066
-3677.163
-3607.720
-3533.429
-3453.985
-3369.083
-3278.435
-3181.776
-3079.099
-2970.108
`;
xStr = xStr.trim();
var xdata = xStr.split(' ');
console.log(xdata.length);
var yStr = `
0.000
0.000
-0.019
-0.073
-0.178
-0.347
-0.597
-0.941
-1.369
-1.891
-2.504
-3.176
-3.885
-4.558
-5.137
-5.572
-5.874
-5.970
-5.846
-5.477
-4.770
-3.601
-1.873
0.550
3.675
7.517
12.078
17.312
23.082
29.202
35.397
41.327
46.800
51.729
55.789
58.687
60.161
59.978
57.790
53.074
45.245
33.680
17.845
-2.764
-28.622
-60.064
-97.285
-140.338
-189.140
-243.676
-303.602
-368.383
-437.463
-510.288
-586.330
-664.995
-745.990
-829.157
-913.853
-999.415
-1085.145
-1170.425
-1254.769
-1337.732
-1418.824
-1497.532
-1573.296
-1645.537
-1713.353
-1776.180
-1833.675
-1885.620
-1932.143
-1973.139
-2008.636
-2038.670
-2063.302
-2082.685
-2097.074
-2106.679
-2112.055
-2113.240
-2110.509
-2104.089
-2094.230
-2081.159
-2065.129
-2046.505
-2025.743
-2003.258
-1979.371
-1954.414
-1928.634
-1902.256
-1875.484
-1848.496
-1821.449
-1794.356
-1767.411
`;
yStr = yStr.trim();
var ydata = yStr.split(' ');
console.log(ydata.length);
var zStr = `
0.000
0.000
-0.003
-0.013
-0.033
-0.064
-0.112
-0.219
-0.517
-1.009
-1.887
-3.397
-5.789
-9.291
-14.156
-20.651
-28.885
-39.262
-52.062
-67.444
-85.391
-105.768
-128.364
-152.990
-179.408
-207.651
-237.617
-269.364
-303.209
-339.769
-380.044
-425.396
-476.503
-533.816
-599.018
-673.855
-760.073
-859.322
-973.108
-1102.740
-1249.337
-1413.779
-1596.710
-1798.563
-2019.566
-2259.847
-2519.472
-2798.477
-3096.888
-3414.720
-3752.023
-4108.811
-4484.968
-4880.203
-5293.975
-5725.466
-6174.282
-6640.077
-7121.516
-7616.945
-8124.490
-8642.207
-9168.191
-9700.651
-10238.022
-10779.015
-11322.689
-11868.476
-12415.879
-12964.779
-13515.177
-14067.247
-14621.253
-15177.171
-15735.170
-16295.373
-16857.802
-17422.538
-17989.646
-18559.182
-19131.449
-19706.439
-20284.284
-20865.170
-21449.223
-22036.557
-22627.281
-23221.490
-23819.316
-24420.843
-25026.134
-25635.274
-26248.361
-26865.494
-27486.796
-28112.412
-28742.467
-29376.978
-30016.035
`;
zStr = zStr.trim();
var zdata = zStr.split(' ');
var data = [];
// Parametric curve
for (var t = 0; t < zdata.length; t += 1) {
var x = xdata[t];
var y = ydata[t];
var z = zdata[t];
data.push([x, y, z]);
}
option = {
visualMap: {
show: false,
dimension: 2,
min: 0,
max: 300
},
xAxis3D: {
type: 'value'
},
yAxis3D: {
type: 'value'
},
zAxis3D: {
type: 'value'
},
grid3D: {
axisLine: {
lineStyle: {
color: '#333'
}
},
axisPointer: {
show: false
},
viewControl: {}
},
series: [{
type: 'line3D',
lineStyle: {
width: 20
},
silent: true,
debug: {
wireframe: {
show: true,
lineStyle: {
color: '#108bcd'
}
}
},
data
}]
};
@buddalee
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment