npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

deepsee-lightpivottable

v1.8.5

Published

A lightweight pivot table for MDX2JSON source for InterSystems Cache

Downloads

6

Readme

Light pivot table for InterSystems Caché

Lightweight, fast and featured pivot table realization for InterSystems Caché.

Features

Installation

There are several variants how to install Light pivot table.

  • Pre-requirement: install and configure MDX2JSON to your Caché instance;
  • If you want to use LPT as a DeepSee portlet, then just download latest release from github releases, unpack it and Simply inport XML file to Caché;
  • If you want to integrate LPT with your application, you need webModule/ directory contents that can be found in release you downloaded;
  • If you want to build most up-to-date version from sources, see the "build" section below.

Integration

Javascript

Build the project, and then include build/WEBModule/css/lightPivotTable.css and build/WEBModule/js/lightPivotTable.js files into your project. Usage is shown in build/WEBModule/index.html example.

Then use global object constructed from LightPivotTable:

var setup = { // Object that contain settings. Properties in brackets can be missed.
        container: document.getElementById("pivot") // HTMLElement which will contain table.
        [, locale: "en" ] // language to use (default: browser default or "en")
        [, logs: false ] // logging disabled by default
        , dataSource: {
            MDX2JSONSource: "http://localhost:57772/SAMPLES", // MDX2JSON server address
            basicMDX: typeof req === "object" ? req.basicMDX : req
            [ , pivot: "name of data source.pivot" ] // name of data source to apply pivot rules
            [ , namespace: "SAMPLES" ] // current namespace : default namespace
            [ , username: "USER" ] // user name : default user
            [ , password: "" ] // user password : default password
            [ , sendCookies: false ] // also send cookies with each request to server
        }
        [ , triggers: { // provide your functions here to handle certain events
             drillDown: function ({Object { level: {number}, mdx: {string} }}) {}
            , drillThrough: function ({Object { level: {number}, mdx: {string} }}) {}
            , back: function ({Object { level: {number} }}) {}
            // if cellDrillThrough callback returns boolean false, DrillThrough won't be performed.
            , cellDrillThrough: function ({Object { event: {event}, filters: {string[]}, cellData: {object} }}) {}
            , responseHandler: function ({Object {url: {string}, status: {number}}}) {}
            // triggers when row selected in listing:
            , rowSelect: function (row, rowData) { console.log("Row #", row, rowData); }
            // if rowClick callback returns boolean false, DrillDown won't be performed.
            , rowClick: function (row, rowData) { console.log(row, rowData); }
            , contentRendered: function () {}
            , cellSelected: function ({ x: Number, y: Number, leftHeaderColumnsNumber: Number, topHeaderRowsNumber: Number }) {
                return false; // return false to block default click action
            }
        } ]
        [ , stretchColumns: true ] // Stretch columns to fill available container space
        [ , pagination: 30 ] // Maximum rows number on one page (default: 200, turn off: 0)
        [ , hideButtons: true ] // hides "back" and "drillThrough" buttons
        [ , triggerEvent: "touchstart" ] // all "click" events will be replaced by this event
        [ , caption: "My table" ] // if set, table basic caption will be replaced by this text
        [ , showSummary: true ] // show summary by columns
        [ , attachTotals: true ] // display totals attached to table top header
        [ , conditionalFormattingOn: true ] // pass false to turn off conditional formatting
        [ , loadingMessageHTML: "LOADING DATA..." ] // HTML displaying during data load
        [ , enableHeadersScrolling: false ] // enable scrolling both for table and headers. Useful for mobile devices.
        [ , defaultFilterSpecs: ["[Date].[H1].[month].&[]"] ] // default filters array
        [ , drillDownTarget: "<dashboard name>" ] // deepSee only - dashboard to open
        [ , listingColumnMinWidth: 200 ] // minimal width of column in listing
        [ , maxHeaderWidth: 100 ] // maximum width of header
        [ , columnResizing: true ] // make columns resizable (default: true)
        [ , columnResizeAnimation: false ] // animate column when resizing
        [ , enableSearch: true ] // enables search panel in listing (default: true)
        [ , showRowNumbers: true ] // show the row number in first column
        [ , enableListingSelect: true ] // enable listing selection, true by default
        [ , showListingRowsNumber: true ] // show rows number in listing and tables if paginated
        [ , rowCount: 5 ] // number of rows to show. Use lp.setRowCount(N) to change rowCount. Manual lp.refresh() needed to apply.
        [ , initialData: { ... } ] // initial data from /MDX query (if present, in MDX2JSON format). Pivot won't request /MDX first time if initial data set. Check twice that dataSource.basicMDX is consistent with the data in this option.
        [ , linksTarget: "_blank" ] // the value of target attributes on all the links on light pivot
    },
    lp = new LightPivotTable(setup);
    
console.log(lp.CONTROLS); // object with functions that can be triggered to control pivot table:
/* Available controls:
 * lp.CONTROLS.drillThrough() - Perform drillThrough for current location.
 * lp.CONTROLS.customDrillThrough(["filterSpec1", ...]) - Perform drillThrough with filters.
 * lp.CONTROLS.back() - Back to the parent level.
 */

lp.setFilter("[DateOfSale].[Actual].[YearSold].&[2009]");

lp.refresh(); // refresh pivot contents
lp.updateSizes(); // recalculate pivot sizes
lp.changeBasicMDX("..."); // change mdx for LPT
var rows = lp.getRowsValues([1,2,3]); // returns the values in rows 1, 2, 3
var model = lp.getModel(); // returns data model representing currently rendered data set
lp.getSelectedRows(); // returns array with selected rows indexes. First row have index 1.
lp.attachTrigger("contentRendered", function (lptInstance) {  }); // attaches trigger during runtime
lp.setRowCount(5); // sets the number of rows to display
console.log( lp.isListing() ); // returns true if current data display is listing

// Additional calls:
lp.pivotView.getCellElement(x, y, considerHeaders); // returns cell element by given coordinates
lp.pivotView.getTableSize(considerHeaders); // returns { width: N, height: M }

Caché DeepSee

To integrate light pivot widget into DeepSee, just perform build and then import build/LightPivotTable.xml into namespace you want. Make sure that MDX2JSON source is installed and configured. Also you may need to change the widget property "MDX2JSON source" to make it work with another MDX2JSON source.

You can obtain LPT instance from widget by calling widgetInstance.registerLPTOnCreateCallback method. This method takes one argument - anonymous function, which will be executed when LPT instance is created. The anonymous function takes one argument - LPT instance.

Build

You need NodeJS platform to be installed in your system to perform any build tasks.

To build project and see working example, gulp and it's plugins must be installed. Simple run npm install command to perform all required installations.

By running npm run build command later, build directory will appear with all required files there.

Debug

Run npm install in the project root to install all required modules, and then execute node test/testServer to run local server. Then give the right URL and MDX as in the example in example/index.html file.

Also anytime you can build project and then check build/example/index.html page.

Preview

Run npm run build command and then check build/WEBModule/index.html. Light pivot table