Manage parameters in charts

    A parameter is a variable which you can change on the fly to control the visualization in your chart. For example, it allows you to change the time period via a selector.

    Follow the instructions below to add parameters to your chart and control them with a selector.

    Chart parameter limitations

    • The parameter affects only the chat which you apply it to.

    • If you have a parameter with the same name applied to a dataset, the chart parameter will be ignored.

    For this example, we're going to use the Price chart on the first page of your Demo dashboard.

    To add a parameter to your chart:

    1. Select the chart you want to apply a parameter to and click Edit.

    2. In the left pane under the dataset, click +Parameter:

    3. In the Add parameter window:

      1. Name your parameter. For this example, let's call it scale.

      2. Select the parameter Type. You can select the following parameter types:

        For this example, select String.

      3. Specify the parameter's Default value. This is a required field. It's useful when you have no parameter value set in the dashboard, chart URL, or chart settings.

        For this example, type the following: year.

        This is what your configuration should look like:

        parameter-chart-configuration

      4. Click Add. You'll see your parameter in the left pane:

        chart-parameter-ready

    4. Click Add.

    5. Add a calculated field to integrate the parameter into your chart's X axis:

      1. In the left pane under the dataset, click +Field.

      2. Name your new field Period and write the following formula:

        DATETRUNC([Booking Start], [scale])
        
      3. Click Create.

      4. Drag and drop the Period field to the X axis. You should see the following:

        parameter-chart-modified-ready

      5. Click Apply

    6. Add a selector to apply the new parameter to your chart:

      1. Click AddSelector.

      2. Toggle Manual input.

      3. Under Field or parameter name, type Scale.

      4. Under Default value, click Not selected.

      5. In the Possible values window, add the following items to the list:

        • year

        • month

        • week

        • day

        The result should look like this:

        parameter-chart-selector-values

      6. Click Apply.

      7. To select the default value, select year from the Not defined drop-down menu.

      8. Under Title, type Period:.

        Your complete selector configuration should look like this:

        parameter-chart-selector-ready

      9. Click Add.

      10. Place the selector under the chart:

        parameter-chart-layout

      11. In the upper-right corner, click Save.

    7. Select different parameter values from the chart and observe how the level of detail changes on the chart: from year to day.