Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maintain ordinal axis sort on redraw #279

Open
wants to merge 18 commits into
base: dev-v1.11.7
Choose a base branch
from
17 changes: 9 additions & 8 deletions build/webcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3904,15 +3904,16 @@
bookSST: true,
type: 'binary'
};
var arrayOfArrays = data.map(function(d) {
return Object.keys(d)
.filter(function(key) {
return _this.config.cols.indexOf(key) > -1;
})
.map(function(key) {
return d[key];
var arrayOfArrays = data.map(
function(d) {
return _this.config.cols.map(function(col) {
return d[col];
});
}); // convert data from array of objects to array of arrays.
} //Object.keys(d)
// .filter(key => this.config.cols.indexOf(key) > -1)
// .sort((a,b) => this.config.cols.indexOf(a) - this.config.cols.indexOf(b))
// .map(key => d[key])
); // convert data from array of objects to array of arrays.

var workbook = {
SheetNames: [sheetName],
Expand Down
2 changes: 1 addition & 1 deletion build/webcharts.min.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/table/exportable/exports/xlsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ export default function xlsx(data) {
bookSST: true,
type: 'binary'
};
const arrayOfArrays = data.map(d =>
Object.keys(d)
.filter(key => this.config.cols.indexOf(key) > -1)
.map(key => d[key])
const arrayOfArrays = data.map(
d => this.config.cols.map(col => d[col])
//Object.keys(d)
// .filter(key => this.config.cols.indexOf(key) > -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove this commented out code

// .sort((a,b) => this.config.cols.indexOf(a) - this.config.cols.indexOf(b))
// .map(key => d[key])
); // convert data from array of objects to array of arrays.
const workbook = {
SheetNames: [sheetName],
Expand Down
4 changes: 0 additions & 4 deletions test-page/createTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ d3.csv(
applyCSS: d3.select('input.applyCSS').property('checked'),
};

console.log(settings);

d3.select('.table').selectAll('*').remove()
const table = createTable(
'.table',
Expand All @@ -88,7 +86,6 @@ d3.select('button.randomize-columns')
return Math.random() >= .5;
});
table.config.headers = table.config.cols;
console.log(table.config.cols);
table.draw();
});

Expand All @@ -110,6 +107,5 @@ d3.select('button.randomize-headers')

return strArr.join('');
});
console.log(table.config.headers);
table.draw();
});