0

My use case stems from a problem similar to Generating counts of open tickets over time, given opened and closed dates

I am given a JSON of objects with one or two properties: open date and closed date (if closed). If the task is still open it won't have the property.

My goal is to plot a line chart in Highcharts that shows the count of open tasks over time.

If I were to use a brute force algorithm, I would create a data point for each time interval within the span of time covered by my chart and then determine the count of open tasks for that point, but that sounds really inefficient.

Instead, I could use Highcharts to define the time intervals for the time axis and simply have data points for start, finish and each point where there's a variation in the value (or could I?).

What would be an efficient vanilla javascript code to determine this series and the Highcharts options to plot it? I've seen some sql code arount (including the mentioned article) doing similar calculations, but I find it hard to relate it to my use case.

gaudi_br
  • 183
  • 2
  • 12
  • Could you provide a sample of your data? You can start from this template: https://jsfiddle.net/BlackLabel/p7s4hozc/ – Sebastian Wędzel Jul 30 '21 at 12:32
  • without any further changes to the graph code, I've added a 40 object sample data: https://jsfiddle.net/gaudibr/nkjpb961 – gaudi_br Aug 04 '21 at 08:28
  • So that's what I understand: you would like to create a chart where the x value is an open date and y value is a sum of task that are closed, am I right? – Sebastian Wędzel Aug 05 '21 at 07:50
  • something like here: https://jsfiddle.net/BlackLabel/qw6rp4y8/? – Sebastian Wędzel Aug 05 '21 at 07:59
  • Thanks, but not really. indeed the x axis should be the timeline, but on the y axis I would like to see the sum of tasks that are open on that date. So if in the dataset we have the open/closed dates, a function should be applied to determine, for each point in x, how many tasks are open on tht day. The name property is completely irrelevant to the graph, although part of the dataset. – gaudi_br Aug 05 '21 at 09:46
  • make sense. `I would like to see the sum of tasks that are open on that date.` - by saying date would you like to see the sum of tasks opens per day? In you data set I can see that the time is also included – Sebastian Wędzel Aug 05 '21 at 10:11
  • the attributes on each item in the dataset are timestamps. to me that means that potentially, when loaded in different timezones, the same chart could display differently. We can ignore the time for the purpose of building the graph, if it makes it simpler. To me, this graph should look similar to a brundow chart, except that a burndown chart is quite specific to agile development and the line only goes down (whereas in this case, if in a given day more tasks are opened than closed, it could also potentillay go up) – gaudi_br Aug 05 '21 at 15:11
  • check this approach - https://jsfiddle.net/BlackLabel/7z5uogps/ - if the opened date is the same the y value increases – Sebastian Wędzel Aug 09 '21 at 09:14
  • I'm sorry, I don't get it... all I see is a flat line, when ideally I would se the count vary at least on each day – gaudi_br Aug 13 '21 at 08:18
  • sorry I did a small mistake in the previous demo, check this one: https://jsfiddle.net/BlackLabel/td71jbqh/ as you can see I added two objects to the data array with the same opening day - this points are visible on the chart – Sebastian Wędzel Aug 13 '21 at 13:38

0 Answers0