Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: objectscript/LightPivotTable
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.8.4
Choose a base ref
...
head repository: objectscript/LightPivotTable
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jul 10, 2017

  1. Copy the full SHA
    c58556c View commit details

Commits on Nov 22, 2017

  1. Caption handling fix

    nikitaeverywhere committed Nov 22, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d98bb01 View commit details
  2. Copy the full SHA
    e8e84dd View commit details
  3. Fix get max level

    nikitaeverywhere committed Nov 22, 2017
    Copy the full SHA
    65386b5 View commit details

Commits on Nov 23, 2017

  1. Copy the full SHA
    d67db5a View commit details
  2. Undo last change

    nikitaeverywhere committed Nov 23, 2017
    Copy the full SHA
    688d4c9 View commit details
  3. Copy the full SHA
    3c265e7 View commit details

Commits on Nov 27, 2017

  1. Copy the full SHA
    dea08fb View commit details

Commits on Mar 18, 2018

  1. Copy the full SHA
    8d5c573 View commit details

Commits on Nov 12, 2018

  1. Copy the full SHA
    b8f94d5 View commit details

Commits on Nov 12, 2020

  1. Copy the full SHA
    871d3f9 View commit details
  2. Merge pull request #18 from intersystems-ru/added-request-error-callback

    added request error callback support
    gnibeda authored Nov 12, 2020
    Copy the full SHA
    1fc6df0 View commit details
  3. moved to responseHandler

    gnibeda committed Nov 12, 2020
    Copy the full SHA
    1927269 View commit details
  4. Merge pull request #19 from intersystems-ru/added-request-error-callback

    moved to responseHandler
    gnibeda authored Nov 12, 2020
    Copy the full SHA
    e20fcb9 View commit details
  5. Copy the full SHA
    0abf588 View commit details
  6. Merge pull request #20 from intersystems-ru/added-request-error-callback

    removed readme line for onRequestError
    gnibeda authored Nov 12, 2020
    Copy the full SHA
    d4eb66e View commit details
  7. removed whitespace

    gnibeda committed Nov 12, 2020
    Copy the full SHA
    e459407 View commit details
  8. Copy the full SHA
    2d4a8bc View commit details
  9. Bump version

    nikitaeverywhere committed Nov 12, 2020
    Copy the full SHA
    644dcac View commit details

Commits on Nov 10, 2022

  1. removed whitespace

    agnybida committed Nov 10, 2022
    Copy the full SHA
    e4ead19 View commit details
  2. Copy the full SHA
    300471d View commit details
Showing with 68 additions and 30 deletions.
  1. +3 −0 .gitignore
  2. +10 −2 example/index.html
  3. +5 −1 package.json
  4. +40 −20 source/js/DataController.js
  5. +8 −5 source/js/DataSource.js
  6. +1 −1 source/js/MDXParser.js
  7. +1 −1 source/js/PivotView.js
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
build/
package-lock.json
12 changes: 10 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -86,7 +86,15 @@
{
basicMDX: 'SELECT NON EMPTY {[Measures].[%COUNT],%LABEL([Measures].[Avg Age],"Avg Age (ex. 1)",""),%LABEL([Measures].[Avg Age],"Avg Age (ex. 2)",""),%LABEL([Measures].[Avg Age],"Avg Age (ex. 3)","")} ON 0,NON EMPTY [AllerSevD].[H1].[Allergy Severities].Members ON 1 FROM [Patients]',
pivot: "Pivot Features/Conditional Formatting.pivot"
}
},
{
basicMDX: 'SELECT NON EMPTY HEAD({NONEMPTYCROSSJOIN([Product].[P1].[Product Category].&[Pasta],[Measures].[Units Sold]),NONEMPTYCROSSJOIN([Product].[P1].[Product Category].&[Pasta],[Measures].[Amount Sold])},2000,SAMPLE) ON 1 FROM [HOLEFOODS]',
pivot: 'OH/Measure labels displayed.pivot'
},
{
basicMDX: 'SELECT NON EMPTY HEAD({NONEMPTYCROSSJOIN([Product].[P1].[Product Category].&[Pasta],[Measures].[Units Sold]),NONEMPTYCROSSJOIN([Product].[P1].[Product Category].&[Pasta],[Measures].[Amount Sold])},2000,SAMPLE) ON 1 FROM [HOLEFOODS]',
pivot: 'OH/Measure labels ommitted.pivot'
}
][v],
setup;

