List carousel

更新时间:
复制 MD 格式

Configure and use the list carousel widget to display scrolling data lists on your data dashboard.

Overview

The list carousel is a table-like widget that uses carousel animation to display data in an orderly list on a data dashboard. You can customize the style and content of rows and columns, and configure list content to include hyperlinks and images.

Scenarios

Use a list carousel when you need to display a large amount of information in a limited area, with content switching automatically or manually. For example, an e-commerce website can use a list carousel to showcase popular products and promotional activities.

Demonstration

B12A90A2-8110-4594-B245-41A4FED8D106

Prerequisites

Add a list carousel

  1. Access the DataV console.

  2. On the Workbench page, in the Data Dashboards area, hover over the target dashboard and click Edit. The canvas editor opens.

  3. In the navigation pane on the left, add the List Carousel widget to the canvas as shown in the following figure.image

You can also use the global search feature to add the widget.

Connect to business data

After you add the widget, connect it to your business data. Click the list carousel, and then on the Data tab on the right, select the data to display in the widget.image

  • The following table describes the data fields accepted by the list carousel widget.

    Field

    Description

    Custom parameters

    The content of the list carousel table. You can customize multiple field values. These values must match the Column Field Name that you set in the Style > Custom Columns section.

    Note

    The field content can use HTML tags. For example, the following code shows how to use the <a> tag to create a hyperlink: "DataV": "<a href='https://www.aliyun.com/product/bigdata/datav?'>DataV Official Website</a>".

    The following shows the data structure of the example list carousel.

    [
      {
        "area": "China",
        "pv": 688,
        "attribute": "xxxxxxxxxxxxxxxxxxx"
      },
      {
        "area": "USA",
        "pv": 688,
        "attribute": "xxxxxxxxxxxxxxxxxxx"
      },
      {
        "area": "Germany",
        "pv": 688,
        "attribute": "xxxxxxxxxxxxxxxxxxx"
      },
      {
        "area": "UK",
        "pv": 688,
        "attribute": "xxxxxxxxxxxxxxxxxxx"
      }
    ]
  • This section describes the core configuration items for the data source.

    Configuration

    Description

    Select Data Source

    Supports various data types, such as CSV files, APIs, and different databases. For more information, see Supported data source types. Edit data fields in a visual table or in code.

    Configure Filter (Optional)

    Customize filter code to transform, filter, display, and perform simple calculations on data. For more information, see Manage data filters.

    Configure Data Mapping

    Map fields from the selected data source to the widget's fields. This enables real-time data matching. Click the image icon to configure field styles.

    View Response Result

    Displays the data connected to the widget in real time. When the widget's data source changes, this section shows the latest data.

    • Click the data response result to view the data field code.

    • Click View Example to see the array type and sample code that the data source accepts. You can write your fields based on the example.

    Other data request configurations:

    • Disable Loading State: If you check this box, the widget's initial loading content does not appear when the widget updates or when you preview the data dashboard.

    • Controlled Mode: If you check this box, the widget does not request data when it initializes. Data requests can only be started by the blueprint editor or by global variable events.

    • Auto Update Request: If you check this box, the platform polls for data updates at the interval you set. If you do not check this box, you must refresh the page manually or use the blueprint editor or global variable events to trigger data updates.

Configure the list carousel

Click the list carousel widget to configure its settings in the panel on the right. You can configure basic styles, advanced settings such as global variables and interaction events, and Blueprint interactions.

Configure styles

In the Style panel, configure styles for the list carousel, such as font, color, and carousel animation. The following table describes the configuration items.

Note

You can also click the image icon to quickly find a configuration item by searching for keywords. The search feature supports fuzzy matching. For more information, see Search for configuration items.

Configuration Item

Description

Illustration

Global Configuration

Defines the widget's position, transparency, and interaction passthrough in the data dashboard.

  • Opacity: The smaller the value, the more transparent the widget. The value ranges from 0 to 1.

  • Interaction Passthrough: If you turn this on, mouse events pass through the widget. This is useful when many widgets are on the dashboard and you need to interact with widgets in lower layers.

image

Quick Styles

Multiple built-in styles are available for the list carousel. You can quickly switch between them as needed.

image

Global Style Configuration

