Time Axis claims to support different resolutions like days, weeks, etc.
However, the collisions of data points is completely ignored by it.
For example,
GIVEN two transactions have arrived on the same day. 100 USD received at 3pm, another one - 200 USD at 4pm .
AND hour unit is selected - it's ok to render them as two data points
WHEN unit is changed to days(or weeks/month/year/etc)
THEN
ACTUAL result: a spike on the same XAxis coordinate is rendered from 100 to 200 USD
EXPECTED result: a single point of 300 USD is rendered
const values = [
{
x: new Date("2020-01-01 15:00"),
y: 100.2,
},
{
x: new Date("2020-01-01 16:00"),
y: 200.2,
},
{
x: new Date("2020-01-02"),
y: 102.2,
},
{
x: new Date("2020-01-03"),
y: 105.3,
},
{
x: new Date("2020-01-11"),
y: 104.4,
},
];
Possible Implementation
As a workaround, the users are forced to process the dataset and resolve such collisions before feeding the data to ChartJS.
However, i cant imagine an example of a domain where such kind of accumulation would be unwanted.
Even so, having an option to enable such accumulation out of box would be a nice addition to ChartJS greatness.
Feature Proposal
Time Axis claims to support different resolutions like days, weeks, etc. However, the collisions of data points is completely ignored by it.
For example, GIVEN two transactions have arrived on the same day. 100 USD received at 3pm, another one - 200 USD at 4pm . AND
hour
unit is selected - it's ok to render them as two data points WHEN unit is changed todays
(or weeks/month/year/etc) THEN ACTUAL result: a spike on the same XAxis coordinate is rendered from 100 to 200 USD EXPECTED result: a single point of 300 USD is renderedI've tried in this REPL https://codesandbox.io/s/friendly-snyder-e8kcd
Here is my dataset
Possible Implementation
As a workaround, the users are forced to process the dataset and resolve such collisions before feeding the data to ChartJS. However, i cant imagine an example of a domain where such kind of accumulation would be unwanted. Even so, having an option to enable such accumulation out of box would be a nice addition to ChartJS greatness.