Git Product home page Git Product logo

load-tableau-summary-data's Introduction

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: Config 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);
            });
        });
    };
};

Haha

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);
    });

List

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.

load-tableau-summary-data's People

Contributors

berrybc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.