Defines the number of table rows, column spacing, font style, carousel control, animation style, and highlight settings for the list carousel.

  • Carousel: If you enable this feature, the list carousel plays an animation. You can set the animation type, interval, and whether to loop on a single page.

    • Carousel Animation: You can set this to Scroll by Item or Scroll by Page. Scroll by Page scrolls the entire current page, similar to a page-turning effect.

    • No Carousel for Single Page: If you enable this feature, the carousel does not play if the number of data entries is less than the number of table rows (that is, if there is only one page of data).

  • Highlight Configuration: If you enable this feature, when the carousel scrolls to a specific row, that row is highlighted according to the current highlight style settings (font, background color, border, etc.).image

    • Auto Highlight in Sequence: If you enable this feature, each row is automatically highlighted in sequence as the carousel scrolls. If you disable this feature, you can specify a row to highlight.

    • Specify Highlight Serial Number: Enter the serial number of a row in the list carousel to highlight that row. This setting is effective only when the Auto Highlight in Sequence option is disabled.

  • Other Configurations: You can configure settings such as hiding empty rows, scrolling overflow text, view rendering update time, and image settings for custom columns.

    • Hide Empty Rows: If you enable this feature, rows with empty data are automatically hidden.

    • Scroll Overflow Text: If the data in a field is too long, you can set whether the overflow text scrolls and the scroll speed or duration. If you disable scrolling, the overflow text is truncated and not displayed.image

    • Update Immediately: If you enable this feature, the view is rendered immediately when the data is updated. If you disable this feature, the view is updated the next time the carousel loops after the data is updated.

    • Default Image: The default image displayed in a column when the content type of the custom column is set to Image.image

      Note

      Images in PNG, JPG, GIF, and JPEG formats are supported. The image here is not a real image URL but is only displayed as a default image. You can configure the content you want to display in the data source.

image

Table Header Configuration

Defines whether to add a table header to the list carousel and sets the header's row height (as a percentage of the total list carousel height), background color, and text style (font size, color, weight, etc.). If disabled, the list carousel does not have a header.

image

Row Configuration

You can set the background colors for odd and even rows separately, and the callback field for all rows (this field is used as the value field for callback parameters).

Note

The Callback ID has been moved to the Interaction panel in the new version. The interaction feature in the Style panel will be deprecated. Upgrade as soon as possible.

image

Ordinal Number Column Configuration

If you enable this feature, an ordinal number column is generated on the far left of the list carousel. You can set the background color, column width, ordinal icon (circle) radius, and text style such as font, size, and color for the ordinal number column.image

image

Custom Column Configuration

Defines the content and style of list carousel columns. This configuration item is an array where you can configure multiple labels (one label per column). The editor traverses the data and renders it in a loop based on the custom column configuration. The label order determines the column display order, which you can adjust as needed.

  • You can define the column's field name, display name, column width, content type (text or image), whether to wrap text, text style, and image style.

    • Column Field Name: Must be a field name from the data source. After configuration, this column in the list carousel displays the content of the corresponding field from the data source.

    • Column Display Name: Displayed as the header content for this column.

    • Text Style: Takes effect when Content Type is set to Text. You can set the text alignment, font, size, color, and whether to auto wrap. If auto wrap is enabled, the data content in the current column wraps when it overflows. Otherwise, the overflow data may be truncated.

    • Image Style: Takes effect when Content Type is set to Image. You can set the image width, margin, and other properties.

  • Click the image or image icon to add or delete a label column. Click the image or image icon to change the arrangement style of the custom column configuration area. Click the image icon to copy the currently selected label column.

image

Advanced configuration

Define interactions and data transfer relationships between the list carousel and other widgets. The following table describes the configuration items.

Configuration Item

Description

Example

Interaction Events

Defines interaction behaviors with other widgets to enable widget linkage. Click the image icon to define interaction events and actions.

image

Associate Global Variables

You can associate global parameters in the widget to pass parameters between widgets for interaction. Click the image icon to enable the corresponding instruction and associate it with the required global variable.

  • When a single row is clicked: You can click a row in the list carousel to expose a temporary variable. By default, the area, pv, and attribute fields are exposed.

    Note

    This instruction is effective only when the Column Field Name of your list carousel uses the default fields area, pv, and attribute. If your Column Field Name uses custom fields, go to the Blueprint editor and use the When a single row is clicked feature.

    The following figure shows an example of how to configure fields for the When a single row is clicked event in the Blueprint editor.

    image

  • When data scrolls: When the data in the list scrolls, a temporary variable is exposed. By default, the data and index (index value) fields are exposed.

  • When highlighted: When a data row in the list is highlighted, a temporary variable is exposed. By default, the data and index (index value) fields are exposed.

  • End Of Scroll Cycle: When the data rows in the list complete one scroll cycle, temporary variables are emitted. By default, these variables are the message and isEnding fields.

