Giter VIP home page Giter VIP logo

echarts-gl's Introduction

ECHARTS-GL

ECharts-GL is an extension pack of Apache ECharts, which providing 3D plots, globe visualization and WebGL acceleration.

Docs

Installing

npm and webpack

npm install echarts
npm install echarts-gl

Import all

import * as echarts from 'echarts';
import 'echarts-gl';

Minimal Import

import * as echarts from 'echarts/core';
import { Scatter3DChart } from 'echarts-gl/charts';
import { Grid3DComponent } from 'echarts-gl/components';

echarts.use([Scatter3DChart, Grid3DComponent]);

Include by scripts

<script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts-gl/dist/echarts-gl.min.js"></script>

NOTE:

ECharts GL 2.x is compatible with ECharts 5.x. ECharts GL 1.x is compatible with ECharts 4.x.

Basic Usage

var chart = echarts.init(document.getElementById('main'));
chart.setOption({
    grid3D: {},
    xAxis3D: {},
    yAxis3D: {},
    zAxis3D: {},
    series: [{
        type: 'scatter3D',
        symbolSize: 50,
        data: [[-1, -1, -1], [0, 0, 0], [1, 1, 1]],
        itemStyle: {
            opacity: 1
        }
    }]
})

License

ECharts-GL is available under the BSD license.

Notice

The Apache Software Foundation Apache ECharts, ECharts, Apache, the Apache feather, and the Apache ECharts project logo are either registered trademarks or trademarks of the Apache Software Foundation.

echarts-gl's People

Contributors

100pah avatar chriswong avatar deyihu avatar fuzhenn avatar justineo avatar kener avatar kyriejoshua avatar nwind avatar ovilia avatar pedrolamas avatar pissang avatar susiwen8 avatar zhou-duoduo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

echarts-gl's Issues

bar3D data item opacity can't be set

Seems like opacity of bar3D item can't be set in data (even if docs says so), below is an example, the result shouldn't show any bars as itemStyle.opacity is 0

$.getJSON("/asset/get/s/data-1491887968120-rJODPy9ae.json", function (data) {
    
    data = data.filter(function (dataItem) {
        return dataItem[2] > 0;
    }).map(function (dataItem) {
        return {
            itemStyle:{
                opacity:0
            },
            value:[dataItem[0], dataItem[1], Math.sqrt(dataItem[2])]
        }
    });
    
    option = {
        backgroundColor: '#000',
        globe: {
            baseTexture: "/asset/get/s/data-1491837049070-rJZtl7Y6x.jpg",
            heightTexture: "/asset/get/s/data-1491837049070-rJZtl7Y6x.jpg",
            shading: 'lambert',
            environment: '/asset/get/s/data-1491837999815-H1_44Qtal.jpg',
            light: {
                main: {
                    intensity: 2
                }
            },
            viewControl: {
                autoRotate: false
            }
        },
        visualMap: {
            max: 40,
            calculable: true,
            realtime: false,
            inRange: {
                colorLightness: [0.2, 0.9]
            },
            textStyle: {
                color: '#fff'
            },
            controller: {
                inRange: {
                    color: 'orange'  
                }
            },
            outOfRange: {
                colorAlpha: 0
            }
        },
        series: [{
            type: 'bar3D',
            coordinateSystem: 'globe',
            data: data,
            barSize: 0.6,
            minHeight: 0.2,
            maxHeight: 20,
            silent: true,
            itemStyle: {
                color: 'orange'
            }
        }]
    };
    
    myChart.setOption(option);
})

Cross-domain textures

I was playing with EChartsX over the weekend and found one challenge, I'm rendering ECharts in a sandboxed iframe with "allow-same-origin" policy disabled at the moment. This basically means that all images (including those from the same domain) are considered as cross-domain.

The issue is that I can't use ECharts layers at the moment as it throws:
SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Tainted canvases may not be loaded.

So my humble question is if there is any way to enable cross domain resources in WebGL. As far as I know, using cross-domain images in 2D canvas is possible by doing something like this:
image.crossOrigin = "anonymous";

WebGL spec does mention the same approach but I'm not sure if it's applicable or not:
https://www.khronos.org/registry/webgl/specs/latest/1.0/#4.2

Would it be possible to have an option for cross-domain layers and add .crossOrigin = "anonymous"; when enabled?

