Skip to content

Commit b57a081

Browse files
jdhodgesjleft
authored andcommitted
Replaced dominant-baseline with dy to fix alignment issues on IE
Added overflow to prevent legend label cut off on firefox Made font size of labels and values equal so they align properly Changes after code review
1 parent d938089 commit b57a081

File tree

6 files changed

+25
-2
lines changed

6 files changed

+25
-2
lines changed

src/assets/js/chart/legend.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default function() {
55
var priceFormat;
66
var volumeFormat;
77
var timeFormat;
8+
var textYOffset = '0.71em';
89

910
var tooltip = fc.chart.tooltip()
1011
.items([
@@ -14,7 +15,12 @@ export default function() {
1415
['L', function(d) { return priceFormat(d.low); }],
1516
['C', function(d) { return priceFormat(d.close); }],
1617
['V', function(d) { return volumeFormat(d.volume); }]
17-
]);
18+
])
19+
.decorate(function(selection) {
20+
selection.enter()
21+
.selectAll('text')
22+
.attr('dy', textYOffset);
23+
});
1824

1925
function legend(selection) {
2026
selection.each(function(model) {

src/assets/js/chart/nav.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default function() {
1616
var handleBarWidth = 2;
1717
var yExtentPadding = [0, 0.04];
1818
var numberOfSamples = 200;
19+
var xAxisTextYOffset = '0.71em';
1920

2021
var dispatch = d3.dispatch(event.viewChange);
2122
var xScale = fc.scale.dateTime();
@@ -27,7 +28,12 @@ export default function() {
2728
bottom: bottomMargin // Variable also in navigator.less - should be used once ported to flex
2829
})
2930
.xOuterTickSize(0)
30-
.yOuterTickSize(0);
31+
.yOuterTickSize(0)
32+
.decorate(function(selection) {
33+
selection.enter()
34+
.selectAll('.x-axis text')
35+
.attr('dy', xAxisTextYOffset);
36+
});
3137

3238
var viewScale = fc.scale.dateTime();
3339

src/assets/js/chart/primary.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default function() {
4747
var currentYValueAccessor = function(d) { return d.close; };
4848
var currentIndicators = [];
4949
var zoomWidth;
50+
var yAxisTextYOffset = '0.35em';
5051

5152
var crosshairData = [];
5253
var crosshair = fc.tool.crosshair()
@@ -221,6 +222,8 @@ export default function() {
221222
});
222223
closePriceTick.select('text')
223224
.attr('transform', 'translate(' + calloutHeight / 2 + ',1)');
225+
226+
s.selectAll('text').attr('dy', yAxisTextYOffset);
224227
});
225228

226229
var tickValuesWithoutAnnotations = yScale.ticks.apply(yScale, []);

src/assets/styles/axis.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
font-weight: @font-weight-base;
4949
line-height: @line-height-base;
5050
fill: @font-colour;
51+
dominant-baseline: auto;
5152
}
5253
.tick path {
5354
stroke: @gridline-colour;

src/assets/styles/legend.less

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@
1414
width: 500px;
1515
height: 20px;
1616
justify-content: center;
17+
overflow: visible;
18+
19+
.cell {
20+
dominant-baseline: auto;
21+
}
1722

1823
.label {
1924
fill: @legend-label-font-colour;
25+
font-size: 12px;
2026
}
2127
.value {
2228
fill: @legend-value-font-colour;

src/assets/styles/navigator.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
text {
6868
font-size: @font-size-base;
6969
fill: @font-colour;
70+
dominant-baseline: auto;
7071
}
7172

7273
#brush-mask {

0 commit comments

Comments
 (0)