github.com/Azareal/Gosora@v0.0.0-20210729070923-553e66b59003/pubnot/chartist/scss/chartist.scss (about)

     1  @import "settings/chartist-settings";
     2  
     3  @mixin ct-responsive-svg-container($width: 100%, $ratio: $ct-container-ratio) {
     4    display: block;
     5    position: relative;
     6    width: $width;
     7  
     8    &:before {
     9      display: block;
    10      float: left;
    11      content: "";
    12      width: 0;
    13      height: 0;
    14      padding-bottom: $ratio * 100%;
    15    }
    16  
    17    &:after {
    18      content: "";
    19      display: table;
    20      clear: both;
    21    }
    22  
    23    > svg {
    24      display: block;
    25      position: absolute;
    26      top: 0;
    27      left: 0;
    28    }
    29  }
    30  
    31  @mixin ct-align-justify($ct-text-align: $ct-text-align, $ct-text-justify: $ct-text-justify) {
    32    -webkit-box-align: $ct-text-align;
    33    -webkit-align-items: $ct-text-align;
    34    -ms-flex-align: $ct-text-align;
    35    align-items: $ct-text-align;
    36    -webkit-box-pack: $ct-text-justify;
    37    -webkit-justify-content: $ct-text-justify;
    38    -ms-flex-pack: $ct-text-justify;
    39    justify-content: $ct-text-justify;
    40    // Fallback to text-align for non-flex browsers
    41    @if($ct-text-justify == 'flex-start') {
    42      text-align: left;
    43    } @else if ($ct-text-justify == 'flex-end') {
    44      text-align: right;
    45    } @else {
    46      text-align: center;
    47    }
    48  }
    49  
    50  @mixin ct-flex() {
    51    // Fallback to block
    52    display: block;
    53    display: -webkit-box;
    54    display: -moz-box;
    55    display: -ms-flexbox;
    56    display: -webkit-flex;
    57    display: flex;
    58  }
    59  
    60  @mixin ct-chart-label($ct-text-color: $ct-text-color, $ct-text-size: $ct-text-size, $ct-text-line-height: $ct-text-line-height) {
    61    fill: $ct-text-color;
    62    color: $ct-text-color;
    63    font-size: $ct-text-size;
    64    line-height: $ct-text-line-height;
    65  }
    66  
    67  @mixin ct-chart-grid($ct-grid-color: $ct-grid-color, $ct-grid-width: $ct-grid-width, $ct-grid-dasharray: $ct-grid-dasharray) {
    68    stroke: $ct-grid-color;
    69    stroke-width: $ct-grid-width;
    70  
    71    @if ($ct-grid-dasharray) {
    72      stroke-dasharray: $ct-grid-dasharray;
    73    }
    74  }
    75  
    76  @mixin ct-chart-point($ct-point-size: $ct-point-size, $ct-point-shape: $ct-point-shape) {
    77    stroke-width: $ct-point-size;
    78    stroke-linecap: $ct-point-shape;
    79  }
    80  
    81  @mixin ct-chart-line($ct-line-width: $ct-line-width, $ct-line-dasharray: $ct-line-dasharray) {
    82    fill: none;
    83    stroke-width: $ct-line-width;
    84  
    85    @if ($ct-line-dasharray) {
    86      stroke-dasharray: $ct-line-dasharray;
    87    }
    88  }
    89  
    90  @mixin ct-chart-area($ct-area-opacity: $ct-area-opacity) {
    91    stroke: none;
    92    fill-opacity: $ct-area-opacity;
    93  }
    94  
    95  @mixin ct-chart-bar($ct-bar-width: $ct-bar-width) {
    96    fill: none;
    97    stroke-width: $ct-bar-width;
    98  }
    99  
   100  @mixin ct-chart-donut($ct-donut-width: $ct-donut-width) {
   101    fill: none;
   102    stroke-width: $ct-donut-width;
   103  }
   104  
   105  @mixin ct-chart-series-color($color) {
   106    .#{$ct-class-point}, .#{$ct-class-line}, .#{$ct-class-bar}, .#{$ct-class-slice-donut} {
   107      stroke: $color;
   108    }
   109  
   110    .#{$ct-class-slice-pie}, .#{$ct-class-slice-donut-solid}, .#{$ct-class-area} {
   111      fill: $color;
   112    }
   113  }
   114  
   115  @mixin ct-chart($ct-container-ratio: $ct-container-ratio, $ct-text-color: $ct-text-color, $ct-text-size: $ct-text-size, $ct-grid-color: $ct-grid-color, $ct-grid-width: $ct-grid-width, $ct-grid-dasharray: $ct-grid-dasharray, $ct-point-size: $ct-point-size, $ct-point-shape: $ct-point-shape, $ct-line-width: $ct-line-width, $ct-bar-width: $ct-bar-width, $ct-donut-width: $ct-donut-width, $ct-series-names: $ct-series-names, $ct-series-colors: $ct-series-colors) {
   116  
   117    .#{$ct-class-label} {
   118      @include ct-chart-label($ct-text-color, $ct-text-size);
   119    }
   120  
   121    .#{$ct-class-chart-line} .#{$ct-class-label},
   122    .#{$ct-class-chart-bar} .#{$ct-class-label} {
   123      @include ct-flex();
   124    }
   125  
   126    .#{$ct-class-chart-pie} .#{$ct-class-label},
   127    .#{$ct-class-chart-donut} .#{$ct-class-label} {
   128      dominant-baseline: central;
   129    }
   130  
   131    .#{$ct-class-label}.#{$ct-class-horizontal}.#{$ct-class-start} {
   132      @include ct-align-justify(flex-end, flex-start);
   133      // Fallback for browsers that don't support foreignObjects
   134      text-anchor: start;
   135    }
   136  
   137    .#{$ct-class-label}.#{$ct-class-horizontal}.#{$ct-class-end} {
   138      @include ct-align-justify(flex-start, flex-start);
   139      // Fallback for browsers that don't support foreignObjects
   140      text-anchor: start;
   141    }
   142  
   143    .#{$ct-class-label}.#{$ct-class-vertical}.#{$ct-class-start} {
   144      @include ct-align-justify(flex-end, flex-end);
   145      // Fallback for browsers that don't support foreignObjects
   146      text-anchor: end;
   147    }
   148  
   149    .#{$ct-class-label}.#{$ct-class-vertical}.#{$ct-class-end} {
   150      @include ct-align-justify(flex-end, flex-start);
   151      // Fallback for browsers that don't support foreignObjects
   152      text-anchor: start;
   153    }
   154  
   155    .#{$ct-class-chart-bar} .#{$ct-class-label}.#{$ct-class-horizontal}.#{$ct-class-start} {
   156      @include ct-align-justify(flex-end, center);
   157      // Fallback for browsers that don't support foreignObjects
   158      text-anchor: start;
   159    }
   160  
   161    .#{$ct-class-chart-bar} .#{$ct-class-label}.#{$ct-class-horizontal}.#{$ct-class-end} {
   162      @include ct-align-justify(flex-start, center);
   163      // Fallback for browsers that don't support foreignObjects
   164      text-anchor: start;
   165    }
   166  
   167    .#{$ct-class-chart-bar}.#{$ct-class-horizontal-bars} .#{$ct-class-label}.#{$ct-class-horizontal}.#{$ct-class-start} {
   168      @include ct-align-justify(flex-end, flex-start);
   169      // Fallback for browsers that don't support foreignObjects
   170      text-anchor: start;
   171    }
   172  
   173    .#{$ct-class-chart-bar}.#{$ct-class-horizontal-bars} .#{$ct-class-label}.#{$ct-class-horizontal}.#{$ct-class-end} {
   174      @include ct-align-justify(flex-start, flex-start);
   175      // Fallback for browsers that don't support foreignObjects
   176      text-anchor: start;
   177    }
   178  
   179    .#{$ct-class-chart-bar}.#{$ct-class-horizontal-bars} .#{$ct-class-label}.#{$ct-class-vertical}.#{$ct-class-start} {
   180      //@include ct-chart-label($ct-text-color, $ct-text-size, center, $ct-vertical-text-justify);
   181      @include ct-align-justify(center, flex-end);
   182      // Fallback for browsers that don't support foreignObjects
   183      text-anchor: end;
   184    }
   185  
   186    .#{$ct-class-chart-bar}.#{$ct-class-horizontal-bars} .#{$ct-class-label}.#{$ct-class-vertical}.#{$ct-class-end} {
   187      @include ct-align-justify(center, flex-start);
   188      // Fallback for browsers that don't support foreignObjects
   189      text-anchor: end;
   190    }
   191  
   192    .#{$ct-class-grid} {
   193      @include ct-chart-grid($ct-grid-color, $ct-grid-width, $ct-grid-dasharray);
   194    }
   195  
   196    .#{$ct-class-grid-background} {
   197      fill: $ct-grid-background-fill;
   198    }
   199  
   200    .#{$ct-class-point} {
   201      @include ct-chart-point($ct-point-size, $ct-point-shape);
   202    }
   203  
   204    .#{$ct-class-line} {
   205      @include ct-chart-line($ct-line-width);
   206    }
   207  
   208    .#{$ct-class-area} {
   209      @include ct-chart-area();
   210    }
   211  
   212    .#{$ct-class-bar} {
   213      @include ct-chart-bar($ct-bar-width);
   214    }
   215  
   216    .#{$ct-class-slice-donut} {
   217      @include ct-chart-donut($ct-donut-width);
   218    }
   219  
   220    @if $ct-include-colored-series {
   221      @for $i from 0 to length($ct-series-names) {
   222        .#{$ct-class-series}-#{nth($ct-series-names, $i + 1)} {
   223          $color: nth($ct-series-colors, $i + 1);
   224  
   225          @include ct-chart-series-color($color);
   226        }
   227      }
   228    }
   229  }
   230  
   231  @if $ct-include-classes {
   232    @include ct-chart();
   233  
   234    @if $ct-include-alternative-responsive-containers {
   235      @for $i from 0 to length($ct-scales-names) {
   236        .#{nth($ct-scales-names, $i + 1)} {
   237          @include ct-responsive-svg-container($ratio: nth($ct-scales, $i + 1));
   238        }
   239      }
   240    }
   241  }