Curiosity - 2D Array Data Structure
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 463
- PR merge metrics
- No merged PRs in 30d
Description
Hello @leeoniya ,
It seems to me there are at least 3 primary ways to structure data for a given chart/plot library. You choose to use a 2D array.
Q) Can you tell me how you weighed the pros and cons? What was the most important, what was secondary? How do you evaluate this 2D nested array data structure since the creation of uPlot?
I have hunch, that it's about flexibility to not be subjected to time on the x-axis.
Style 1: Nested Array (2D Array)
data, like uPlot's AlignedData
let data = [
[1546300800, 1546387200],
[35, 71],
[90, 15],
];
And metadata is in another structure, to hold labels, color, and meaning.
Style 2: Time Sample Objects in Array
data is self describing with props like time, temp. Similar to recharts.
const data = [
{ value: 14, temp: 90, time: 1503617297689 },
{ value: 15, temp: 80, time: 1503616962277 },
{ value: 7, temp: null, time: 1503616882654 },
{ value: 7, temp: null, time: 1503616882654 },
{ value: 31, time: 1503616882654 },
{ value: 30, time: 1503616882654 },
{ value: 20, temp: 50, time: 1503613184594 },
{ value: 11, temp: 20, time: 1503611308914 },
];
And metadata is in another structure, to hold labels, color.
Style 3: Joined
data and metadata together. Similar to SciChart.
[
{
dataSeries: {
dataSeriesName: "",
dataSeries: [
{ i, value },
{ i, value },
],
},
stroke: "",
thickness: "",
},
{
dataSeries: {
dataSeriesName: "",
dataSeries: [
{ i, value },
{ i, value },
],
},
stroke: "",
thickness: "",
},
];
Thanks so much!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reviewing uPlot's AlignedData representation and compare it with the three data shapes shown in the issue; done would be a documented explanation of the tradeoffs and the rationale for uPlot's 2D array structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100