Fifty-Two- Tableau Extension “Load-Tableau-Summary-Data“

Load Tableau Summary Data

Introduction

When using tableau extension, how to convert tableau summary data to 2D array requires complex conversion.

This package can easily merge multiple worksheets with the same dimension into corresponding two-dimensional arrays.

Use

In the extension:

HTML, first load the tabelau extension plug-in, and then load this plug-in.

...
	<!-- First load the tabelau extension plug-in, and then load this plug-in -->
    <script src="./thirdpt/tableau.extensions.1.4.0.min.js"></script>
	<script src="./secondpt/loadsummarydata.js?t=202009151521"></script>
...


Load the configuration according to the settings of tableau worksheet. If the configuration of the worksheet is as follows:
配置
JS code is as follows:

var objData = {};
objData.tLoadData = new tLoadSD();
var jsonFormated = [
    { wsName: "Cat_Sales", valueName: "Measure Values", rowTitle: ["City","State/Province"] , colTitle: ["Sub-Category","Category"] },
    { wsName: "Sales_Gth", valueName: "Measure Values", rowTitle: ["City","State/Province"] , colTitle: ["YEAR(Ship Date)"] }
  ];

$(function() {
    tableau.extensions.initializeAsync().then(function() {
        objData.tLoadData.loadCfg([], jsonFormated);.
        objData.tLoadData.LoadCol(function() {
            objData.tLoadData.ConvToTable(function() {
                console.log(objData.tLoadData.source);
            });
        });
    };
};

在这里插入图片描述

How to use it

loadCfg(jsonColTitle, arrWS)
  • JSON jsonColTitle column title and corresponding column number

  • Array < JSON > arraws worksheet

Follow up operations can only be carried out after configuration. The ‘arrcoltitle’ can not be configured first. If not, the header of each worksheet can be obtained automatically through the function

-Do not configure column header information for the time being

var jsonFormated = [
    { wsName: "Cat_Sales", valueName: "Measure Values", rowTitle: ["City","State/Province"] , colTitle: ["Sub-Category","Category"] },
    { wsName: "Sales_Gth", valueName: "Measure Values", rowTitle: ["City","State/Province"] , colTitle: ["YEAR(Ship Date)"] }
  ];
objData.tLoadData.loadCfg([], jsonFormated);
  • Configure column header information
var arrForCol={};
objForCol["TOTAL SALES"] = 1;
objForCol["VS. LY%  "] = 2;
objForCol["VS. BUD%"] = 3;
var jsonFormated = [
    { wsName: "Cat_Sales", valueName: "Measure Values", rowTitle: ["City","State/Province"] , colTitle: ["Sub-Category","Category"] },
    { wsName: "Sales_Gth", valueName: "Measure Values", rowTitle: ["City","State/Province"] , colTitle: ["YEAR(Ship Date)"] }
  ];
objData.tLoadData.loadCfg(arrForCol, jsonFormated);
LoadCol(funCB)
  • Function funCB Callback function

Get column header

    objData.tLoadData.LoadCol(function() {
    	console.log(objData.tLoadData);
    });

列表

ConvToTable(funCB)
  • Function funCB Callback function

Get content value

    objData.tLoadData.ConvToTable(function() {
    	console.log(objData.tLoadData);
    });

Content

sortData(intCol,funCB)
  • number intCol Column position
  • Function funCB callback function

Global sort based on the data for a specific column.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值