Loading

Cookbook

Polymorphic Dashboards

{
  'title' 'My Polymorphic Dashboard'
    'tiles' <% 
      // dummy data
      NOW 'now' STORE
      [ 1 RAND 10 * ROUND <% 'i' STORE 
        NEWGTS 'data-' $i TOSTRING + RENAME 'g' STORE
        1 10 <% 'ts' STORE $g $now $ts STU * - NaN NaN NaN RAND ADDVALUE DROP %> FOR
        $g
      %> FOR ]
      <%
        'i' STORE
        'gts' STORE
        {
          'type' 'display' 'title' $gts NAME
          'w' 1 'h' 1 'x' $i 'y' 0
          'data' $gts VALUES REVERSE 0 GET 100 * ROUND 100.0 /
        }
      %> LMAP
     %>
    'options' {
      'autoRefresh' 3
    }
}
{
  'title' 'My Polymorphic Dashboard'
  'options' {
    'autoRefresh' 5
  }
  'tiles' <% 
    // dummy data
    NOW 'now' STORE
    [ 1 RAND 10 * ROUND <% 'i' STORE 
      NEWGTS 'data-' $i TOSTRING + RENAME 'g' STORE
      1 10 <% 'ts' STORE $g $now $ts STU * - NaN NaN NaN RAND ADDVALUE DROP %> FOR
      $g
    %> FOR ]
    <%
      'i' STORE
      'gts' STORE
      {
        'type' 'area' 'title' $gts NAME
        'w' 12 'h' 1 'x' 0 'y' $i
        'data' $gts 
      }
    %> LMAP
  %>
}

Zoom sync

{
     'title' 'My Dashboard with zoom sync'
     'tiles' [
        {
          'type' 'bar' 'x' 0 'y' 0 'w' 6 'h' 1
          'options' { 'eventHandler' 'type=zoom,tag=chart1' }
          'macro' <%
            NOW 'now' STORE
            [ 1 4 <% 'i' STORE 
              NEWGTS 'data-' $i TOSTRING + RENAME 'g' STORE
              1 10 <% 'ts' STORE $g $now $ts STU * - NaN NaN NaN RAND ADDVALUE DROP %> FOR
              $g
            %> FOR ] 'data' STORE
            {
              'data' $data
              'events' [
                { 'tags' [ 'chart2' ] 'type' 'zoom' }
              ]
            }
          %>
        }
        {
          'type' 'line' 'x' 6 'y' 0 'w' 6 'h' 1
          'options' { 'eventHandler' 'type=zoom,tag=chart2' }
          'macro' <%
            NOW 'now' STORE
            [ 1 4 <% 'i' STORE 
              NEWGTS 'data-' $i TOSTRING + RENAME 'g' STORE
              1 10 <% 'ts' STORE $g $now $ts STU * - NaN NaN NaN RAND ADDVALUE DROP %> FOR
              $g
            %> FOR ] 'data' STORE
            {
              'data' $data
              'events' [
                { 'tags' [ 'chart1' ] 'type' 'zoom' }
              ]
            }
          %>
        }
     ]
  }

Tiles AutoRefresh

{
  'tiles' [
    {
      'type' 'area' 'x' 0 'y' 0 'w' 12 'h' 1
      'options' { 'autoRefresh' 200 }
      'endpoint' 'wss://sandbox.senx.io/api/v0/mobius'
      'macro' <%
        NEWGTS 'data' RENAME 'gts' STORE
        NOW  'now' STORE
        $now 10 s - $now
        <% 200 ms + %>
        <%
          'i' STORE
          $i 1e-6 * SIN 'v' STORE
          $gts $i NaN NaN NaN $v ADDVALUE DROP
        %> FORSTEP
        $gts SORT
      %>
    }
  ]
}


Explore Discovery tutorials and blog posts on the blog