My other option is to register a new domain name for my sandbox which would prevent security issues even if allow-same-origin was enabled so I have a workaround:)

Anyway, EChartsX look really impressive so can't wait to see more samples;)

Cheers,
Jaro

map3d has not been required.

var React = require("react");
var $ = require('jquery')
var ec = require('echarts')
require('echarts-x/echarts-x')
require('echarts/chart/map')
require('echarts/chart/bar')
require('echarts-x/chart/map3d')
console.log(ec);

3D世界地图内存溢出问题

实现功能如下:
我根据官网上的“World Flights”3D地图写了一个程序,每分钟请求一次数据库,大致100条数据,重新塞数据,在塞数据之前调用myChart.dispose()方法销毁,然后重新初始化,但是差不多20分钟的样子,火狐的浏览器内存就会飙升到2G左右,然后崩溃,请问如何解决?

Uncaught Error: Component series.map3d not exists. Load it first.

Uncaught Error: Component series.map3d not exists. Load it first.
这个是缺少哪个模块

import echarts from 'echarts';
import `'echarts-gl';`
import 'echarts-gl/src/chart/map3D';

let earth = {};

let data = [[-83,76.5,1.1],[-85.5,73.5,2.9],[-78,73,1.5],[-56,72.5,14.9],[-157.5,71.5,1.9],[-157,71.5,7.4],[23.5,71.5,1.3],[24,71.5,1.3],[24.5,71.5,1.3],[25,71.5,3.7],[25.5,71.5,3.8],[26,71.5,3.8],[-52.5,71,11.1],[21.5,71,2.1],[22,71,2.1],[22.5,71,5.2],[23,71,10.4],[23.5,71,7.1],[24,71,1.2],[24.5,71,1.1],[25,71,1.5],[25.5,71,3],[26,71,1.5],[26.5,71,1],[28.5,71,1],[29,71,1.2],[29.5,71,1.7],[30,71,1.7],[30.5,71,1.7],[18,70.5,2.4],[18.5,70.5,6.8],[19,70.5,2.4],[19.5,70.5,2.4],[20,70.5,4.9],[20.5,70.5,6.3],[21,70.5,1.6],[21.5,70.5,1.5]]

let max = -Infinity;
data = data.map(function (item) {
	max = Math.max(item[2], max);
	return {
		geoCoord: item.slice(0, 2),
		value: item[2]
	}
});

data.forEach(function (item) {
	item.barHeight = item.value / max * 50 + 0.1
});

let option =  {
	title : {
		text: 'Gridded Population of the World',
		x:'center',
		y:'top',
		textStyle: {
			color: 'white'
		}
	},
	dataRange: {
		min: 0,
		max: max,
		text:['High','Low'],
		realtime: false,
		calculable : true,
		color: ['red','yellow','lightskyblue']
	},
	series: [{
		type: 'Map3d',
		mapType: 'world',
		baseLayer: {
			backgroundColor: 'rgba(0, 150, 200, 0.5)'
		},
		data: [{}],
		hoverable: false,
		itemStyle: {
			normal: {
				areaStyle: {
					color: 'rgba(0, 150, 200, 0.8)'
				},
				borderColor: '#777'
			}
		},
		markBar: {
			barSize: 0.6,
			data: data
		}
	}]
}

earth.init = function (id,Data) {
	earth.chart = echarts.init(document.getElementById(id));
	earth.chart.setOption(option);
}

export default earth;

cross domain images support

Just started playing with echart-gl - amazing!!!

One thing I've noticed is that you can't load images from other domains, returns:
Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at xxxx may not be loaded.

Would it be possible to add img.crossOrigin = "Anonymous"; when loading images?

和echarts冲突问题

map3d 和 map2D 混合使用时,2d地图上的markpoint 炫光效果的颜色失效(全部是黑色)symbol:'emptyCircle',

比如 map3d_mix.html demo界面,给2d**地图上添加标注 markpoint ,使用 dataRange并启用漫游,markpoint 的炫光效果,颜色失效。

在同一个页面,单独初始化3D和2Dmap也解决不了。

markpoint 的effect 增加 color 属性可以解决问题,但是颜色只能使用单色。并且不会随dataRange的颜色变化。

PS:markpoint 的颜色优先级应该是:datarange < markpoint(itemStyle:color) < effect(color)

Map3D 支持addMarkPoint么?

