You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/01/11 03:28:23 UTC

[incubator-echarts-examples] branch next updated: Update GL Examples

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-examples.git


The following commit(s) were added to refs/heads/next by this push:
     new 1b61921  Update GL Examples
1b61921 is described below

commit 1b61921c7b08cb95e94d968362537faeeb1f0885
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Jan 11 11:25:47 2021 +0800

    Update GL Examples
---
 public/data-gl/bar3d-punch-card.js       |  12 +--
 public/data-gl/globe-country-carousel.js |  12 +--
 public/data-gl/graphgl-gpu-layout.js     |   2 +-
 public/data-gl/graphgl-large-internet.js |   2 +-
 public/data-gl/graphgl-npm-dep.js        | 161 ++++++++++++++++---------------
 public/data-gl/map3d-buildings.js        |   4 +-
 public/data-gl/map3d-wood-city.js        |   4 +-
 public/data-gl/scatterGL-gps.js          |   2 +-
 public/data-gl/transparent-bar3d.js      |  14 +--
 9 files changed, 102 insertions(+), 111 deletions(-)

diff --git a/public/data-gl/bar3d-punch-card.js b/public/data-gl/bar3d-punch-card.js
index 0a30c91..e2f55a8 100644
--- a/public/data-gl/bar3d-punch-card.js
+++ b/public/data-gl/bar3d-punch-card.js
@@ -59,18 +59,14 @@ option = {
         shading: 'lambert',
 
         label: {
-            textStyle: {
-                fontSize: 16,
-                borderWidth: 1
-            }
+            fontSize: 16,
+            borderWidth: 1
         },
 
         emphasis: {
             label: {
-                textStyle: {
-                    fontSize: 20,
-                    color: '#900'
-                }
+                fontSize: 20,
+                color: '#900'
             },
             itemStyle: {
                 color: '#900'
diff --git a/public/data-gl/globe-country-carousel.js b/public/data-gl/globe-country-carousel.js
index 5e75922..1c94c78 100644
--- a/public/data-gl/globe-country-carousel.js
+++ b/public/data-gl/globe-country-carousel.js
@@ -22,17 +22,11 @@ mapChart.setOption({
         boundingCoords: [[-180, 90], [180, -90]],
         silent: true,
         itemStyle: {
-            normal: {
-                borderColor: '#000'
-            }
+            borderColor: '#000'
         },
         label: {
-            normal: {
-                textStyle: {
-                    color: '#fff',
-                    fontSize: 40
-                }
-            }
+            color: '#fff',
+            fontSize: 40
         }
     }
 });
diff --git a/public/data-gl/graphgl-gpu-layout.js b/public/data-gl/graphgl-gpu-layout.js
index 94c4e29..a2a6177 100644
--- a/public/data-gl/graphgl-gpu-layout.js
+++ b/public/data-gl/graphgl-gpu-layout.js
@@ -3,7 +3,7 @@ title: GraphGL GPU Layout
 category: graphGL
 theme: dark
 titleCN: GraphGL GPU Layout
-scripts: 'http://echarts.baidu.com/resource/echarts-gl-latest/dist/echarts-gl.min.js'
+shotDelay: 5000
 */
 
 
diff --git a/public/data-gl/graphgl-large-internet.js b/public/data-gl/graphgl-large-internet.js
index e307630..126b8c3 100644
--- a/public/data-gl/graphgl-large-internet.js
+++ b/public/data-gl/graphgl-large-internet.js
@@ -3,7 +3,7 @@ title: GraphGL - Large Internet
 category: graphGL
 theme: dark
 titleCN: GraphGL - Large Internet
-scripts: 'http://echarts.baidu.com/resource/echarts-gl-latest/dist/echarts-gl.min.js'
+shotDelay: 10000
 */
 
 
diff --git a/public/data-gl/graphgl-npm-dep.js b/public/data-gl/graphgl-npm-dep.js
index 27f3662..b0af5c4 100644
--- a/public/data-gl/graphgl-npm-dep.js
+++ b/public/data-gl/graphgl-npm-dep.js
@@ -3,92 +3,101 @@ title: NPM Dependencies with graphGL
 category: graphGL
 theme: dark
 titleCN: 1w 节点 2w7 边的NPM 依赖图
+shotDelay: 5000
 */
 
-$.when(
-    $.getJSON(ROOT_PATH + '/data-gl/asset/data/npmdep.json'),
-    $.getScript('https://cdn.jsdelivr.net/npm/echarts-graph-modularity@2/dist/echarts-graph-modularity.js')
-).done(function (res) {
-    var data = res[0];
-    var nodes = data.nodes.map(function (nodeName, idx) {
-        return {
-            name: nodeName,
-            value: data.dependentsCount[idx]
-        }
-    });
-    var edges = [];
-    for (var i = 0; i < data.edges.length;) {
-        var s = data.edges[i++];
-        var t = data.edges[i++];
-        edges.push({
-            source: s,
-            target: t
+function loadScript(scriptUrl, cb) {
+    var scriptTag = document.createElement('script');
+    scriptTag.onload = cb;
+    scriptTag.src = scriptUrl;
+    document.body.appendChild(scriptTag);
+}
+
+loadScript('https://cdn.jsdelivr.net/npm/echarts-graph-modularity@2.0.0/dist/echarts-graph-modularity.min.js', function () {
+    // Reinit chart again
+    // TODO: visual encoding registerion must been done before echarts.init.
+    var dom = myChart.getDom();
+    myChart.dispose();
+    myChart = echarts.init(dom);
+    $.getJSON(ROOT_PATH + '/data-gl/asset/data/npmdep.json', function (data) {
+        var nodes = data.nodes.map(function (nodeName, idx) {
+            return {
+                name: nodeName,
+                value: data.dependentsCount[idx]
+            }
         });
-    }
+        var edges = [];
+        for (var i = 0; i < data.edges.length;) {
+            var s = data.edges[i++];
+            var t = data.edges[i++];
+            edges.push({
+                source: s,
+                target: t
+            });
+        }
 
-    nodes.forEach(function (node) {
-        // if (node.value > 100) {
-            node.emphasis = {
-                label: {
+        nodes.forEach(function (node) {
+            // if (node.value > 100) {
+                node.emphasis = {
+                    label: {
+                        show: true
+                    }
+                }
+            // }
+            if (node.value > 5000) {
+                node.label = {
                     show: true
                 }
             }
-        // }
-        if (node.value > 5000) {
-            node.label = {
-                show: true
-            }
-        }
-    });
+        });
 
-    myChart.setOption({
-        backgroundColor: '#000',
-        series: [{
-            color: ['rgb(203,239,15)', 'rgb(73,15,239)','rgb(15,217,239)','rgb(30,15,239)','rgb(15,174,239)','rgb(116,239,15)','rgb(239,15,58)','rgb(15,239,174)','rgb(239,102,15)','rgb(239,15,15)','rgb(15,44,239)','rgb(239,145,15)','rgb(30,239,15)','rgb(239,188,15)','rgb(159,239,15)','rgb(159,15,239)','rgb(15,239,44)','rgb(15,239,87)','rgb(15,239,217)','rgb(203,15,239)','rgb(239,15,188)','rgb(239,15,102)','rgb(239,58,15)','rgb(239,15,145)','rgb(116,15,239)','rgb(15,131,239)','rgb(73,239, [...]
-            type: 'graphGL',
-            nodes: nodes,
-            edges: edges,
-            modularity: {
-                resolution: 2,
-                sort: true
-            },
-            lineStyle: {
-                color: 'rgba(255,255,255,1)',
-                opacity: 0.05
-            },
-            itemStyle: {
-                opacity: 1
-                // borderColor: '#fff',
-                // borderWidth: 1
-            },
-            focusNodeAdjacency: false,
-            focusNodeAdjacencyOn: 'click',
-            symbolSize: function (value) {
-                return Math.sqrt(value / 10);
-            },
-            label: {
-                textStyle: {
-                    color: '#fff'
-                }
-            },
-            emphasis: {
-                label: {
-                    show: false
+        myChart.setOption({
+            backgroundColor: '#000',
+            series: [{
+                color: ['rgb(203,239,15)', 'rgb(73,15,239)','rgb(15,217,239)','rgb(30,15,239)','rgb(15,174,239)','rgb(116,239,15)','rgb(239,15,58)','rgb(15,239,174)','rgb(239,102,15)','rgb(239,15,15)','rgb(15,44,239)','rgb(239,145,15)','rgb(30,239,15)','rgb(239,188,15)','rgb(159,239,15)','rgb(159,15,239)','rgb(15,239,44)','rgb(15,239,87)','rgb(15,239,217)','rgb(203,15,239)','rgb(239,15,188)','rgb(239,15,102)','rgb(239,58,15)','rgb(239,15,145)','rgb(116,15,239)','rgb(15,131,239)','rgb(73, [...]
+                type: 'graphGL',
+                nodes: nodes,
+                edges: edges,
+                modularity: {
+                    resolution: 2,
+                    sort: true
                 },
                 lineStyle: {
-                    opacity: 0.5,
-                    width: 4
+                    color: 'rgba(255,255,255,1)',
+                    opacity: 0.05
+                },
+                itemStyle: {
+                    opacity: 1
+                    // borderColor: '#fff',
+                    // borderWidth: 1
+                },
+                focusNodeAdjacency: false,
+                focusNodeAdjacencyOn: 'click',
+                symbolSize: function (value) {
+                    return Math.sqrt(value / 10);
+                },
+                label: {
+                    color: '#fff'
+                },
+                emphasis: {
+                    label: {
+                        show: false
+                    },
+                    lineStyle: {
+                        opacity: 0.5,
+                        width: 4
+                    }
+                },
+                forceAtlas2: {
+                    steps: 5,
+                    stopThreshold: 20,
+                    jitterTolerence: 10,
+                    edgeWeight: [0.2, 1],
+                    gravity: 5,
+                    edgeWeightInfluence: 0
+                    // preventOverlap: true
                 }
-            },
-            forceAtlas2: {
-                steps: 5,
-                stopThreshold: 20,
-                jitterTolerence: 10,
-                edgeWeight: [0.2, 1],
-                gravity: 5,
-                edgeWeightInfluence: 0,
-                // preventOverlap: true
-            }
-        }]
+            }]
+        });
     });
 });
diff --git a/public/data-gl/map3d-buildings.js b/public/data-gl/map3d-buildings.js
index eb22ed8..ca3c407 100644
--- a/public/data-gl/map3d-buildings.js
+++ b/public/data-gl/map3d-buildings.js
@@ -94,9 +94,7 @@ $.getJSON(ROOT_PATH + '/data-gl/asset/data/buildings.json', function (buildingsG
             },
 
             label: {
-                textStyle: {
-                    color: 'white'
-                }
+                color: 'white'
             },
 
             silent: true,
diff --git a/public/data-gl/map3d-wood-city.js b/public/data-gl/map3d-wood-city.js
index 0b39249..2227778 100644
--- a/public/data-gl/map3d-wood-city.js
+++ b/public/data-gl/map3d-wood-city.js
@@ -78,9 +78,7 @@ $.getJSON(ROOT_PATH + '/data-gl/asset/data/buildings.json', function (buildingsG
             },
 
             label: {
-                textStyle: {
-                    color: 'white'
-                }
+                color: 'white'
             },
 
             silent: true,
diff --git a/public/data-gl/scatterGL-gps.js b/public/data-gl/scatterGL-gps.js
index fc7ddc7..18d8a19 100644
--- a/public/data-gl/scatterGL-gps.js
+++ b/public/data-gl/scatterGL-gps.js
@@ -41,7 +41,7 @@ option = {
     backgroundColor: '#000',
     title: {
         text: '10000000 GPS Points',
-            left: 'center',
+        left: 'center',
         textStyle: {
             color: '#fff'
         }
diff --git a/public/data-gl/transparent-bar3d.js b/public/data-gl/transparent-bar3d.js
index 888a181..6cecec2 100644
--- a/public/data-gl/transparent-bar3d.js
+++ b/public/data-gl/transparent-bar3d.js
@@ -56,22 +56,18 @@ option = {
 
         label: {
             show: false,
-            textStyle: {
-                fontSize: 16,
-                borderWidth: 1
-            }
+            fontSize: 16,
+            borderWidth: 1
         },
-        
+
         itemStyle: {
             opacity: 0.4
         },
 
         emphasis: {
             label: {
-                textStyle: {
-                    fontSize: 20,
-                    color: '#900'
-                }
+                fontSize: 20,
+                color: '#900'
             },
             itemStyle: {
                 color: '#900'


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org