$axis-y_width: 40px;
$axis-x_height: 30px;
$axis_border: #ccc;
$axis-y_offset: 10px;
$axis-x_offset: 6px;
$line_border: #eee;
$line_width: 2px;
$line_offset: 6px;

.wrap {
    height: 100%;
}

.grid {
    position: absolute;
    bottom: $axis-x_height;
    top: 15px;
    left: $axis-y_width;
    right: 20px;
    font-size: 0;
}

.layer {
    position: absolute;
    bottom: $axis-x_height;
    top: 15px;
    left: $axis-y_width;
    right: 20px;
    font-size: 0;
}

.line {
    position: absolute;
    fill-opacity: 0;
    stroke-width: $line_width;
}

.line[role="x"] {
    left: 0;
    right: 0;
    border-top: 1px solid $line_border;
}

.line[role="y"] {
    top: 0;
    bottom: -$line_offset;
    /* border-left: 1px solid $line_border; */
}

.axis {
    position: absolute;
    z-index: 2;
}

.axis[role="axisx"] {
    left: $axis-y_width;
    right: 19px;
    bottom: 0;
    height: calc($axis-x_height + 1px);
    border-top: 1px solid $axis_border;
}

.axis[role="axisy"] {
    left: 0;
    top: 14px;
    bottom: $axis-x_height;
    width: calc($axis-y_width + 1px);
    border-right: 1px solid $axis_border;
    border: none;
}

.label {
    position: absolute;
    font-size: 12px;
    z-index: 10;
}

.label[role="label-xName"] {
    right: -50px;
    top: 6px;
    bottom: 0;
}

.label[role="label-yName"] {
    right: 10px;
    top: -25px;
    text-align: center;
}

.label[role="labelx"] {
    top: $axis-x_offset;
    bottom: 0;
    transform: translateX(-50%);
    text-align: center;
}

.label[role="labely"] {
    left: 0;
    right: $axis-y_offset;
    transform: translateY(50%);
    text-align: right;
}

.label-xName {
    right: -50px;
    top: 6px;
    bottom: 0;
}

.label-yName {
    right: 10px;
    top: -30px;
    text-align: right;
}

.elsvg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 修复最下面2px线条在svg中只显示一半的问题 */

.layer[role="layersvg"] {
    bottom: 28px;
}

.area {
    stroke-opacity: 0;
    fill: transparent;
    opacity: 0.2;
}

.elsvg:nth-of-type(5n+1) .line, .elsvg[color][color="info"] .line { stroke: $brand-info; }
.elsvg:nth-of-type(5n+1) .area, .elsvg[color][color="info"] .area { fill: $brand-info; }
.elsvg:nth-of-type(5n+2) .line, .elsvg[color][color="warning"] .line { stroke: $brand-warning; }
.elsvg:nth-of-type(5n+2) .area, .elsvg[color][color="warning"] .area { fill: $brand-warning; }
.elsvg:nth-of-type(5n+3) .line, .elsvg[color][color="success"] .line { stroke: $brand-success; }
.elsvg:nth-of-type(5n+3) .area, .elsvg[color][color="success"] .area { fill: $brand-success; }
.elsvg:nth-of-type(5n+4) .line, .elsvg[color][color="error"] .line { stroke: $brand-error; }
.elsvg:nth-of-type(5n+4) .area, .elsvg[color][color="error"] .area { fill: $brand-error; }
.elsvg:nth-of-type(5n+5) .line, .elsvg[color][color="primary"] .line { stroke: $brand-primary; }
.elsvg:nth-of-type(5n+5) .area, .elsvg[color][color="primary"] .area { fill: $brand-primary; }

.piece {
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px solid transparent;
    /* transition: border-left-color $transition-duration-base; */
}

.piece::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -50%;
    width: 50%;
}

.piece .u-tooltip {
    display: none;
    position: absolute;
    z-index: 10;
    margin-top: -16px;
    white-space: nowrap;
    padding: 4px 12px;
    font-size: 12px;
    background: #333;
    color: #eee;
    box-sizing: border-box;
    max-width: 230px;
}

.piece .u-tooltip::after {
    content: '';
    display: block;
    position: absolute;
    border: 5px solid #333;
}

.piece .u-tooltip[role="u-tooltip-right-top"] {
    margin-left: 6px;
}

.piece .u-tooltip[role="u-tooltip-right-top"]::after {
    top: 10px;
    left: -5px;
    border-left: none;
    border-top-color: transparent;
    border-bottom-color: transparent;
}

.piece .u-tooltip[role="u-tooltip-right-bottom"] {
    margin-left: 6px;
}

.piece .u-tooltip[role="u-tooltip-right-bottom"]::after {
    top: 10px;
    left: -5px;
    border-left: none;
    border-top-color: transparent;
    border-bottom-color: transparent;
}

.piece .u-tooltip[role="u-tooltip-left-top"] {
    margin-right: 10px;
    right: 100%;
}

.piece .u-tooltip[role="u-tooltip-left-top"]::after {
    top: 10px;
    right: -5px;
    border-right: none;
    border-top-color: transparent;
    border-bottom-color: transparent;
}

.piece .u-tooltip[role="u-tooltip-left-bottom"] {
    margin-right: 10px;
    right: 100%;
}

.piece .u-tooltip[role="u-tooltip-left-bottom"]::after {
    top: 10px;
    right: -5px;
    border-right: none;
    border-top-color: transparent;
    border-bottom-color: transparent;
}

.piece:hover {
    border-left-color: rgba(0, 0, 0, 0.2);
}

.piece[scatter]:hover {
    border: none;
}

.piece:hover .u-tooltip {
    display: block;
}

.point {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
    background: white;
    /* border: 2px solid white; */
    border-radius: 100%;
    margin-bottom: -4px;
    margin-left: -4px;
    width: 7px;
    height: 7px;
    display: none;
}

.point[scatter] {
    width: 4px;
    height: 4px;
    margin-bottom: -2px;
    margin-left: -2px;
    border-color: rgb(97, 218, 198);
    background: rgb(97, 218, 198);
    border: 1px solid rgba(0, 153, 255, 0.6);
    display: block;
}

.piece .point {
    background: $brand-info;
}

.piece:hover .point {
    display: block;
}

.piece:hover .point[scatter] {
    transform: scale(2);
}

.piece .point:nth-of-type(5n+1), .piece .point[color][color="info"] { background: $brand-info; }
.piece .point:nth-of-type(5n+2), .piece .point[color][color="warning"] { background: $brand-warning; }
.piece .point:nth-of-type(5n+3), .piece .point[color][color="success"] { background: $brand-success; }
.piece .point:nth-of-type(5n+4), .piece .point[color][color="error"] { background: $brand-error; }
.piece .point:nth-of-type(5n+5), .piece .point[color][color="primary"] { background: $brand-primary; }

.piece .point[special][class] {
    display: block;
    background-color: red;
}
