Sum dynamic data

Updated at:

Use the Blueprint Editor to sum real-time data from multiple ticker board widgets and display the result in a separate ticker board.

Demonstration1

Procedure

  1. Log on to the DataV console.

  2. Select a visualization application and click Edit to open the canvas editor.

  3. Add three ticker board widgets to the canvas.

  4. Click a ticker board widget. On the configuration panel, set Title > Title to Sales in H1. In the layer panel, double-click the widget and change its name to Ticker Board-H1. Repeat this step to configure the other two ticker board widgets.imageimage

  5. Select all widgets, right-click, and select Export to Blueprint Editor.

  6. Add a serial processing node and a sequence execution node, and then connect the widgets.image

    • Serial processing node: Generates random data when you click a ticker board. Both nodes use the same processing method. The H2 data is produced by adding a random number to the H1 data.

      var value = Math.random() * 10000
      return [
       {
       "name": "",
       "value": 12345 + value
       }
      ]
    • Sequence execution node: Saves data as a temporary variable, adds the values from the two ticker boards, and feeds the sum into the display widget.

      // Variable A
      return {
       data: [
       {
       name: "up",
       value: data[0].value || 0
       }
       ]
      };
      // Variable B
      return {
       data: [
       {
       name: "down",
       value: data[0].value || 0
       }
       ]
      };
      // A + Variable B
      let dowm = getLocalValue('dowm') || 0;
      let res = data && data.length !== 0 ? data[0].value + dowm : down
      return [{ value: res }]; 
      // B + Variable A
      let up = getLocalValue('up') || 0;
      let res = data && data.length !== 0 ? data[0].value + up : up
      return [{ value: res }]; 
  7. In the upper-right corner of the page, click the image icon to preview the results.翻牌器