Enforced bar ordering in LiveView Web visualization

Enforced bar ordering in LiveView Web visualization

book

Article ID: KB0078541

calendar_today

Updated On:

Products Versions
TIBCO LiveView Web -
TIBCO Streaming -
TIBCO Streaming -

Description

Can we ensure bars will be ordered in a specific arrangement in LiveView Web bar-chart visualizations?

Issue/Introduction

What can and cannot be controlled about bar ordering in streaming data visualization

Resolution

Because of the nature of streaming data, bar order in LiveView Web cannot be consistently enforced.

An initial order can be imposed using a query like:
  SELECT category, value FROM TableName ORDER BY category LIMIT 10

Bar charts most often report the results of a GROUP BY query, which aggregates data. The ORDER BY / LIMIT expression cannot be used along with aggregation in the same query, so to combine both the table must do the aggregation for you so the visualization query can use ORDER BY alone.

The initial query result, called the snapshot, can only include data currently represented by the rows of the table, which may not be a complete set. For example, lets assume the available categories are:
  Alpha
  Beta
  Gamma
  Delta
  Epsilon
but that only data for three categories are currently stored in the table. The initial query may then be bars:
  Beta
  Epsilon
  Gamma
(in Latin alphabetic order).
When rows for Alpha and Delta arrive the bars will be:
  Beta
  Epsilon
  Gamma
  Alpha
  Delta
with the new categories placed at the end. The mix will change whenever a new snapshot is needed.

If a non-alphanumeric sort ordering is required, then the table will need another column on which to order which creates the required sorting order in the visible columns. For example, to impose an order the table will need columns like:
  category, hidden_rank
  Epsilon, 1
  Delta, 2
  Alpha, 3
  Beta, 4
  Gamma, 5
using a query like:
  SELECT category, value, hidden_rank FROM TableName ORDER BY hidden_rank LIMIT 10

Again, this imposed order will be limited to what categories are available during the snapshot, and then again later as new category values appear.

The developer may condition the data so that all categories are always represented at all times, and this may help ensure snapshots are "complete".