For more information about the configuration, see Configure widget interactions.

Blueprint interaction

Use the Blueprint editor to define interaction relationships and behavioral logic between widgets through visual connections.

Procedure

  1. On the canvas editor page, click the image icon in the upper-left corner of the top menu bar to open the Blueprint editor.

  2. In the layer node list, hover over the list carousel widget and click the image icon to add the widget to the main canvas.

  3. Connect the widgets to configure the Blueprint interaction effects as required.

    The following figure shows an example.image

Configuration items

The following describes the interaction events and their corresponding actions.

Note

You can also click the image icon next to an event or action on the right side of the Blueprint configuration interface to view detailed parameter descriptions.

Category

Subcategory

Description

Event

When data is updated

This event is exposed when the widget data is updated.

When the data request status changes

This event is exposed when the data request status changes. The status values include Void, Loading, Success, and Error.

When a single row is clicked

When you click a row in the list carousel, the data of the current row is exposed. The content varies based on the data response result. The following code shows a data example.

{
  "area": "China",
  "pv": 1,
  "attribute": "Sample data"
}

When data scrolls

When the data rows of the list carousel scroll, this event is triggered and exposes the data and index value of the current page. The following code shows a data example.

{
  "data": [
    {                     // Data on the current page.
      "area": "China",
      "pv": 1,
      "attribute": "Sample data"
     }
   ],  
  "index": 1              // The index value of the list row. The data of the first row is always obtained.
}

When highlighted

When a data row in the list carousel is highlighted, this event is triggered and exposes the data and index value of the current page. The following code shows a data example.

Important

Before you use this event, enable the Style > Highlight > Auto Highlight in Sequence option.

{
  "data": [
    {                     // Data on the current page.
      "area": "China",
      "pv": 1,
      "attribute": "Sample data"
    }
  ],  
  "index": 1              // The index value of the highlighted row.
}

When one scroll loop ends

When the list carousel finishes one scroll loop, this event is triggered, exposes a description that the loop has ended, and stops the scrolling. The following code shows a data example.

{
  "message": "The first scroll loop ends",
  "isEnding": "0"
}

Action

Import Data

Processes data in the format required for widget rendering, imports the data into the widget, and re-renders the widget. You do not need to request data from the server again. The following code shows a data example.

{
  "area": "China",
  "pv": 1,
  "attribute": "Sample data"
}

Request Data

Re-requests data from the server. The data exposed by an upstream data processing node or layer node is used as a parameter. For example, if the API data source configured for the list carousel is https://api.test, and the data passed to the Request Data action is { id: '1'}, the final request is https://api.test?id=1.

Highlight

Highlights the data row content of the list carousel. The following code shows a data example.

{
  "isOrder": true,                       // Whether to scroll and highlight in sequence. Supports sequential scrolling highlight and specified highlight.
  "hightLightIndex": "1",                // The specified highlight value. The serial number of the row to highlight (for example, '1,2,3').
  "hightLightStyle": {                   // Style. The highlight style.
    "color": "#f00",                     // Text color.
    "borderColor": "#f00",               // Border color.
    "borderWidth": 1,                    // Border width.
    "backgroundColor": "yellow",         // Background color.
    "fontSize": 12,                      // Font size.
    "fontWeight": "normal",              // Font weight.
    "fontFamily": "Microsoft Yahei"      // Font.
  }
}

Start Scrolling

Starts the carousel scrolling. The data passed to the action is of the Object type. The following code shows a data example.

{
  "isLoop": true // Whether to loop. The default value is true.
}

Pause Scrolling

Pauses the scrolling. No parameters are required.

Move

Moves the widget to a specified position. The following code shows a data example.

{   // The movement method. Absolute positioning: to. Relative positioning: by. Default value: to.
    "positionType": "to",
    // The specified position. x-coordinate, y-coordinate.
    "attr": 
      {
        "x": 0,
        "y": 0
       },
      // The animation method.
      "animation": 
   {
       "enable": false,
       // The animation duration in milliseconds.
       "animationDuration": 1000,
       // The animation curve. Optional values: linear|easeInOutQuad|easeInOutExpo.
        "animationEasing": "linear"
   }
}

