Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                %div.info
  %h2.title [[something]] evolution over time
  %p.description
    Dummy text. Scooby-Dooby-Doo zoinks jeepers jinkies monster ghost roast trap catch that villain danger from Daphne did it again bait plan let's split up and look for clues Scooby Snax spooky ice cream hot chocolate Mystery Machine.
  %p.description Seriously now, just hover the damn data points
%ul.legend
  -(1..3).each do |i|
    %li.entry some description for the data series
%div.grid
  -(1..3).each do |i|
    %ul.f
      -(1..7).each do |j|
        %li.datapoint
  %div.arrows
              
            
!

CSS

              
                @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Cabin+Condensed:400,500,600,700);

$n: 3; /* functions plotted */
$m: 7; /* data points for each */
$grid: (0 400) 100; /* limits & step array for values over years */
$years: (2005 2011) 1; /* limits & step array for years */
$cs: 5em; /* cell side */
$points: (65 150 280 285 265 175 50) 
  (30 95 195 340 410 290 140)
  (125 120 120 200 290 375 430); /* values for each over years */
$nd: length($points); /* number of data sets */
$dd: .5em; /* dot diameter */
$bg: #fafafa; /* background-colour */
$fcs: #62b0c6 #435c61 #7b7c7e; /* colours for data set */
$discreet: #ececec; /* discreet highlighting colour */
$textc: #efe9e0; /* text colour */
$axesc: #008b8b; /* axes text colour */
$dc: #62b0c6; /* dot */

@function asin($val, $e: pi()/7200) {
  /*
   * $val: the value for which we compute the arc sine;
   * $e: tolerated error; lower = better precision
   * 
   * the function returns the arc sine of $val
   * 
   * Examples: 
   * asin(.5) returns 29.97584deg (using default tolerated error)
   * asin(0, pi()/180) returns 0deg
   */
  
  $sum: 0; // the "infinite" sum we compute
  $sign: 1; // sign of angle
  $flag: 0; // 0 if angle in absolute value < 45deg, 1 otherwise
  $i: 0; // current index
  $c: 1;
  $j: 2*$i + 1;
  
  @if abs($val) > sin(45deg) {
    $flag: 1;
    $sign: $val/abs($val);
    $val: sqrt(1 - pow($val, 2));
  }
  
  $term: $c*pow($val, $j)/$j;
  
  @while abs($term) > $e {
    $sum: $sum + $term;
    
    $i: $i + 1;
    $c: $c*(2*$i - 1)/(2*$i);
    $j: 2*$i + 1;
    
    $term: $c*pow($val, $j)/$j;
  }
  
  $result: $sign*($flag*pi()/2 + pow(-1, $flag)*$sum);
  
  @return $result;
}

@function atan($val, $e: pi()/7200) {
  /*
   * $val: the value for which we compute the arc tangent
   * $e: tolerated error; lower = better precision
   * 
   * the function returns the arc tangent of $val
   * 
   * Examples: 
   * atan(1) returns ~45deg (using default tolerated error)
   * atan(0, pi()/180) returns 0deg
   */
  
  $val: $val/sqrt(1 + pow($val, 2));
  
  @return asin($val, $e);
}

html {
  background: $bg;
  font: 100% 'Cabin Condensed', sans-serif
}
body { font-size: .85em; }
ul { padding: 0; list-style: none; }

.info, .legend {
  box-sizing: border-box;
  float: left;
  margin: .5em 1% 2em;
  padding: .5em;
  border: solid .2em $discreet;
}
.info { width: 65%; }
.title { margin: .25em 0 0; }
.legend {
  width: 30%;
  &:before {
    display: block;
    box-shadow: 0 1px $textc, 0 2px dimgrey;
    text-transform: uppercase;
    content: 'legend';
  }
}
.entry  {
  margin: 1em 0 0;
  background-size: 100% 100%;
  transition: background-size 1s;
  @for $i from 1 through $nd {
    &:nth-child(#{$i}):before {
      background: linear-gradient(90deg, nth($fcs, $i) 25%, transparent 25%) no-repeat;
      background-size: inherit;
    }
  }
  &:before {
    display: block;
    height: 1em;
    content: '';
  }
  &:hover { background-size: 400% 100%; }
}