myChart.setOption({
        series: [{
          name: 'World Population',
          type: 'map3d',
          mapType: 'world',
          markPoint: {
            data: [{distance:0,geoCoord:[0,0],symbolSize:0}]
          }
        }]
      });
      myChart.addMarkPoint(0,{
        data:PopulationData
      });

echarts.js 中代码:
chart && chart.addMark(seriesIdx, markData, markType);
报错:
Uncaught TypeError: undefined is not a function

请问飞行图如何动态添加DATA呢

data.airlines.forEach(function (item) {
var airlineName = item[0];
var routes = routesGroupByAirline[airlineName];
if (routes) {
opts.series.push({
type: 'map3d',
name: "",
markLine: {
effect: {
show: true,
scaleSize: 1
},
distance: 0,
itemStyle:{
normal: {
color: 'rgba(64, 224, 208, 1)',
width: 1,
opacity: 1
}
},
data:[[{"geoCoord":[113.5107,23.2196]},{"geoCoord":[91.1865,30.1465]}]]
}
});
}
});
myChart.setOption(opts);
myChart.hideLoading();

我试着myChart.addMarkLine(0,tmp); 但是不行 提示"cannot read property series of undefined"
tmp={
effect: {
show: true,
scaleSize: 1
},
distance: 0,
itemStyle:{
normal: {
color: 'rgba(64, 224, 208, 1)',
width: 1,
opacity: 1
}
},
data:[[{"geoCoord":[113.5107,23.2196]},{"geoCoord":[91.1865,30.1465]}],[{"geoCoord":[91.1865,30.1465]},{"geoCoord":[113.5107,23.2196]}]]
};

echarts-x依赖的Echarts、zrender、qtek分别是什么版本

我按照官网的方法部署的Echarts-x,运行示例的时候报了很多js文件未找到问题,是不是和版本有关,报错如下:
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/component/dataRange.js"
dataRange.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/config.js"
config.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/zrender/src/tool/util.js"

"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/util/ecData.js"
ecData.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/util/mapData/params.js"
params.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/util/mapData/geoCoord.js"
geoCoord.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/util/mapData/textFixed.js"
textFixed.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/zrender/src/shape/Polygon.js"
Polygon.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/zrender/src/shape/ShapeBundle.js"
ShapeBundle.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/zrender/src/shape/Text.js"
Text.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/chart.js"
chart.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/component/base.js"
base.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/echarts/src/util/shape/Icon.js"
Icon.js
"NetworkError: 404 Not Found - http://localhost:8050/echarts/datavisual/zrender/src/shape/Image.js"

zoom不起作用

我把源码下载到本地,zoom属性不起作用是怎么回事?也不报错误

按照官网上的引入方式没有出图。

