Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7579165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:36:31+00:00 2026-05-30T17:36:31+00:00

I want to create a graph based on the combined value of several overlapping

  • 0

I want to create a graph based on the combined value of several overlapping events. I want one data point for each change in combined value, so for a set of events like this:

      11111111111
   22222
          55555555555555
                                     3333333
^  ^  ^ ^ ^      ^      ^            ^      ^     

(The number indicates the value so for 3333333 the value is 3, the x axis represent time, the ^ markers represents the changes timestamp result are to be generated for)

I want an output like this:

timestamp0: 0,timestamp1: 2,timestamp2: (2+1),timestamp3:1,
timestamp4:(5+1),timestamp5:5,timestamp6:0,timestamp7:3,timestamp8:0

Is it a common way to do this, or a data structure or algorithm typically used to solve these types of problems?

I can manage to do this, but I wonder if there already exists a better way. New events will be added dynamically, and performance of result generation is important.

addition after the first answers arrived:

My current implementation is to loop through a list of events and adding the current one to a set of active events and check if any active events has become invalid since last iteration (these can be generated timestamps for and removed from the active list). The current implementation has a lot of looping and some special case handling (like if two events stop at the same time), so I wonder if you know of a smarter way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:36:32+00:00Added an answer on May 30, 2026 at 5:36 pm

    I would keep an associative array (Object) where you store which events are active. Whenever an event is triggered or finalized (which are the only two situations which produce the changes you want to track) you add/remove an element to the object and the print its contents with a loop like the following:

    logMsg = ""
    for(eventName in activeEvents) logMsg += " timestamp"+timestamp+": "+eventName;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a graph of items on a certain day using data
I want to create a graph with 31 days of data and then with
I have an XML file and I want to create a graph based on
I want to create a graph like the one shown below... but way too
I want to create new album via graph api for the page that user
I want to create a Login through Facebook on a website using Graph API
I want to create a graph, for example number of accumulative likes over time
I want to generate line graph based on database. First time i am using
I want to create a matrix representation for a graph algorithm using the least
I want to add metadata to my object graph for non-domain type data that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.