this post was submitted on 21 Oct 2023
13 points (93.3% liked)

Web Development

3454 readers
1 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 2 years ago
MODERATORS
 

Hi,

I'm rather new to web development. For my local scouts troop I'm currently trying to build a webapp to show a big browsable timeline of the troops chronicles (We have many big folders of paper showing what the scouts did that year). I've already build the ground structure based on Django for the backend and vue for the frontend. And I can display the individual elements of the chronicles (Writings, articles, pictures; videos and audio for newer entries) in a list.

Now I want to create a component, that will display a horizontal timeline with the ability to move and zoom, showing elements depending on the zoom level with different level of detail. I want to make it easy to browse the timeline of over 70 years with entries per year (like 30 elements per year).

I already tried timeline-js, but it doesn't quite behave like I want it to be (zooming, different levels of detail,...). For me it seems, that it cannot really be customized enough to reach my goal (though I might be wrong about that).

Then I thought about building that timeline component myself, though I don't know where to start in building such a component (how to draw the timeline itself with its markings, how to draw the elements at the correct position,...)

Can you give me a hint/direction where I should look for a solution? Maybe you know a tutorial for a similar situation (creating your own complex UI components)?

Thanks in advance for your help! Currently I feel like I don't know enough to ask the correct question to a search engine for a solution.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

Thanks for your answer!

Actually I already have the entries in a proper JSON format. I build my django API endpoints to get a batch of entries with all their details, including URLs for the actual media. Only the visualization is not how I would like it to be. I already have a visualization, that is list-like and looks good, but is not suitable for the mass of entries the endproduct will have to hold. Thus a zoomable timeline.

I know about TImelineJS's events, but that didn't really help me. One of the problems I encountered was with stacking or not stacking the elements, when zooming out. Maybe I need to dig more in CSS to dynamically size each entry based on ... what exactly? Zoom position? Collision with other entries? Somehow calculated density of entries? You see, I'm very much confused and overwhelmed. I don't want to invest much time in a direction, that will not lead to the right place.

I will have a look at the tutorial and vueuse. Previously I followed a 4h tutorial on youtube, which was about vue and django in conjunction. Maybe after that tutorial I understand, how I might build the timeline myself.

EDIT: Ok, I did go through the tutorial now. Almost all concepts where not new to me, but I definitely learned a bit about reactivity (used it unknowning of the concept through the data function of a component). Though I still don't know how I would start building a Timeline. I can create and use components in Vue (already using that in my app), but I have problems handling the low level visual part, which is not just some HTML objects nested, like my list of entries.

[–] [email protected] 1 points 1 year ago (1 children)

Can you explain a bit more about "zooming, different levels of detail" you mention? Maybe break them down to separate issue you are having with the library, what does it do, what do you want that it's not doing. If there is a way to tweak it then you don't have to build the component from scratch.

But if you already abandoned the idea of tweaking timeline-js then you can have full control in vue, have to build it yourself though. Start by breaking the functionality of the timeline into separate interaction. From a quick look, timeline-js just make style attribute reactive. Have a box? good. Now put really long div in it with placeholder texture. Can you drag/scroll it? no? grab a suitable function from vueuse and make it scrollable. Follow with markers, zoom, dummy event items, data fetching (the actual width, marker spacing, events placement can be calculated from timestamp in json after this step), lazy loading, styling, animation, so on.

I don't know how much experience do you have with each things required (html, css, js, vue) so it is a bit difficult to give useful answer.

[–] [email protected] 1 points 1 year ago (1 children)

With TimelineJS I first tried with title-only entries. If you zoom out the entries get compresses along the time axis of course. Either they are overlapping, which looks bad and is not useful for the interaction, or you can let TimelineJS stack them. But then they stack higher and higher, overflowing the height of the timeline. A good vertical scrolling mechanism doesn't seem to be a feature (like seeing at what vertical postion you currently are).

I thought about, what I want to try. I want each entry represented by a bubble, connected to the timeline with a vertical line. The size of the bubble should change depending on how much space is available. Shrinking to a small point at minimum, growing to accomodate a small image and maybe a title (for that morphing to a rounded rectangle would be better).

Maybe this is possible with clever CSS styling of timelinejs. CSS is really a weak part for me

[–] [email protected] 1 points 1 year ago

Your bubble idea could work and you will have to be comfortable with css, no way around it I guess.
I see vis.js have a lot of timeline examples you might be able to adapt to your need.