Comments (1)
Data should be returned sorted alphabetically A-Z. Currently, up to two levels of pivoting maintain sort but a third causes the issue above. Instead can we sort all levels A-Z after pivoting?
const dataArray = [ ['name', 'gender', 'house', 'age'], ['Jon', 'm', 'Stark', 14], ['Arya', 'f', 'Stark', 10], ['Cersei', 'f', 'Baratheon', 38], ['Tywin', 'm', 'Lannister', 67], ['Tyrion', 'm', 'Lannister', 34], ['Joffrey', 'm', 'Baratheon', 18], ['Bran', 'm', 'Stark', 8], ['Jaime', 'm', 'Lannister', 32], ['Sansa', 'f', 'Stark', 12] ];
const testPivot = new pivot(dataArray, ['house', 'gender', 'name'], [], 'age', 'sum');
JSON.stringify(testPivot.data.table)
"[{"value":["sum age","sum age"],"depth":0,"type":"colHeader","row":0},{"value":["Stark",44],"depth":0,"type":"rowHeader","row":1},{"value":["f",22],"depth":1,"type":"rowHeader","row":2},{"value":["Arya",10],"type":"data","depth":2,"row":3},{"value":["Sansa",12],"type":"data","depth":2,"row":4},{"value":["m",22],"depth":1,"type":"rowHeader","row":5},{"value":["Bran",8],"type":"data","depth":2,"row":6},{"value":["Jon",14],"type":"data","depth":2,"row":7},{"value":["Baratheon",56],"depth":0,"type":"rowHeader","row":8},{"value":["f",38],"depth":1,"type":"rowHeader","row":9},{"value":["Cersei",38],"type":"data","depth":2,"row":10},{"value":["m",18],"depth":1,"type":"rowHeader","row":11},{"value":["Joffrey",18],"type":"data","depth":2,"row":12},{"value":["Lannister",133],"depth":0,"type":"rowHeader","row":13},{"value":["m",133],"depth":1,"type":"rowHeader","row":14},{"value":["Jaime",32],"type":"data","depth":2,"row":15},{"value":["Tyrion",34],"type":"data","depth":2,"row":16},{"value":["Tywin",67],"type":"data","depth":2,"row":17}]"
testPivot.filter("name", ["Arya"], 'exclude')
JSON.stringify(testPivot.data.table)
"[{"value":["sum age","sum age"],"depth":0,"type":"colHeader","row":0},{"value":["Stark",34],"depth":0,"type":"rowHeader","row":1},{"value":["m",22],"depth":1,"type":"rowHeader","row":2},{"value":["Bran",8],"type":"data","depth":2,"row":3},{"value":["Jon",14],"type":"data","depth":2,"row":4},{"value":["f",12],"depth":1,"type":"rowHeader","row":5},{"value":["Sansa",12],"type":"data","depth":2,"row":6},{"value":["Baratheon",56],"depth":0,"type":"rowHeader","row":7},{"value":["f",38],"depth":1,"type":"rowHeader","row":8},{"value":["Cersei",38],"type":"data","depth":2,"row":9},{"value":["m",18],"depth":1,"type":"rowHeader","row":10},{"value":["Joffrey",18],"type":"data","depth":2,"row":11},{"value":["Lannister",133],"depth":0,"type":"rowHeader","row":12},{"value":["m",133],"depth":1,"type":"rowHeader","row":13},{"value":["Jaime",32],"type":"data","depth":2,"row":14},{"value":["Tyrion",34],"type":"data","depth":2,"row":15},{"value":["Tywin",67],"type":"data","depth":2,"row":16}]"
See how the gender under Stark is reordered from 'f' to 'm' after Arya is removed?
from quick-pivot.
Related Issues (20)
- Add pivot toggle method for expanding / collapsing groups HOT 1
- Filtering / Sorting
- Pivot should not add to collapsedRows if the row cannot be collapsed HOT 1
- Providing incorrect data types for rowsToPivot and/or colsToPivot throws filter error
- Filtering out all data throw error
- Filtering on value dimensions with string filter values instead of ints HOT 3
- 'Include' filtering with values that are a part of the unique values of that field throws error HOT 4
- Should pivot.getUniqueValues return unique values of the current pivot or original?
- Should filters stack / are they chainable? HOT 2
- Totals functionality HOT 2
- TypeError: Object.values is not a function HOT 4
- Filtering out all values returns empty array. Should return remaining unfiltered fields with 0 values.
- Support multiple aggregations HOT 2
- Support row totals HOT 1
- Row and column total header HOT 1
- Preserving order or column and row entries? HOT 3
- Support Multiple Aggregation Dimensions HOT 10
- Create excel sheet from the pivot data HOT 2
- Comparison functions used are causing unexpected results
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quick-pivot.