🌐 AI搜索 & 代理 主页
Skip to content
This repository was archived by the owner on Oct 21, 2023. It is now read-only.

Commit f050026

Browse files
Merge branch 'master' into develop
2 parents 0192862 + 8de04c9 commit f050026

File tree

11 files changed

+6147
-3807
lines changed

11 files changed

+6147
-3807
lines changed

package-lock.json

Lines changed: 135 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/css/dc.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ div.dc-chart {
5151
.dc-chart .grid-line, .dc-chart .axis .grid-line, .dc-chart .grid-line line, .dc-chart .axis .grid-line line {
5252
fill: none;
5353
stroke: #ccc;
54-
opacity: .5;
5554
shape-rendering: crispEdges; }
5655

5756
.dc-chart .brush rect.selection {
@@ -195,9 +194,6 @@ div.dc-chart {
195194
fill: #fee;
196195
cursor: default; }
197196

198-
.dc-chart circle.dot {
199-
stroke: none; }
200-
201197
.dc-data-count {
202198
float: right;
203199
margin-top: 15px;

web/examples/header.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
!function() {
2+
var path = document.location.pathname;
3+
var dir = /^.*\/([a-z]+)\//.exec(path)[1];
4+
var filename = path.substring(path.lastIndexOf('/')+1);
5+
document.write([
6+
'<div id="header">',
7+
'<a href="//dc-js.github.io/dc.js"><img src="../dc.logo.png" style="float:left; padding-right: 1em" width=50 height=50></img></a>',
8+
'<div id="links" style="padding:10px 0px 0px 10px">',
9+
'<a href="',
10+
'https://github.com/dc-js/dc.datatables.js/tree/develop/web/' + dir + '/' + filename,
11+
'">source</a>',
12+
'<div style="float:right"><span id="version"></span></div>',
13+
'</div>',
14+
'<hr>',
15+
'</div>'
16+
].join(''));
17+
window.onload = function() {
18+
d3.select('#version').text('v' + dc_datatables.version);
19+
};
20+
}();

web/examples/morley.csv

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
Expt,Run,Speed
2+
1,1,850
3+
1,2,740
4+
1,3,900
5+
1,4,1070
6+
1,5,930
7+
1,6,850
8+
1,7,950
9+
1,8,980
10+
1,9,980
11+
1,10,880
12+
1,11,1000
13+
1,12,980
14+
1,13,930
15+
1,14,650
16+
1,15,760
17+
1,16,810
18+
1,17,1000
19+
1,18,1000
20+
1,19,960
21+
1,20,960
22+
2,1,960
23+
2,2,940
24+
2,3,960
25+
2,4,940
26+
2,5,880
27+
2,6,800
28+
2,7,850
29+
2,8,880
30+
2,9,900
31+
2,10,840
32+
2,11,830
33+
2,12,790
34+
2,13,810
35+
2,14,880
36+
2,15,880
37+
2,16,830
38+
2,17,800
39+
2,18,790
40+
2,19,760
41+
2,20,800
42+
3,1,880
43+
3,2,880
44+
3,3,880
45+
3,4,860
46+
3,5,720
47+
3,6,720
48+
3,7,620
49+
3,8,860
50+
3,9,970
51+
3,10,950
52+
3,11,880
53+
3,12,910
54+
3,13,850
55+
3,14,870
56+
3,15,840
57+
3,16,840
58+
3,17,850
59+
3,18,840
60+
3,19,840
61+
3,20,840
62+
4,1,890
63+
4,2,810
64+
4,3,810
65+
4,4,820
66+
4,5,800
67+
4,6,770
68+
4,7,760
69+
4,8,740
70+
4,9,750
71+
4,10,760
72+
4,11,910
73+
4,12,920
74+
4,13,890
75+
4,14,860
76+
4,15,880
77+
4,16,720
78+
4,17,840
79+
4,18,850
80+
4,19,850
81+
4,20,780
82+
5,1,890
83+
5,2,840
84+
5,3,780
85+
5,4,810
86+
5,5,760
87+
5,6,810
88+
5,7,790
89+
5,8,810
90+
5,9,820
91+
5,10,850
92+
5,11,870
93+
5,12,870
94+
5,13,810
95+
5,14,740
96+
5,15,810
97+
5,16,940
98+
5,17,950
99+
5,18,800
100+
5,19,810
101+
5,20,870
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>dc.js - Table of Aggregated Data</title>
5+
<meta charset="UTF-8">
6+
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
7+
<link rel="stylesheet" type="text/css" href="../css/jquery.dataTables.css">
8+
<link rel="stylesheet" type="text/css" href="../css/dc.css"/>
9+
</head>
10+
<body>
11+
12+
<div class="container">
13+
<script type="text/javascript" src="header.js"></script>
14+
15+
<table id="test"></table>
16+
17+
<script type="text/javascript" src="../js/d3.js"></script>
18+
<script type="text/javascript" src="../js/crossfilter.js"></script>
19+
<script type="text/javascript" src="../js/dc.js"></script>
20+
<script type="text/javascript" src="../js/jquery.js"></script>
21+
<script type="text/javascript" src="../js/jquery.dataTables.js"></script>
22+
<script type="text/javascript" src="../js/dc.datatables.js"></script>
23+
<script type="text/javascript">
24+
25+
var chart = dc_datatables.datatable("#test");
26+
d3.csv("morley.csv").then(function(experiments) {
27+
/* Ordinarily a data table will show raw rows of data. But it can also show
28+
aggregated data, by passing a group as the dimension.
29+
30+
This example creates a table that sorts the experiments
31+
from the highest average speed to the lowest average speed.
32+
33+
The `avgGroup` produces the averages for each experiment.
34+
35+
To display the items in descending order, just specify
36+
`.order(d3.descending)` and the data table will use `group.top()`
37+
to fetch the data.
38+
39+
In order to display the items in ascending order, we need to
40+
create a "fake dimension" wrapping the group, because crossfilter
41+
groups don't have a `.bottom(N)` method
42+
43+
https://github.com/dc-js/dc.js/wiki/FAQ#fake-dimensions
44+
*/
45+
var ndx = crossfilter(experiments),
46+
exptDimension = ndx.dimension(function(d) {return +d.Expt;}),
47+
avgGroup = exptDimension.group().reduce(
48+
function (p, v) {
49+
++p.number;
50+
p.total += +v.Speed;
51+
p.avg = Math.round(p.total / p.number);
52+
return p;
53+
},
54+
function (p, v) {
55+
--p.number;
56+
p.total -= +v.Speed;
57+
p.avg = (p.number == 0) ? 0 : Math.round(p.total / p.number);
58+
return p;
59+
},
60+
function () {
61+
return {number: 0, total: 0, avg: 0}
62+
});
63+
64+
chart
65+
.dimension(reversible_group(avgGroup))
66+
.columns([
67+
{
68+
label: 'Expt',
69+
type: 'string',
70+
format: function (d) { return d.key }
71+
},
72+
{
73+
label: '#Run',
74+
type: 'number',
75+
format: function (d) { return d.value.number }
76+
},
77+
{
78+
label: 'Avg(Speed)',
79+
type: 'number',
80+
format: function (d) { return d.value.avg }
81+
}
82+
])
83+
.sortBy(function (d) { return d.value.avg })
84+
.order(d3.descending)
85+
chart.render();
86+
87+
function reversible_group(group) {
88+
return {
89+
top: function(N) {
90+
return group.top(N);
91+
},
92+
bottom: function(N) {
93+
return group.top(Infinity).slice(-N).reverse();
94+
}
95+
};
96+
}
97+
});
98+
99+
</script>
100+
101+
</div>
102+
</body>
103+
</html>

web/js/crossfilter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ module.exports = result;
938938

939939
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
940940
},{}],3:[function(require,module,exports){
941-
module.exports={"version":"1.4.6"}
941+
module.exports={"version":"1.4.7"}
942942
},{}],4:[function(require,module,exports){
943943
if (typeof Uint8Array !== "undefined") {
944944
var crossfilter_array8 = function(n) { return new Uint8Array(n); };

0 commit comments

Comments
 (0)