Skip to content

Commit

Permalink
新增例子 彩虹柱形图
Browse files Browse the repository at this point in the history
  • Loading branch information
kener committed Nov 14, 2014
1 parent 18625d9 commit e51085a
Show file tree
Hide file tree
Showing 7 changed files with 346 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/asset/css/echartsHome.css
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ hr {
}
.main {
height: 400px;
/*width: 778px !important;*/
overflow: hidden;
padding : 10px;
margin-bottom: 10px;
Expand Down
Binary file added doc/asset/img/example/bar14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/asset/img/example/bar15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions doc/example-en.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ <h3>Bar (Column)<a name="bar"> </a></h3>
<a href="example/bar11.html"><img src="asset/img/example/cache.png">
<span><strong>Timeline</strong><br/>display how data changes over time</span></a>
</li><!--/li-->
<li data-thumb="asset/img/example/cache.png">
<a href="example/bar14.html"><img src="asset/img/example/cache.png">
<span><strong>Rainbow bar</strong><br/>customizable</span></a>
</li><!--/li-->
<li data-thumb="asset/img/example/cache.png">
<a href="example/bar15.html"><img src="asset/img/example/cache.png">
<span><strong>Multiple sreies rainbow bar</strong><br/>customizable</span></a>
</li><!--/li-->
<li data-thumb="asset/img/example/cache.png">
<a href="example/bar.html"><img src="asset/img/example/cache.png">
<span><strong>Column</strong><br/>multilevel control, customizable</span></a>
Expand Down
8 changes: 8 additions & 0 deletions doc/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ <h3>柱状图<a name="bar"> </a></h3>
<a href="example/bar11.html"><img src="asset/img/example/cache.png">
<span><strong>搭配时间轴</strong><br/>时空维度的数据展现</span></a>
</li><!--/li-->
<li data-thumb="asset/img/example/cache.png">
<a href="example/bar14.html"><img src="asset/img/example/cache.png">
<span><strong>彩虹柱形图</strong><br/>个性化</span></a>
</li><!--/li-->
<li data-thumb="asset/img/example/cache.png">
<a href="example/bar15.html"><img src="asset/img/example/cache.png">
<span><strong>多系列彩虹柱形图</strong><br/>个性化</span></a>
</li><!--/li-->
<li data-thumb="asset/img/example/cache.png">
<a href="example/bar.html"><img src="asset/img/example/cache.png">
<span><strong>柱状图</strong><br/>个性化,柱形宽度,填充、高亮、文本样式等</span></a>
Expand Down
155 changes: 155 additions & 0 deletions doc/example/bar14.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ECharts">
<meta name="author" content="[email protected]">
<title>ECharts · Example</title>

<link rel="shortcut icon" href="../asset/ico/favicon.png">

<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link href="../asset/css/bootstrap.css" rel="stylesheet">
<link href="../asset/css/carousel.css" rel="stylesheet">
<link href="../asset/css/echartsHome.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<script src="./www/js/echarts.js"></script>
<script src="../asset/js/codemirror.js"></script>
<script src="../asset/js/javascript.js"></script>

<link href="../asset/css/codemirror.css" rel="stylesheet">
<link href="../asset/css/monokai.css" rel="stylesheet">
</head>

<body>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>


<div class="container-fluid">
<div class="row-fluid example">
<div id="sidebar-code" class="col-md-4">
<div class="well sidebar-nav">
<div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
<textarea id="code" name="code">
option = {
title: {
x: 'center',
text: 'ECharts例子个数统计',
subtext: 'Rainbow bar example',
link: 'http://echarts.baidu.com/doc/example.html'
},
tooltip: {
trigger: 'item'
},
toolbox: {
show: true,
feature: {
dataView: {show: true, readOnly: false},
restore: {show: true},
saveAsImage: {show: true}
}
},
calculable: true,
grid: {
borderWidth: 0,
y: 80,
y2: 60
},
xAxis: [
{
type: 'category',
show: false,
data: ['Line', 'Bar', 'Scatter', 'K', 'Pie', 'Radar', 'Chord', 'Force', 'Map', 'Gauge', 'Funnel']
}
],
yAxis: [
{
type: 'value',
show: false
}
],
series: [
{
name: 'ECharts例子个数统计',
type: 'bar',
itemStyle: {
normal: {
color: function(params) {
// build a color map as your need.
var colorList = [
'#C1232B','#B5C334','#FCCE10','#E87C25','#27727B',
'#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
'#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
];
return colorList[params.dataIndex]
},
label: {
show: true,
position: 'top',
formatter: '{b}\n{c}'
}
}
},
data: [12,21,10,4,12,5,6,5,25,23,7],
markPoint: {
tooltip: {
trigger: 'item',
backgroundColor: 'rgba(0,0,0,0)',
formatter: function(params){
return '<img src="'
+ params.data.symbol.replace('image://', '')
+ '"/>';
}
},
data: [
{xAxis:0, y: 350, name:'Line', symbolSize:20, symbol: 'image://../asset/ico/折线图.png'},
{xAxis:1, y: 350, name:'Bar', symbolSize:20, symbol: 'image://../asset/ico/柱状图.png'},
{xAxis:2, y: 350, name:'Scatter', symbolSize:20, symbol: 'image://../asset/ico/散点图.png'},
{xAxis:3, y: 350, name:'K', symbolSize:20, symbol: 'image://../asset/ico/K线图.png'},
{xAxis:4, y: 350, name:'Pie', symbolSize:20, symbol: 'image://../asset/ico/饼状图.png'},
{xAxis:5, y: 350, name:'Radar', symbolSize:20, symbol: 'image://../asset/ico/雷达图.png'},
{xAxis:6, y: 350, name:'Chord', symbolSize:20, symbol: 'image://../asset/ico/和弦图.png'},
{xAxis:7, y: 350, name:'Force', symbolSize:20, symbol: 'image://../asset/ico/力导向图.png'},
{xAxis:8, y: 350, name:'Map', symbolSize:20, symbol: 'image://../asset/ico/地图.png'},
{xAxis:9, y: 350, name:'Gauge', symbolSize:20, symbol: 'image://../asset/ico/仪表盘.png'},
{xAxis:10, y: 350, name:'Funnel', symbolSize:20, symbol: 'image://../asset/ico/漏斗图.png'},
]
}
}
]
};
</textarea>
</div><!--/.well -->
</div><!--/span-->
<div id="graphic" class="col-md-8">
<div id="main" class="main"></div>
<div>
<button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
<span class="text-primary">切换主题</span>
<select id="theme-select"></select>

<span id='wrong-message' style="color:red"></span>
</div>
</div><!--/span-->
</div><!--/row-->

</div><!--/.fluid-container-->

<footer id="footer"></footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../asset/js/jquery.min.js"></script>
<script type="text/javascript" src="../asset/js/echartsHome.js"></script>
<script src="../asset/js/bootstrap.min.js"></script>
<script src="../asset/js/echartsExample.js"></script>
</body>
</html>
174 changes: 174 additions & 0 deletions doc/example/bar15.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ECharts">
<meta name="author" content="[email protected]">
<title>ECharts · Example</title>

<link rel="shortcut icon" href="../asset/ico/favicon.png">

<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link href="../asset/css/bootstrap.css" rel="stylesheet">
<link href="../asset/css/carousel.css" rel="stylesheet">
<link href="../asset/css/echartsHome.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<script src="./www/js/echarts.js"></script>
<script src="../asset/js/codemirror.js"></script>
<script src="../asset/js/javascript.js"></script>

<link href="../asset/css/codemirror.css" rel="stylesheet">
<link href="../asset/css/monokai.css" rel="stylesheet">
</head>

<body>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>


<div class="container-fluid">
<div class="row-fluid example">
<div id="sidebar-code" class="col-md-4">
<div class="well sidebar-nav">
<div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
<textarea id="code" name="code">
var zrColor = require('zrender/tool/color');
var colorList = [
'#ff7f50','#87cefa','#da70d6','#32cd32','#6495ed',
'#ff69b4','#ba55d3','#cd5c5c','#ffa500','#40e0d0'
];
var itemStyle = {
normal: {
color: function(params) {
if (params.dataIndex < 0) {
// for legend
return zrColor.lift(
colorList[colorList.length - 1], params.seriesIndex * 0.1
);
}
else {
// for bar
return zrColor.lift(
colorList[params.dataIndex], params.seriesIndex * 0.1
);
}
}
}
};
option = {
title: {
text: '2010-2013年中国城镇居民家庭人均消费构成(元)',
subtext: '数据来自国家统计局',
sublink: 'http://data.stats.gov.cn/search/keywordlist2?keyword=%E5%9F%8E%E9%95%87%E5%B1%85%E6%B0%91%E6%B6%88%E8%B4%B9'
},
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(255,255,255,0.7)',
axisPointer: {
type: 'shadow'
},
formatter: function(params) {
// for text color
var color = colorList[params[0].dataIndex];
var res = '<div style="color:' + color + '">';
res += '<strong>' + params[0].name + '消费(元)</strong>'
for (var i = 0, l = params.length; i < l; i++) {
res += '<br/>' + params[i].seriesName + ' : ' + params[i].value
}
res += '</div>';
return res;
}
},
legend: {
x: 'right',
data:['2010','2011','2012','2013']
},
toolbox: {
show: true,
orient: 'vertical',
y: 'center',
feature: {
mark: {show: true},
dataView: {show: true, readOnly: false},
restore: {show: true},
saveAsImage: {show: true}
}
},
calculable: true,
grid: {
y: 80,
y2: 40,
x2: 40
},
xAxis: [
{
type: 'category',
data: ['食品', '衣着', '居住', '家庭设备及用品', '医疗保健', '交通和通信', '文教娱乐服务', '其他']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '2010',
type: 'bar',
itemStyle: itemStyle,
data: [4804.7,1444.3,1332.1,908,871.8,1983.7,1627.6,499.2]
},
{
name: '2011',
type: 'bar',
itemStyle: itemStyle,
data: [5506.3,1674.7,1405,1023.2,969,2149.7,1851.7,581.3]
},
{
name: '2012',
type: 'bar',
itemStyle: itemStyle,
data: [6040.9,1823.4,1484.3,1116.1,1063.7,2455.5,2033.5,657.1]
},
{
name: '2013',
type: 'bar',
itemStyle: itemStyle,
data: [6311.9,1902,1745.1,1215.1,1118.3,2736.9,2294,699.4]
}
]
};
</textarea>
</div><!--/.well -->
</div><!--/span-->
<div id="graphic" class="col-md-8">
<div id="main" class="main"></div>
<div>
<button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
<span class="text-primary">切换主题</span>
<select id="theme-select"></select>

<span id='wrong-message' style="color:red"></span>
</div>
</div><!--/span-->
</div><!--/row-->

</div><!--/.fluid-container-->

<footer id="footer"></footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../asset/js/jquery.min.js"></script>
<script type="text/javascript" src="../asset/js/echartsHome.js"></script>
<script src="../asset/js/bootstrap.min.js"></script>
<script src="../asset/js/echartsExample.js"></script>
</body>
</html>

0 comments on commit e51085a

Please sign in to comment.