DEV Community

Cover image for πŸ“Š Building a simple Wireframe Chart with FSCSS
FSCSS tutorial
FSCSS tutorial

Posted on

πŸ“Š Building a simple Wireframe Chart with FSCSS

Ever wanted to make a chart that feels futuristic, minimalist, and wireframe-like?
In this post, I’ll walk through how I built a 24h Transportation Chart using FSCSS, where arrays and shorthand make things much cleaner.

πŸ‘‰ See the live demo on CodePen (https://codepen.io/David-Hux/pen/LEpvRXK).


πŸ”Ή The HTML Structure

We keep it simple:

  • A <section> to wrap everything

  • A <header> for the title & subtitle

  • A .chart container for the bars

  • A .legend footer

<section class="crypto-trans wireframe" aria-label="Crypto Transactions (24h)">
  <header>
    <h3>24h PPGM β€” Frame</h3>
    <small>Gem tranf</small>
  </header>

  <div class="chart" role="img" aria-describedby="chart-desc">
    <div class="bar"></div>
    <div class="bar"></div>
    <div class="bar"></div>
    <div class="bar"></div>
    <div class="bar"></div>
    <div class="bar"></div>
    <div class="bar"></div>
  </div>

  <p id="chart-desc" class="sr-only">
    Bar chart showing 24-hour cryptocurrency transaction data.
  </p>

  <footer class="legend">
    <span class="dot"></span>
    <span>GMframe = ! β€’ NGPP = 10% steps</span>
  </footer>
</section>
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Setting Up FSCSS Arrays

Instead of writing repetitive CSS, FSCSS lets us store values in arrays and map them onto bars.

/* Data arrays */
@arr tokens[PPGM, Wthdr, Spins, fel, NGPP, NGGM, PP]
@arr heights[65%, 82%, 58%, 74%, 33%, 49%, 71%]
@arr colors[#0ff, #77f, #8af, #9cf, #6df, #4ef, #2dd]
@arr length[1,2,3,4,5,6,7]
Enter fullscreen mode Exit fullscreen mode
  • tokens β†’ labels under each bar

  • heights β†’ bar heights (in %)

  • colors β†’ wireframe stroke color per bar

  • length β†’ numeric index for tooltips


πŸ”Ή Layout & Base Styles

We define padding, bar widths, colors, and background panel.
The .chart grid auto-creates one column per bar.

$pad: 1.25rem;  
$radius: 14px;  
$barW: 56px;  
$gap: 14px;  
$grid: rgba(255,255,255,.08);  
$muted: #9fb1d9;  
$bg: #0b1020;  
$panel: rgba(255,255,255,.03);  

.crypto-trans {
  width: min(90%, 1000px);
  margin: 4rem auto;
  padding: $pad!;
  color: #dfe7ff;
  background: $bg!;
  border-radius: $radius!;
  box-shadow: 0 20px 60px rgba(0,0,0,.4),
              inset 0 0 0 1px rgba(255,255,255,.06);
}
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Bars and Wireframe Effect

Each bar is styled with box-shadow instead of solid fill β€” giving a wireframe glow look.
Heights, labels, and colors are auto-assigned via the arrays.

/* Base bar style */
.bar {
  position: relative;
  height: 0;
  border-radius: 10px 10px 0 0;
  background: transparent;
  box-shadow: inset 0 0 0 2px currentColor,
              0 0 12px rgba(0,255,255,.08);
  transition: height 900ms cubic-bezier(.2,.8,.2,1);
}

/* Heights */
.bar:nth-child(@arr.heights[]) {
  height: @arr.heights[];
}

/* Colors */
.bar:nth-child(@arr.colors[]) {
  color: @arr.colors[];
}

/* Labels */
.bar:nth-child(@arr.tokens[]):after {
  content: "@arr.tokens[]";
  position: absolute;
  inset: auto 0 -1.6rem 0;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
}
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Tooltips on Hover

Hover over any bar to see the token name + height.

.bar:nth-child(@arr.length[]):hover::before {
  $length: @arr.length[];
  content: "@arr.tokens[$length!] β€’ @arr.heights[$length!]";
  position: absolute;
  left: 50%;
  bottom: calc(100% + .6rem);
  transform: translateX(-50%);
  padding: .35rem .55rem;
  font-size: .75rem;
  border-radius: 8px;
  background: rgba(5,12,28,.95);
}
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Responsive Adjustments

On smaller screens, we shrink the bar width and hide extra bars to keep things readable.

@media (max-width: 900px) {
  .crypto-trans { $barW: 44px; }
  .chart { height: 19rem; }
}

@media (max-width: 700px) {
  .crypto-trans { $barW: 40px; }
  .chart { height: 17rem; }
  .chart .bar:nth-child(n+7) { display: none; }
}

@media (max-width: 520px) {
  .crypto-trans { $barW: 38px; }
  .chart { height: 15rem; }
  .chart .bar:nth-child(n+6) { display: none; }
}
Enter fullscreen mode Exit fullscreen mode

🎯 Wrap Up

With just one HTML block + FSCSS arrays, we built a stylish wireframe crypto transactions chart that:

  • βœ” auto-assigns labels, heights, and colors

  • βœ” has tooltips on hover

  • βœ” scales down responsively


πŸ™ Thanks for reading

Top comments (0)