Why Doesn’t My Duration Chart Work?

Why Doesn’t My Duration Chart Work?

Use meta.duration, Not result.duration

If you’re trying to build a chart with duration as the metric and it’s not working, then the reason is probably that you’re trying to get values from result.duration. Use meta.duration instead.

Statements encode the result.duration property as a string in ISO 8601 format: e.g., PT59.14S = 59.14 seconds. In contrast, statements keep the value in the meta.duration property as an integer: e.g., 59140 = 59,140 milliseconds. Because meta.duration is a number, you can use it to calculate the heights of columns in a bar chart.

Duration Conversion Factors

If you want to show values in units other than milliseconds, then in Chart Builder, under Data Settings > Metric Scale, enter one of these conversion factors:
  1. 0.001 seconds
  2. 1.66667e-5 minutes
  3. 2.77778e-7 hours
  4. 1.15741e-8 days
In Metric Builder and List Builder, you do it by adding an inline mathematical operation in the title or subtitle: e.g., ${value.metric * 0.001}.

In VQL, you convert duration by adding a stage that performs the needed math: "$addFields": {"metric": {"$multiply": ["$metric", 2.77778e-7]}}.



    • Related Articles

    • How Do I Build a Sankey Chart?

      How to Build a Sankey Chart If you want to analyze navigation patterns in your course, then you can show branching — and even abandonment — with a Sankey chart. How to create — In an Advanced Graph Query widget, insert code like this… { "title": ...
    • What is Veracity Launch and How Does it Work?

      Veracity Launch is a SaaS solution for e-learning content playback and hosting. It can be used instead of an LMS to provide learners with a content portal for launching content. It provides the ability for learners to enroll and complete courses and ...
    • What Types of Charts Can I Make in the LRS?

      In general, you can make charts in a custom dashboard using two methods: using our Chart Builder, or by programming our Veracity Query Language (VQL). Chart Builder Charts The Chart Builder and similar form-based wizards in the Veracity Learning LRS ...
    • What are Different Ways xAPI Data Can Flow from an LMS to an LRS?

      Client Side This is the most common case. This is usually the approach taken if you create your content in a commercial authoring tool and export the content to xAPI/TinCan. The content package sends xAPI data directly to the LRS. The content package ...
    • What are xAPI Extensions and How Do I Use Them in My xAPI Statements?

      Best Practices for xAPI Extensions Activity, Context, and Result Extensions in xAPI Statements Do you need to know when and how to best use Activity, Context or Result Extensions in your xAPI Statements? This is a common challenge and a frequently ...