require([
'echarts',
'echarts-x',
// ECharts-X 中 map3d 的地图绘制基于 ECharts 中的 map。
'echarts/chart/map',
'echarts/chart/map3d'
........
这是官网给的.但是没用,最后一行改成" 'echarts-x/chart/map3d' "才有效果。

Would be nice if globe color can be customized

Loading textures can take some time, there seems to be no way to configure globe's default color which shows before the texture is loaded:

image

It would be nice if it is possible to set color of the globe.

I've found baseColor option but that seems to be changing the texture when it's loaded:
image

(when baseColor:"blue")

Is it possible to set globes color without affecting the texture when loaded?

Vue+ Webpack2 使用时候报错

npm 安装 "echarts-gl": "^1.0.0-alpha.3",

import echarts from 'echarts-gl' 引入组件
运行时候报错
vue.esm.js?0f63:520
TypeError: __WEBPACK_IMPORTED_MODULE_0_echarts_gl___default.a.init is not a function
at VueComponent.mounted (eval at (app.js:2309), :20:68)
at callHook (eval at (app.js:1010), :2533:21)
at Object.insert (eval at (app.js:1010), :3360:7)
at invokeInsertHook (eval at (app.js:1010), :5178:28)
at Vue$3.patch [as patch] (eval at (app.js:1010), :5342:5)
at Vue$3.Vue._update (eval at (app.js:1010), :2293:19)
at Vue$3.updateComponent (eval at (app.js:1010), :2416:10)
at Watcher.get (eval at (app.js:1010), :2755:25)
at new Watcher (eval at (app.js:1010), :2738:12)
at mountComponent (eval at (app.js:1010), :2420:17)

echartsGL:3Dbar负数不会朝下

One-line summary [问题简述]

echartsGL:3Dbar当data为Z轴负数时,3D柱状不会朝下
Version & Environment [版本及环境]

ECharts version [ECharts 版本]:echarts3.5.4.js和echarts-gl.min.js

Browser version [浏览器类型和版本]:goole 版本 57.0.2987.110 (64-bit)

OS Version [操作系统类型和版本]:wind8

Expected behaviour [期望结果]

echartsGL3Dbar支持负数数据像2D一样,可以跟正数是不同方向
ECharts option [ECharts配置项]

option = {
tooltip: {},
visualMap: {
max: 20,
min:-5,
inRange: {
color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
}
},
xAxis3D: {
axisLine : {onZero: true},
type: 'value',
data: hours
},
yAxis3D: {
axisLine : {onZero: true},
type: 'value',
data: days
},
zAxis3D: {
axisLine : {onZero: true},
type: 'value'
},
grid3D: {
boxWidth: 200,
boxDepth: 80,
viewControl: {
// projection: 'orthographic'
},
light: {
main: {
intensity: 1.2,
shadow: true
},
ambient: {
intensity: 0.3
}
}
},
series: [{
type: 'bar3D',
data: data.map(function (item) {
return {
value: [item[1], item[0], item[2]],
}
}),
shading: 'lambert',

    label: {
        textStyle: {
            fontSize: 16,
            borderWidth: 1
        }
    },

    emphasis: {
        label: {
            textStyle: {
                fontSize: 20,
                color: '#900'
            }
        },
        itemStyle: {
            color: '#900'
        }
    }
}]

}
Other comments [其他信息]

官网示例:http://gallery.echartsjs.com/editor.html?c=xrJ5XyZ5px
把官网示例的data第三个数据改成负数,就可以看到效果

分片加载底图

目前底图纹理用的单张 jpg,放大之后锯齿挺重的。

有打算改用兼容 leaflet 底图源,根据旋转角度和放大级别来加载纹理吗?

下面两个引擎都支持:

P.S.

这个项目太赞了,实现了很多以前本菜想做做不出来的效果……

map3d支持markPoint光影(圈)动态大小变化

在echarts-x地图上想要markPoint有一个动态的光圈,由大变小,显示动态效果。甚至可以为不同的markPoint设置不同的颜色。

像这样设置
markPoint : {

                    symbol:'emptyCircle',
                    symbolSize : function (v){
                        return 10 + v/10
                    },

map3d支持这样吗?我从2d转过来,怎么没有光圈了。

建议增加杜邦分析图

看了echarts感觉非常不错,刚从highchart转向echarts,但从企业应用角度缺少一个常用的财务分析用的图:即杜邦分析图,希望能够在echarts中增加,这样就更完美了

Cut down file size published on npm

Hi, @pissang

首先要表达一下敬仰,这个库做的真心赞! 一定要找个时间好好学习一下。 😸

我注意到echarts-gl发布到npm上的文件比较多, 体积也比较大,除了dist目录, src目录也被发布到了npm上, 感觉有了dist,应该就不再需要src, 是否考虑把src从npm中去掉?

echarts-x怎么把点击事件绑定到坐标点上?

目前我依赖了var ecConfig = require('echarts/config');这个扩展包。
绑定方法如下:
myChart.on(ecConfig.EVENT.CLICK, function (param) {
console.info(param);
console.log(param.name);
window.open('showpage.html');
});
这种方式现在只是绑定到地图区块上。
请问我有这样一个数组对象,代表坐标的经纬度。应该怎么绑定事件呢?
[{
name: '#1 Machu Picchu, Machu Picchu, Peru',
geoCoord: [-72.544963, -13.163141]
}, {
name: '#2 Angkor Wat, Siem Reap, Cambodia',
geoCoord: [103.866986, 13.412469]
}, {
name: '#3 Taj Mahal, Agra, India',
geoCoord: [78.042155, 27.175015]
}, {
name: '#4 Petra World Heritage Site, Wadi Musa, Jordan',
geoCoord: [35.4428063, 30.3251545]
},

Animate globe.viewControl changes

This is probably part of the animation/transition roadmap but just to emphasise - would be nice if dynamic changes in globe.viewControl are animated so that globe would animate to different position if changed dynamically.

Also, might be good to have a way to set geo coordinates rather than numbers for alpha/beta?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.