.grid {
  clear: both;
  position: relative;
  margin: 0 auto;
  border-left: solid 1px;
  width: ($m + 2)*$cs; height: ($n + 2)*$cs;
  background: linear-gradient(0deg, $textc 1px, transparent 1px);
  background-size: 1px $cs, 100% 100%;
  color: $textc;
  &:before, &:after {
    box-sizing: border-box;
    position: absolute;
    right: 100%; bottom: 0;
    padding: $cs/2 .875em;
    width: 3em;
    color: $axesc;
    font-weight: 700;
    line-height: $cs;
    text-align: right;
    content: '';
  }
  &:before {
    $dump: null;
    $max: (nth(nth($grid, 1), 2) - nth(nth($grid, 1), 1))/nth($grid, 2);
    height: ($n + 2)*$cs;
    font-style: oblique;
    @for $i from 0 through $max {
      $dump: $dump (nth(nth($grid, 1), 2) - $i*nth($grid, 2));
      content: '#{$dump}';
    }
  }
  &:after {
    $dump: null;
    $max: (nth(nth($years, 1), 2) - nth(nth($years, 1), 1))/nth($years, 2);
    height: ($m + 1)*$cs;
    transform-origin: 100% 100%;
    transform: rotate(90deg) 
      skewY(-36deg) scaleX(cos(30*pi()/180)) translateX(100%);
    @for $i from 0 through $max {
      $dump: $dump nth(nth($years, 1), 2) - nth($years, 2)*$i;
      content: '#{$dump}';
    }
  }
}
.arrows {
  $dump: unquote("inset 0 0 0") $dd/3 $discreet;
  $max: (nth(nth($years, 1), 2) - nth(nth($years, 1), 1))/nth($years, 2);
  position: absolute;
  bottom: 0; left: 0;
  margin: -$dd/2;
  padding: 0;
  width: $dd; height: $dd;
  border-radius: 50%;
  @for $i from 0 through $max {
    $dump: $dump unquote(", ") 
      ($i + 1)*$cs/2 0 0 (-$dd/3) $dc unquote(", ") 
      ($i + 1)*$cs/2 0 $discreet;
  }
  box-shadow: $dump;
  background: $dc;
  font: 2em/1 sans-serif;
  &:before, &:after {
    position: absolute;
    top: -50%; right: -50%; bottom: -50%; left: -50%;
    color: $dc;
    text-align: center;
    content: '➲'
  }
  &:before {
    transform: rotate(-90deg) 
      translate(($n + 2)*$cs/2 + $dd/2) scale(.9);
  }
  &:after {
    transform: 
      translate(($m + 2)*$cs/2 + $dd/2) scale(.9);
  }
}
.f {
  position: absolute;
  margin: 0;
  width: 100%; height: 100%;
  @for $i from 1 through $nd {
    &:nth-of-type(#{$i}) {
      .datapoint {
        $max: (nth(nth($years, 1), 2) - nth(nth($years, 1), 1))/nth($years, 2) + 1;
        @for $j from 1 through $max {
          &:nth-child(#{$j}) {
            bottom: nth(nth($points, $i), $j)*$cs/100;
            left: $j*$cs;
            &:before, &:after {
              position: absolute;
              right: 50%;
              background: nth($fcs, $i);
            }
            &:before {
              $c2: nth(nth($points, $i), $j);
              @if $j > 1 {
                $c3: nth(nth($points, $i), $j - 1);
                $c2: $c2 - $c3;
              }
              $angle: (atan($c2/100)%(2*pi()))*180/pi();
              top: 50%;
              margin: -$dd/6;
              width: $cs; height: $dd/3;
              transform-origin: 100% 50%;
              transform: skewY(#{-$angle}deg);
              content: '';
            }
            &:after {
              bottom: 100%;
              margin: 2*$dd/3 -1.25em;
              width: 2.5em; height: 1.5em;
              border-radius: .25em;
              transform: translateZ(-100em) scale(.01);
              transform-origin: 50% 100%;
              font-weight: 700;
              line-height: 1.5;
              text-align: center;
              transition: transform .5s;
              content: '#{nth(nth($points, $i), $j)}';
            }
          }
        }
        background: nth($fcs, $i);
        &:hover {
          box-shadow: 0 0 0 $dd/2 nth($fcs, $i), 
             0 -$dd/3 0 $dd/2 nth($fcs, $i), 
             0 -2*$dd/3 0 $dd/2 nth($fcs, $i);
        }
      }
    }
  }
}
.datapoint {
  box-sizing: border-box;
  position: absolute;
  z-index: 1;
  margin: -$dd;
  border: solid 2*$dd/3 $discreet;
  width: 2*$dd; height: 2*$dd;
  border-radius: 50%;
  cursor: pointer;
  transition: box-shadow .5s;
}
.datapoint:hover { z-index: 2; }
.grid .f .datapoint:hover:after { transform: scale(1); }
              
            
!

JS

              
                
              
            
!
999px

Console