Vertical Alignment of y-axis Label

HI ,
Had a requirement if we can change the position of y-axis label on a box plot.

image

Using custom style (JS) , tried placing the label manually.

Custom Style(JS) Example

return function () {
  var f = function() {};

f.version="1";

f.afterDraw= function () {

// Arcadia API to get query results
var d = arcapi.dataResult();

// Obtain query results
var rows = d.rows();

// If there's no results , return 
if (rows.length === 0) {
    return;
}

// Get the y-Axis label object
// Fetch the total height of the chart
// Here we need to place the label at vertical center of the chart hence halving the height 
var chartHeight = $('#' + arcapi.chartId()).height()/2;

var labelPos = $('#' + arcapi.chartId() + ' .y.arc-viz-axis-label')
                .attr("x",'-'+chartHeight)    // *** Make sure the '-' is appended before the value
                .attr("y",'-30')    // *** Change for alignment
                .css("transform","rotate(-90deg)");

};

return f;

}();

The above snippet can be used in Bar and Area graph.
Hope this helps! :smile:

2 Likes

@Deepika that’s awesome thanks!