@@ -98,7 +106,7 @@
container: document.getElementById("pivot") // HTMLElement which will contain table.
//, locale: "en" // language to use (default: browser default or "en")
, dataSource: {
MDX2JSONSource: "http://" + location.hostname + ":57776/MDX2JSON"
MDX2JSONSource: "http://" + location.hostname + ":57772/MDX2JSON"
//MDX2JSONSource: "http://37.139.4.54/MDX2JSON"
// MDX2JSON server address
, basicMDX: typeof req === "object" ? req.basicMDX : req
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "LightPivotTable",
"author": "ZitRo",
"version": "1.8.4",
"version": "1.8.14",
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
"main": "test/testServer.js",
"repository": {
@@ -34,5 +34,9 @@
],
"dependencies": {
"gulp-header": "^1.2.2"
},
"engines": {
"node": "10.15.3",
"npm": "6.9.0"
}
}
60 changes: 40 additions & 20 deletions source/js/DataController.js
Original file line number Diff line number Diff line change
@@ -409,6 +409,8 @@ DataController.prototype.resetRawData = function () {
}

var rd0 = [], rd1 = [], groupNum = 2, rawData = [];
var MEASURES_HIDDEN = _.controller.CONFIG["pivotProperties"]
&& _.controller.CONFIG["pivotProperties"]["hideMeasures"] === 2;

