Skip to content

Commit 499ea29

Browse files
layout
just use tables. they work.
1 parent 5c46d91 commit 499ea29

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

web/examples/align-axes.html

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@
1717
height: 95vh;
1818
width: 100%;
1919
}
20-
.row {
21-
display: flex;
22-
flex-direction: row;
23-
flex: 1 1 auto;
20+
tr.heading td div {
21+
text-align: center;
2422
}
25-
.heading {
26-
flex: 0.25 0.25 auto;
23+
td.heading {
24+
position: relative;
2725
}
28-
div.row:not(.heading) div.heading div {
29-
transform: rotate(-90deg);
30-
}
31-
.entry {
32-
flex: 1 1 auto;
26+
tr.row:not(.heading) td.heading div {
27+
white-space: nowrap;
28+
position: absolute;
29+
top: 50%;
30+
left: 50%;
31+
transform: translateX(-50%) translateY(-50%) rotate(-90deg);
3332
}
3433
.chart-holder {
35-
padding: 20px;
34+
padding: 0 1em;
3635
}
3736
path.left {
3837
stroke: #1f77b4;
@@ -71,7 +70,7 @@
7170
<a href="https://github.com/dc-js/dc.js/blob/develop/web/docs/api-latest.md#dc.coordinateGridMixin+elasticY"><code>elasticY</code></a>.
7271
The left zero point will be horizontal with the right zero point, and the heights of the two series will be equal.
7372
(As with <code>elasticY</code>, height is currently measured from the y=0 line - see <a href="https://github.com/dc-js/dc.js/issues/667">#667</a>.)</p>
74-
<div id="page"></div>
73+
<table id="content"></div>
7574

7675
<script type="text/javascript">
7776
var posiness = ['heading', 'above', 'upward', 'even', 'downward', 'below'];
@@ -119,14 +118,14 @@
119118
var get_value = dc.pluck('value');
120119

121120
function init() {
122-
d3.select('#page')
123-
.selectAll('div').data(posiness)
124-
.enter().append('div').attr('class', function(d) {
121+
d3.select('#content')
122+
.selectAll('tr').data(posiness)
123+
.enter().append('tr').attr('class', function(d) {
125124
return d === 'heading' ? 'heading row' : 'row';
126125
})
127126
.each(function(rposi) {
128-
d3.select(this).selectAll('div').data(posiness)
129-
.enter().append('div').attr('class', function(d) {
127+
d3.select(this).selectAll('td').data(posiness)
128+
.enter().append('td').attr('class', function(d) {
130129
return d === 'heading' ? 'heading entry' : 'entry';
131130
})
132131
.each(function(lposi) {

0 commit comments

Comments
 (0)