Answer the question
In order to leave comments, you need to log in
How to generate missing data for date range?
There is an array of objects with data for drawing a graph.
There are startDate and endDate variables in string format.
You need to draw this data on the chart, but you need to draw a segment, taking into account the startDate and endDate variables.
How to do this - you need to push elements with empty values \u200b\u200binto an array with data.
Source array:
const widgetData = [
{name: "something", value: 14, date: "02.08.2018"},
{name: "something", value: 43, date: "03.08.2018"},
{name: "something", value: 44, date: "04.08.2018"},
{name: "something", value: 38, date: "05.08.2018"}
];
let startDate = '01.08.2018';
let endDate = '25.08.2018';
[
{name: "something", value: 0, date: "01.08.2018"},
{name: "something", value: 14, date: "02.08.2018"},
{name: "something", value: 43, date: "03.08.2018"},
{name: "something", value: 44, date: "04.08.2018"},
{name: "something", value: 38, date: "05.08.2018"},
{name: "something", value: 0, date: "06.08.2018"}
...
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question