And*_* NZ 15 javascript charts echarts
有谁知道Echarts(http://echarts.baidu.com)的例子:
所有Echarts示例都非常好地呈现,但是没有示例显示如何在本地(英语)部署和运行它(这相当重要)实际工作.
从我的许多"复制和粘贴"然后编辑努力我只是得到无尽的文件未找到的消息和神秘的人物到处(为了公平他们是汉字但我只把它们视为神秘的波浪形).我还下载了github样本并搜索了Google,但没有成功.
图书馆看起来绝对精彩,但我不能破译它:(
英语中的单个.jsp页面示例(可行)会很棒.谁知道我在哪里找到一个?
谢谢
run*_*r08 13
我知道已经有一个公认的答案,但我想我会为阅读这个问题的人添加一个链接.
新版本的echarts文档(echarts 3.4.0撰写本文时)已转换为英文版.
他们拥有所有文档,包括选项,api代码,下载和许多英文示例(使用codepen类型开发区域,您可以测试您的选项并实时查看结果).
可在此处找到输入页面: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
可以在此处找到简单的条形图示例及其codepen游乐场:ecomfe.github.io/echarts-examples/public/editor.html?c=bar-tick-align
下面我将他们简单的条形图粘贴到窗口,以便您查看:
<!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>Run Code Online (Sandbox Code Playgroud)
Cri*_* S. 11
这是一个简单的例子.只需将其保存到HTML文件中并将其呈现在浏览器中即可.无需下载或配置任何其他内容.它使用远程脚本文件,没有中文文本:
<!doctype html>
<html>
<head>
<title>ECharts Sample</title>
<script src="http://echarts.baidu.com/dist/echarts.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>Run Code Online (Sandbox Code Playgroud)
在他们的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>
Run Code Online (Sandbox Code Playgroud)