Toggle Visibility

Toggles the widget's visibility between show and hide. The following code shows a data example.

{
  "animationType": "fade",
  "animationDuration": 1000,
  "animationEasing": "linear"
}
  • animationType: The animation method. You can set this to appear (appear/disappear), fade (fade in/fade out), or slideToUp (fly in/fly out). If not configured, there is no animation.

  • animationDuration: The animation duration. The default value is 1000 ms.

  • animationEasing: The animation curve. You can set this to linear (uniform speed), easeInOutQuad (smooth), or easeInOutExpo (slow-fast-slow).

Show

Hide

Update Widget Configuration

Dynamically updates the style configuration of the widget.

  1. First, in the Style panel of the widget, click Copy Configuration to Clipboard to get the widget's configuration data.

  2. Then, in the data processing node on the Blueprint editor configuration page, change the field values for the corresponding styles as needed.

Demo

This demo shows how to combine a column chart with a list carousel to display annual sales by month in a carousel.

  1. Add widgets to the canvas.

    1. Access the DataV console.

    2. Select a data dashboard and click Edit to open the canvas editor.

    3. From the widget library in the navigation pane on the left, add the Column Chart and List Carousel widgets to the canvas as shown in the following figure.image

  2. Configure the column chart.

    1. Connect to a data source.

      Click the column chart widget, click the Data panel, and then modify the static data.image

      The data is as follows.

      [
        {
          "colorField": 100,
          "x": "Jan",
          "y": 280000
        },
        {
          "colorField": 200,
          "x": "Feb",
          "y": 200000
        },
        {
          "colorField": 300,
          "x": "Mar",
          "y": 180000
        },
        {
          "colorField": 400,
          "x": "Apr",
          "y": 160000
        },
        {
          "colorField": 100,
          "x": "May",
          "y": 430000
        },
        {
          "colorField": 200,
          "x": "Jun",
          "y": 200000
        },
        {
          "colorField": 300,
          "x": "Jul",
          "y": 290000
        },
        {
          "colorField": 400,
          "x": "Aug",
          "y": 760000
        },
        {
          "colorField": 100,
          "x": "Sep",
          "y": 260000
        },
        {
          "colorField": 200,
          "x": "Oct",
          "y": 370000
        },
        {
          "colorField": 300,
          "x": "Nov",
          "y": 290000
        },
        {
          "colorField": 400,
          "x": "Dec",
          "y": 150000
        }
      ]
    2. Configure the widget style.

      Click the Style panel, set Label Display on the x-axis to 12, and then disable Animation Effect.image

  3. Configure the list carousel.

    • Click the Data tab and enable Controlled Mode. This prevents the widget from requesting its own static data during initialization. Data requests can be initiated only through the Blueprint editor, which retrieves the data output after an interaction with the column chart.image

    • Click the list carousel widget, click the Style panel, enable the global highlight effect, keep two label columns in the custom columns, and then modify the Column Field Name and Column Display Name.image

    • Column Field Name: Set to Month and Total in that order.

    • Column Display Name: Set to Month and Sales in that order.

  4. Configure the Blueprint interaction.

    Use the Blueprint editor to display annual sales by month in a carousel.

    1. Click the image icon in the upper-left corner of the page to open the Blueprint editor.

    2. On the Layer Node tab on the left, hover over a widget and click the image icon to add the widget to the main canvas.

      Perform this step for both the column chart and list carousel widgets.

    3. On the Logic Node tab on the left, hover over the Serial Data Processing node and click the image icon to add the node to the main canvas. Repeat this step to add two Serial Data Processing nodes.

    4. Connect the widgets and configure the Serial Data Processing nodes as shown in the following figure.image

      Configure the processing methods for the Serial Data Processing nodes.

      • Import data

        return data.map(i => {
          return {
            Month: i.x,
            Total: i.y
          }
        })
      • Interactive highlighting

        return {
          "data": {
            "x": data.data[0].Month,
            "y": data.data[0].Total
          },
          "style": {
            "fillStyle": "#f00"
          }
        }
  5. In the upper-right corner of the page, click Preview to view the result.BBB50DCF-7133-4C78-AC63-71983FD6EFB5