来自百度的ECharts
ECharts from Baidu
有谁知道 Echarts (http://echarts.baidu.com) 示例:
- 只使用英文字符
- 从本地目录结构正确导入所有必要的包含
- 有效
所有 Echarts 示例都很好地呈现,但没有示例显示如何部署和 运行 它在本地(英文)实际工作(这很重要)。
从我的许多 'copy and paste' 然后编辑工作中,我只是得到无穷无尽的文件未找到消息和到处都是神秘字符(公平地说,它们是汉字,但我只看到它们是神秘的波浪线)。我还下载了 github 样本并搜索了 Google 但没有成功。
图书馆看起来非常棒,但我无法破译它:(
一个单一的 .jsp 英文页面示例(有效)会很棒。有人知道我在哪里可以找到吗?
谢谢
他们github里面有一个例子,很清楚的解释了图表的使用方法
我刚刚测试了一下,效果很好
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!--Step:1 Prepare a dom for ECharts which (must) has size (width & hight)-->
<!--Step:1 为ECharts准备一个具备大小(宽高)的Dom-->
<div id="main" style="height:500px;border:1px solid #ccc;padding:10px;"></div>
<div id="mainMap" style="height:500px;border:1px solid #ccc;padding:10px;"></div>
<!--Step:2 Import echarts-all.js-->
<!--Step:2 引入echarts-all.js-->
<script src="js/echarts-all.js"></script>
<script type="text/javascript">
// Step:3 echarts & zrender as a Global Interface by the echarts-plain.js.
// Step:3 echarts和zrender被echarts-plain.js写入为全局接口
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption({
tooltip : {
trigger: 'axis'
},
legend: {
data:['蒸发量','降水量']
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {show: true, type: ['line', 'bar']},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
xAxis : [
{
type : 'category',
data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
}
],
yAxis : [
{
type : 'value',
splitArea : {show : true}
}
],
series : [
{
name:'蒸发量',
type:'bar',
data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
},
{
name:'降水量',
type:'bar',
data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
}
]
});
// --- 地图 ---
var myChart2 = echarts.init(document.getElementById('mainMap'));
myChart2.setOption({
tooltip : {
trigger: 'item',
formatter: '{b}'
},
series : [
{
name: '中国',
type: 'map',
mapType: 'china',
selectedMode : 'multiple',
itemStyle:{
normal:{label:{show:true}},
emphasis:{label:{show:true}}
},
data:[
{name:'广东',selected:true}
]
}
]
});
</script>
</body>
</html>
ECharts 确实提供了他们网站的英文版本,包括示例和文档,根据您的问题我猜您没有看到。
https://ecomfe.github.io/echarts/index-en.html
(在这个编辑的时候,他们需要将他们的英文文档更新到3.0版本的echarts)。
https://ecomfe.github.io/echarts/doc/example-en.html
话虽这么说,但有时您希望整个 .js 及其默认字符串都是英文的,但 Google 翻译可以提供帮助。
数据显示是中文的,代码结构和框架在English.Ignore具体数据中,尽量放一些你想显示的数据。
这是一个简单有效的示例。只需将其保存到 HTML 文件中并将其呈现到您的浏览器中即可。无需下载或配置任何其他内容。它使用远程脚本文件,没有中文文本:
<!doctype html>
<html>
<head>
<title>ECharts Sample</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.6.0/echarts-en.min.js"></script>
</head>
<body>
<div id="chart" style="width: 500px; height: 350px;"></div>
<script>
var chart = document.getElementById('chart');
var myChart = echarts.init(chart);
var option = {
title: { text: 'ECharts Sample' },
tooltip: { },
legend: { data: [ 'Sales' ] },
xAxis: { data: [ "shirt", "cardign", "chiffon shirt", "pants", "heels", "socks" ] },
yAxis: { },
series: [{
name: 'Sales',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};
myChart.setOption(option);
</script>
</body>
</html>
我知道已经有一个可接受的答案,但我想我会为阅读这个问题的人添加一个 link。
新版echarts文档(撰写本文时为echarts 3.4.0)已转换为英文。
他们有所有文档,包括选项、api 代码、下载和许多全英文的示例(有一个代码笔类型的开发区域,您可以测试您的选项并实时查看结果).
入口页面可以在这里找到:
https://ecomfe.github.io/echarts-doc/public/en/
库可以在这里下载:
https://ecomfe.github.io/echarts-doc/public/en/download.html
入门教程可以在这里找到:
ecomfe.github.io/echarts-doc/public/en/tutorial.html
可在此处找到众多选项:
ecomfe.github.io/echarts-doc/public/en/option.html
可在此处找到大量示例:
ecomfe.github.io/echarts-examples/public/index.html
可以在此处找到一个简单的条形图示例及其代码笔游乐场:
ecomfe.github.io/echarts-examples/public/editor.html?c=bar-tick-align
下面我将他们的简单条形图粘贴到 window 中供您查看:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts-all-3.js"></script>
</head>
<body>
<div id="container" style="width: 600px; height: 250px;"></div>
<script type="text/javascript">
var chart = document.getElementById("container");
var myChart = echarts.init(chart);
var option = {
title: {
text: "Echarts Bar Chart"
},
legend: [
{
data: ["Hours Worked"]
}
],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
xAxis: [
{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name:'Hours Worked',
type:'bar',
barWidth: '60%',
data: [10, 52, 200, 334, 390, 330, 220]
}
]
};
myChart.setOption(option, true);
</script>
</body>
</html>
如果有人想知道。有人确实将他们的整个 .js 文件翻译成英文,因此按钮和控件以英文显示。这家伙还要求他们在 github 上将他的 'English' 版本合并到 master 中,但我猜他们还不感兴趣。
我测试了他的js文件,是英文的。 zip 文件的 link 也包含在那里。但以防万一它可以在这里找到 - Download
https://github.com/ecomfe/echarts/issues/2321
万一开发者还在寻找英文版的echarts,下面的cdn link有links到英文版:
https://cdnjs.com/libraries/echarts
对我来说很好用。
如果有人在用echarts-for-react,我是这样解决的
toolbox: {
show: true,
orient: 'vertical',
feature: {
dataView: { show: true, title: 'Data View', readOnly: false },
restore: { show: true, title: 'Reset' },
saveAsImage: { show: true, title: "Download" }
},
}
神奇之处在于toolbox.feature.title
有谁知道 Echarts (http://echarts.baidu.com) 示例:
- 只使用英文字符
- 从本地目录结构正确导入所有必要的包含
- 有效
所有 Echarts 示例都很好地呈现,但没有示例显示如何部署和 运行 它在本地(英文)实际工作(这很重要)。
从我的许多 'copy and paste' 然后编辑工作中,我只是得到无穷无尽的文件未找到消息和到处都是神秘字符(公平地说,它们是汉字,但我只看到它们是神秘的波浪线)。我还下载了 github 样本并搜索了 Google 但没有成功。
图书馆看起来非常棒,但我无法破译它:(
一个单一的 .jsp 英文页面示例(有效)会很棒。有人知道我在哪里可以找到吗?
谢谢
他们github里面有一个例子,很清楚的解释了图表的使用方法 我刚刚测试了一下,效果很好
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!--Step:1 Prepare a dom for ECharts which (must) has size (width & hight)-->
<!--Step:1 为ECharts准备一个具备大小(宽高)的Dom-->
<div id="main" style="height:500px;border:1px solid #ccc;padding:10px;"></div>
<div id="mainMap" style="height:500px;border:1px solid #ccc;padding:10px;"></div>
<!--Step:2 Import echarts-all.js-->
<!--Step:2 引入echarts-all.js-->
<script src="js/echarts-all.js"></script>
<script type="text/javascript">
// Step:3 echarts & zrender as a Global Interface by the echarts-plain.js.
// Step:3 echarts和zrender被echarts-plain.js写入为全局接口
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption({
tooltip : {
trigger: 'axis'
},
legend: {
data:['蒸发量','降水量']
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {show: true, type: ['line', 'bar']},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
xAxis : [
{
type : 'category',
data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
}
],
yAxis : [
{
type : 'value',
splitArea : {show : true}
}
],
series : [
{
name:'蒸发量',
type:'bar',
data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
},
{
name:'降水量',
type:'bar',
data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
}
]
});
// --- 地图 ---
var myChart2 = echarts.init(document.getElementById('mainMap'));
myChart2.setOption({
tooltip : {
trigger: 'item',
formatter: '{b}'
},
series : [
{
name: '中国',
type: 'map',
mapType: 'china',
selectedMode : 'multiple',
itemStyle:{
normal:{label:{show:true}},
emphasis:{label:{show:true}}
},
data:[
{name:'广东',selected:true}
]
}
]
});
</script>
</body>
</html>
ECharts 确实提供了他们网站的英文版本,包括示例和文档,根据您的问题我猜您没有看到。
https://ecomfe.github.io/echarts/index-en.html
(在这个编辑的时候,他们需要将他们的英文文档更新到3.0版本的echarts)。
https://ecomfe.github.io/echarts/doc/example-en.html
话虽这么说,但有时您希望整个 .js 及其默认字符串都是英文的,但 Google 翻译可以提供帮助。
数据显示是中文的,代码结构和框架在English.Ignore具体数据中,尽量放一些你想显示的数据。
这是一个简单有效的示例。只需将其保存到 HTML 文件中并将其呈现到您的浏览器中即可。无需下载或配置任何其他内容。它使用远程脚本文件,没有中文文本:
<!doctype html>
<html>
<head>
<title>ECharts Sample</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.6.0/echarts-en.min.js"></script>
</head>
<body>
<div id="chart" style="width: 500px; height: 350px;"></div>
<script>
var chart = document.getElementById('chart');
var myChart = echarts.init(chart);
var option = {
title: { text: 'ECharts Sample' },
tooltip: { },
legend: { data: [ 'Sales' ] },
xAxis: { data: [ "shirt", "cardign", "chiffon shirt", "pants", "heels", "socks" ] },
yAxis: { },
series: [{
name: 'Sales',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};
myChart.setOption(option);
</script>
</body>
</html>
我知道已经有一个可接受的答案,但我想我会为阅读这个问题的人添加一个 link。
新版echarts文档(撰写本文时为echarts 3.4.0)已转换为英文。
他们有所有文档,包括选项、api 代码、下载和许多全英文的示例(有一个代码笔类型的开发区域,您可以测试您的选项并实时查看结果).
入口页面可以在这里找到:
https://ecomfe.github.io/echarts-doc/public/en/
库可以在这里下载:
https://ecomfe.github.io/echarts-doc/public/en/download.html
入门教程可以在这里找到:
ecomfe.github.io/echarts-doc/public/en/tutorial.html
可在此处找到众多选项:
ecomfe.github.io/echarts-doc/public/en/option.html
可在此处找到大量示例:
ecomfe.github.io/echarts-examples/public/index.html
可以在此处找到一个简单的条形图示例及其代码笔游乐场: ecomfe.github.io/echarts-examples/public/editor.html?c=bar-tick-align
下面我将他们的简单条形图粘贴到 window 中供您查看:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts-all-3.js"></script>
</head>
<body>
<div id="container" style="width: 600px; height: 250px;"></div>
<script type="text/javascript">
var chart = document.getElementById("container");
var myChart = echarts.init(chart);
var option = {
title: {
text: "Echarts Bar Chart"
},
legend: [
{
data: ["Hours Worked"]
}
],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
xAxis: [
{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name:'Hours Worked',
type:'bar',
barWidth: '60%',
data: [10, 52, 200, 334, 390, 330, 220]
}
]
};
myChart.setOption(option, true);
</script>
</body>
</html>
如果有人想知道。有人确实将他们的整个 .js 文件翻译成英文,因此按钮和控件以英文显示。这家伙还要求他们在 github 上将他的 'English' 版本合并到 master 中,但我猜他们还不感兴趣。
我测试了他的js文件,是英文的。 zip 文件的 link 也包含在那里。但以防万一它可以在这里找到 - Download
https://github.com/ecomfe/echarts/issues/2321
万一开发者还在寻找英文版的echarts,下面的cdn link有links到英文版:
https://cdnjs.com/libraries/echarts
对我来说很好用。
如果有人在用echarts-for-react,我是这样解决的
toolbox: {
show: true,
orient: 'vertical',
feature: {
dataView: { show: true, title: 'Data View', readOnly: false },
restore: { show: true, title: 'Reset' },
saveAsImage: { show: true, title: "Download" }
},
}
神奇之处在于toolbox.feature.title