Fix Positioning of Y Axis Label

This commit is contained in:
Zicklag 2020-10-14 12:16:12 -05:00
parent 2056d9253c
commit 27c84b8040
3 changed files with 7 additions and 7 deletions

View File

@ -365,7 +365,7 @@ var Profile = /** @class */ (function () {
var div_height = 190;
var svg_width = div_width - 10;
var svg_height = div_height - 40;
var margins = { left: 55, right: 20, top: 10, bottom: 35 };
var margins = { left: 60, right: 20, top: 10, bottom: 35 };
var plot_width = svg_width - margins.left - margins.right;
var plot_height = svg_height - margins.top - margins.bottom;
var radius = 3;
@ -513,8 +513,8 @@ var Profile = /** @class */ (function () {
/****** Add or update y-axis title ******/
var ytitle_sel = plot_area_sel.selectAll('text.ytitle').data([0]);
ytitle_sel.enter().append('text').attr('class', 'ytitle');
ytitle_sel.attr('x', -yscale(0)) // x and y are flipped because of rotation
.attr('y', -50) // Approximate width of y-axis
ytitle_sel.attr('x', -(svg_height - margins.bottom) / 2) // x and y are flipped because of rotation
.attr('y', -45) // Approximate width of y-axis
.attr('transform', 'rotate(-90)')
.style('text-anchor', 'middle')
.style('alignment-baseline', 'central')

File diff suppressed because one or more lines are too long

View File

@ -447,7 +447,7 @@ class Profile {
const div_height = 190;
const svg_width = div_width - 10;
const svg_height = div_height - 40;
const margins = {left: 55, right: 20, top: 10, bottom: 35};
const margins = {left: 60, right: 20, top: 10, bottom: 35};
const plot_width = svg_width - margins.left - margins.right;
const plot_height = svg_height - margins.top - margins.bottom;
const radius = 3;
@ -619,8 +619,8 @@ class Profile {
/****** Add or update y-axis title ******/
let ytitle_sel = plot_area_sel.selectAll('text.ytitle').data([0]);
ytitle_sel.enter().append('text').attr('class', 'ytitle');
ytitle_sel.attr('x', -yscale(0)) // x and y are flipped because of rotation
.attr('y', -50) // Approximate width of y-axis
ytitle_sel.attr('x', - ( svg_height - margins.bottom) / 2)
.attr('y', -45) // Approximate width of y-axis
.attr('transform', 'rotate(-90)')
.style('text-anchor', 'middle')
.style('alignment-baseline', 'central')