Lattice Grid Buy a licence

demo D185

Shadow columns: rank and movement in Vue

Rank, percentile and places moved; sort by places moved for live top movers

shadow: { of, kind: 'rankChange' }

This grid adds shadow columns for rank, percentile and places moved, so sorting by places moved surfaces the live top movers. It turns a changing feed into a leaderboard of who rose and fell most, from the movements it already tracks.

Building…
Loading a live grid…

This is the Vue 3 version. A createLatticeGrid component takes the configuration through v-bind, and reactive data flows straight into the grid, so it updates the way the rest of your Vue app does.

The configuration

<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.min.css">
<style>
  #grid > div { height: 460px; }
</style>
<div id="grid"></div>

<script type="module">
  import * as Vue from 'https://esm.sh/vue@3/dist/vue.esm-browser.prod.js';
  import { createGrid } from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.esm.min.js';
  import createLatticeGrid from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/vue.esm.min.js';

  const LatticeGrid = createLatticeGrid({ vue: Vue, createGrid });

  Vue.createApp({
    components: { LatticeGrid },
    data() {
      return {
        config: {
          rowKey: 'id',
          highlightOnChange: { duration: 500 },
          columns: [
            { field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
            { field: 'price', title: 'Price', type: 'number' },
            { id: 'rank',  title: 'Rank',   shadow: { of: 'price', kind: 'rank' }, type: 'number' },
            // rankChange is places climbed since the baseline: the top-movers column.
            { id: 'moved', title: 'Places moved', shadow: { of: 'price', kind: 'rankChange' }, type: 'number', format: { signed: true } },
            { id: 'pct',   title: 'Percentile',   shadow: { of: 'price', kind: 'percentile' }, type: 'number' },
          ],
          // Land sorted on the movers.
          state: { sort: [{ col: 'moved', dir: 'desc' }] },
          rows,  // one symbol per row
        },
      };
    },
    template: '<lattice-grid v-bind="config" />',
  }).mount('#grid');
</script>