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 Make a Report Table?

      Background A report is a seldom-seen VQL custom widget, sometimes called, “dollar report” ($report). We recently developed a form-based Builder version called, Actor/Object Table. Unlike a chart, which shows a value for one category, a report shows a ...
    • How Do I Add ‘Storytelling’ to a Dashboard?

      If you only use the out-of-the-box dashboards, or have a custom dashboard with one widget, then you’re all set. But, if you decide to build a custom dashboard (or more) with many widgets, then you must consider the overall design. “Widgets” include ...
    • How Do I Tag Groups of Students?

      Our Veracity Launch LMS has a Learner Profile Field feature that lets you “tag” or label a student as belonging to a group that you designate. Then, you can use these metadata tags to streamline later operations on those students and groups in the ...
    • How Do I Show Percent of Students?

      In a custom dashboard, you can easily build a bar chart that shows the number of unique students per course. Chart Builder with simulated data offered in the free Veracity Learning LRS. Problem But what if you want to show the number of unique ...
    • 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 ...