{"size": 955, "ext": "js", "max_stars_repo_path": "src/plugins/axisShow.js", "max_stars_repo_name": "GopherJ/vs", "max_stars_repo_stars_event_min_datetime": "2018-04-17T00:34:42.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-03T01:08:32.000Z", "max_issues_repo_path": "src/plugins/axisShow.js", "max_issues_repo_name": "github-grabaz/Vs", "max_issues_repo_issues_event_min_datetime": "2018-07-22T07:10:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-20T08:13:23.000Z", "max_forks_repo_path": "src/plugins/axisShow.js", "max_forks_repo_name": "github-grabaz/Vs", "max_forks_repo_forks_event_min_datetime": "2018-04-17T08:42:06.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-22T09:54:23.000Z"}
{"max_stars_count": 172, "max_issues_count": 15, "max_forks_count": 33, "avg_line_length": 22.7380952381, "max_line_length": 62, "alphanum_fraction": 0.4785340314}
import * as d3 from "d3";

/**
 *
 * control the visibility of axis"s path and line
 *
 * @param {d3.Selection} axisLane
 * @param {Boolean} isAxisPathShow
 * @param {Boolean} isAxisTickShow
 * @return {void}
 */
function axisShow (axisLane, isAxisPathShow, isAxisTickShow) {
    if (!isAxisPathShow) {
        axisLane
            .select(".domain")
            .attr("display", "none");
    }

    if (!isAxisTickShow) {
        axisLane
            .selectAll(".tick line")
            .attr("display", "none");

        axisLane
            .selectAll(".tick text")
            .attr("y", function() {
                const text = d3.select(this),
                    y = text.attr("y");

                return y ? 0 : null;
            })
            .attr("x", function() {
                const text = d3.select(this),
                    x = text.attr("x");

                return x ? 0 : null;
            });
    }
}

export default axisShow;
