mirror of
https://github.com/TBEDP/datavjs.git
synced 2025-12-08 19:45:52 +00:00
Add pie demo
This commit is contained in:
parent
1b1e623aaa
commit
4705eaea0c
10
example/pie/pie_map.csv
Normal file
10
example/pie/pie_map.csv
Normal file
@ -0,0 +1,10 @@
|
||||
50265,北京
|
||||
60555,上海
|
||||
38544,广州
|
||||
27276,深圳
|
||||
20506,西安
|
||||
26916,昆明
|
||||
17636,武汉
|
||||
977,拉萨
|
||||
10406,哈尔滨
|
||||
6695,乌鲁木齐
|
||||
|
53
example/pie/pie_map.html
Normal file
53
example/pie/pie_map.html
Normal file
@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Pie Chart</title>
|
||||
<script src="../../build/deps.js"></script>
|
||||
<!-- chord -->
|
||||
<script src="../../deps/seajs/sea.js"></script>
|
||||
<script>
|
||||
seajs.config({
|
||||
alias: {
|
||||
'DataV': '/lib/datav.js',
|
||||
'Pie': '/lib/charts/pie.js'
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
#chart {
|
||||
border-top: 1px dashed #F00;
|
||||
border-bottom: 1px dashed #F00;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.textArea {
|
||||
border: 2px solid black;
|
||||
color: black;
|
||||
font-family: monospace;
|
||||
height: 3in;
|
||||
overflow: auto;
|
||||
padding: 0.5em;
|
||||
width: 750px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chart"></div>
|
||||
<script>
|
||||
seajs.use(["Pie", "DataV"], function (Pie, DataV) {
|
||||
// DataV.changeTheme("datav");
|
||||
var pie = new Pie("chart", {
|
||||
width: 1000,
|
||||
tag: true
|
||||
});
|
||||
DataV.csv("pie_map.csv", function (source) {
|
||||
pie.setSource(source, {label: 1, value: 0});
|
||||
pie.render();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -189,7 +189,6 @@
|
||||
return function (num) {
|
||||
var thisColor = gotColor;
|
||||
var thisColorCount = colorCount;
|
||||
|
||||
return thisColor[num % thisolorCount];
|
||||
};
|
||||
};
|
||||
@ -254,9 +253,7 @@
|
||||
* @param {String} url JSON文件地址
|
||||
* @param {Function} callback 回调函数
|
||||
*/
|
||||
DataV.json = function (url, callback) {
|
||||
d3.json(url, callback);
|
||||
};
|
||||
DataV.json = d3.json;
|
||||
|
||||
/**
|
||||
* 请求一个CSV文件,并解析
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user