geovistory / design-system

MIT License
2 stars 1 forks source link

POC for timeline with bars #123

Open joschne opened 4 months ago

joschne commented 4 months ago

Context

For issue #116 we need a timeline

Goal

Have a POC that the requirements can be implemented with Plotly.

ZEDz318 commented 4 months ago

Here is a codepen link to the component I was able to code. I created a dummy repo to simulate some data. For now it ticks most of the boxes.

What it does

What it doesn't do

return [{ mode: 'lines', x: x, y: y }]; with return [{ type: 'bar', x: x, y: y }];

Note

joschne commented 4 months ago

Nice job @zedz318 ! :-)

In the Plotly documentation I saw that there are histograms that may fit our ideas. I am going to create a second POC with type: 'histogram' instead of 'lines'or 'bar'. After that, we'll probably need a meeting.

joschne commented 4 months ago

Here is a stackblitz example of using plotly historgram for the timeline with bars.

What it does

Problems

ZEDz318 commented 4 months ago

Hello! Sorry for my delayed response, I had a dental emergency earlier this week and had to recover. I'll be working on this today and I'll get back to you asap.

ZEDz318 commented 4 months ago

Hello again! I forked your stackblitz project, this is mine.

Solved

I was able to solve the "on hover" issue.

Problem/Details

  1. Since the on hover for 'decade' and 'century' is a range, and the histogram starts from 0 (maybe we can change that so that the histogram starts from the lowest starting date?), thus what would be logical for the the ranges? For it to be 0-1400 in both cases (decade and century)? Or just as they are now (1390-1400 for decade, and 1300-1400 for century)?
  2. As for the wrong binning, could you elaborate more on the matter? Is it adding the data to the bin that's before the correct one? or is the calculation wrong somehow and the bins are just incorrect? basically, what do you mean by "The values fall into a too low bin"?
flicksolutions commented 4 months ago

Please also keep performance in mind: At the moment, month is a pain to use, day is unusable. Why is that the case? How can we make it faster?

ZEDz318 commented 4 months ago

I've been working on this and I think the issue highlighted by @flicksolutions is the same as the one I asked about last in the Problem/Details section number 2. From what I could tell, the reason why it takes too long to render month and day bin sizes is because of how the binning was working. I've changed it and it should be faster and more accurate(I've also increased the range of each datapoint just for testing since it requires more computation this way) Here is the link (it's the same as the one before)

If you want, we can have a 10-20 minute meeting to discuss the details further