var transpose = function (a) {
return Object.keys(a[0]).map(function (c) {
@@ -441,14 +443,30 @@ DataController.prototype.resetRawData = function () {
}
};

var getMaxLevel = function (c) {
var lev = 0;
for (var i in c) {
if (c[i].children && c[i].children.length) {
lev = Math.max(lev, getMaxLevel(c[i].children));
var getMaxLevel = function (children, level) {

if (typeof level === "undefined")
level = 0;

function maxLevel (node, level) {
if (node.children) {
var max = 0;
for (var i in node.children) {
max = Math.max(max, maxLevel(node.children[i], level + 1));
}
return max;
} else {
if (node["type"] === "msr" && MEASURES_HIDDEN)
return level - 1;
return level;
}
}
return lev + 1;

return children.reduce(
function (acc, node) { return Math.max(acc, maxLevel(node, 1)) },
level
);

};

var dim1raw = function (a, c, arr, hor, level, maxLevel) {
@@ -474,7 +492,7 @@ DataController.prototype.resetRawData = function () {
value: c[i].caption || ""
};
applyHeaderStyle(obj, hor);
dim1raw(a, c[i].children, arr.concat(obj), hor, level?++level:level, maxLevel);
dim1raw(a, c[i].children, arr.concat(obj), hor, level? level + 1 : level, maxLevel);
} else {
obj = {
group: groupNum,
@@ -483,7 +501,7 @@ DataController.prototype.resetRawData = function () {
value: c[i].caption || ""
};
applyHeaderStyle(obj, hor);
a.push(arr.concat(obj));
a.push(c[i]["type"] === "msr" && MEASURES_HIDDEN ? arr : arr.concat(obj));
groupNum++;
}
}
@@ -520,21 +538,23 @@ DataController.prototype.resetRawData = function () {
for (y = 0; y < rawData.length; y++) {
for (x = 0; x < xEnd; x++) {
if (!rawData[y][x].isCaption) {
xEnd = x; break;
xEnd = x;
break;
}
if (rawData[y][x].source && rawData[y][x].source["path"]) {
for (i in formatColumn) {
var formatCR = data.info.topHeaderRowsNumber > y ? formatColumn : formatRow;
for (i in formatCR) {
if (rawData[y][x].source["path"].indexOf(i) >= 0) {
var yy;
for (yy = y; yy < rawData.length; yy++) {
if (!rawData[yy][x].isCaption) {
if (formatColumn[i].style) rawData[yy][x].style = (rawData[yy][x].style || "")
+ formatColumn[i].style || "";
// var yy;
// for (yy = y; yy < rawData.length; yy++) {
if (!rawData[y][x].isCaption) {
if (formatCR[i].style) rawData[y][x].style = (rawData[y][x].style || "")
+ formatCR[i].style || "";
} else {
if (formatColumn[i].headStyle) rawData[yy][x].style = (rawData[yy][x].style || "")
+ formatColumn[i].headStyle || "";
if (formatCR[i].headStyle) rawData[y][x].style = (rawData[y][x].style || "")
+ formatCR[i].headStyle || "";
}
}
// }
break;
}
}
@@ -610,7 +630,7 @@ DataController.prototype.resetRawData = function () {
if (!data[props][columnIndex] && !(byColumns ? pivotDefaultCol : pivotDefault))
return _.TOTAL_FUNCTIONS.totalSUM;
switch ((data[props][columnIndex] || {}).summary || pivotDefault) {
case "count": return _.TOTAL_FUNCTIONS.totalCOUNT;
case "count": return _.TOTAL_FUNCTIONS.totalSUM; // _.TOTAL_FUNCTIONS.totalCOUNT; https://github.com/intersystems-ru/LightPivotTable/issues/4
case "avg": return _.TOTAL_FUNCTIONS.totalAVG;
case "min": return _.TOTAL_FUNCTIONS.totalMIN;
case "max": return _.TOTAL_FUNCTIONS.totalMAX;
@@ -847,7 +867,7 @@ DataController.prototype.modifyRawData = function (data) {
var y = data.info.topHeaderRowsNumber - 1;
for (i = data.info.leftHeaderColumnsNumber; i < data.rawData[y].length; i++) {
data.rawData[y][i].style = "min-width:"
+ (this.controller.CONFIG.pivotProperties["cellWidth"] || 100) + "px;"
+ (this.controller.getPivotProperty(["cellWidth"]) || 100) + "px;"
+ (data.rawData[y][i].style ? data.rawData[y][i].style : "");
}

13 changes: 8 additions & 5 deletions source/js/DataSource.js
Original file line number Diff line number Diff line change
@@ -51,7 +51,8 @@ DataSource.prototype._post = function (url, data, callback) {
if (typeof handler === "function") {
handler.call(self.LPT, {
url: url,
status: xhr.status
status: xhr.status,
xhr: xhr
});
}
}
@@ -222,9 +223,11 @@ DataSource.prototype.getCurrentData = function (callback) {

})(data));
} else if (mdxType === "mdx") {
if (!data || !data.Data || !data.Cols
|| (!data.Data.length && !((data.Cols[0]||{}).tuples||[]).length)
&& !((data.Cols[1]||{}).tuples||[]).length) {
if (
!data || !data.Data || !data.Data.length || !data.Cols
|| (!data.Data.length && !((data.Cols[0]||{}).tuples||[]).length)
&& !((data.Cols[1]||{}).tuples||[]).length
) {
return callback({
error: pivotLocale.get(4)
});
@@ -280,4 +283,4 @@ DataSource.prototype.getCurrentData = function (callback) {
requestData();
}

};
};
2 changes: 1 addition & 1 deletion source/js/MDXParser.js
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ MDXParser.prototype.drillDown = function (mdx, filter, expression) {
*/
MDXParser.prototype.drillThrough = function (basicMDX, filters) {

var cubeAndFilters = basicMDX.split(/(FROM\s*\[[^\]]*].*)/i)[1],
var cubeAndFilters = basicMDX.slice(basicMDX.lastIndexOf("FROM ")),
query = "DRILLTHROUGH SELECT " + cubeAndFilters;

for (var i in filters) {
2 changes: 1 addition & 1 deletion source/js/PivotView.js
Original file line number Diff line number Diff line change
@@ -1393,7 +1393,7 @@ PivotView.prototype.renderRawData = function (data) {
formatContent(
rawData[y][x].value,
div,
(rowProps[y] && rowProps[y].format) || columnProps[x].format
(columnProps[x] && columnProps[x].format) || (rowProps[y] && rowProps[y].format)
);
if (
colorScale