forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update table example to test larger dataset
- Loading branch information
1 parent
b56b2bb
commit 39a8c79
Showing
3 changed files
with
69 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
...plugins/packages/superset-ui-plugins-demo/storybook/stories/plugin-chart-table/bigData.js
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...ns/packages/superset-ui-plugins-demo/storybook/stories/plugin-chart-table/generateData.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-disable no-unused-vars */ | ||
/* eslint-disable no-magic-numbers */ | ||
/* eslint-disable sort-keys */ | ||
|
||
const getHTML = () => { | ||
const randomText = Array(Math.floor(Math.random() * 20)) | ||
.fill('very') | ||
.join(' '); | ||
|
||
return `<a href="www.google.com" target="_blank">Link Test with a ${randomText} long title</a>`; | ||
}; | ||
|
||
export default function generateData(rowCount = 30, columnCount = 20) { | ||
const columns = Array(columnCount) | ||
.fill(0) | ||
.map((_, i) => `clm ${i}`); | ||
|
||
return Array(rowCount) | ||
.fill(0) | ||
.map((_, index) => ({ | ||
index: index + 1, | ||
html: getHTML(), | ||
...columns.reduce( | ||
(prev, key, i) => { | ||
const obj = prev; | ||
// eslint-disable-next-line no-restricted-properties | ||
obj[key] = Math.round(Math.random() * Math.pow(10, i)); | ||
|
||
return obj; | ||
}, | ||
{ | ||
ds: '2019-09-09', | ||
}, | ||
), | ||
})); | ||
} |