tableau-js-api-2
v2.8.1
Published
A version of the JS API for Tableau wrapped as an NPM module.
Downloads
204
Maintainers
Readme
Tableau API JS
A version of the JS API for Tableau wrapped as an NPM module.
Node.js (Install)
Requirements:
- Node.js
- npm (Node.js package manager)
npm install tableau-js-api-2
Usage
To use this package:
app.component.ts:
import { Component, OnInit } from '@angular/core';
import * as Tableau from 'tableau-js-api-2';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
constructor() {}
public initViz(): void {
const containerDiv = document.getElementById('vizContainer');
const vizUrl = 'https://public.tableau.com/views/WorldIndicators/GDPpercapita';
const options = {
width: containerDiv.offsetWidth,
height: 700
};
const viz = new Tableau.Viz(containerDiv, vizUrl, options);
}
public ngOnInit(): void {
this.initViz();
}
}
app.component.html:
<div id="vizContainer"></div>
This will provide you with the most up-to-date functionality in the API.
Using a JS library in a TS project
To use the library (without type declarations) in a TypeScript project follow the steps in the following post
More details in the API documentation