The example below renders a Table for the rounds played and avg. round duration by user's country and browser at Gameplay, our fictitious example demo.

<div id="example"></div>

<script>
  joola.on('ready', function() {
    new joola.viz.Table({
      container: '#example',
      caption: 'Table example',
      query: {
        timeframe: 'last_30_days', 
        interval: 'day', 
        dimensions: ['user.country', 'device.browser'],
        metrics: ['rounds.played', {key: 'rounds.duration', aggregation: 'avg'],
        collection: 'Gameplay'
      }
    });
  });
</script>

Usage

The Table visualization display a set of metrics grouped by a set of dimensions.

new joola.viz.Table(options, callback);

Options

Options are passed via JavaScript.

PROPERTY TYPE DEFAULT DESCRIPTION
container String Required. A valid selector for the target container.
caption String Optional. A caption for the chart.
query Object Required. The query object.
summary.enabled boolean false Optional. Show a summary row of metrics.
summary.placement string top Optional. Summary header row (top
pickers.primary.enabled boolean false Optional. Show a primary dimensions picker.
pickers.add_dimension.enabled boolean false Optional. Show an Add Dimension picker.
pickers.add_metric.enabled boolean false Optional. Show an Add Metric picker.

Callback

The callback function receives two parameters:

  • err includes an err object detailing the exception and its stack.
  • ref reference to the visualization object itself.

Events

The Table class exposes a few events for hooking into its functionality.

EVENT DESCRIPTION
table.init.start Fired when the Table starts loading
table.init.finish Fired when the Table finishes loading

HTML Template

<div class="table-caption"></div>
<div class="controls">
  <div class="primary-dimension-picker"></div>
  <div class="add-dimension-picker"></div>
  <div class="add-metric-picker"></div>
  <button class="btn export" style="float:right">
    <span class="icon icon-download"></span>
  </button>

  <div class="search-wrapper">
    <input class="search" type="text" placeholder="Search..."/>
  </div>
  <div class="clearfix"></div>
</div>
<div class="table-wrapper">
  <table class="jio table">
    <thead></thead>
    <tbody></tbody>
  </table>
</div>
<div class="paging">
  <div class="paging-wrapper">
    <div class="page-size">
      <span class="caption">Show rows: </span>
      <select>
      </select>
    </div>
  </div>
  <div class="showing"></div>
  <div class="navigation">
    <div class="prev chevron before left"></div>
    <div class="next chevron before right"></div>
  </div>
</div>