Chartjs-Charts.js tooltips on different data ranges

0👍

Just in case it could be helpful for other developers, I’ve managed to solve the problem normalizing data. I.E. i’ve transformed my data from :

[ 
  [{"x" : date1, "y" : valueA }, {"x" : date2, "y" : valueB }, {"x" : date3, "y" : valueC }],
  [{"x" : date3, "y" : valueD }, {"x" : date4, "y" : valueE }]
]

to :

[ 
  [{"x" : date1, "y" : valueA }, {"x" : date2, "y" : valueB }, {"x" : date3, "y" : valueC }, {"x" : date4, "y" : undefined }],
  [{"x" : date1, "y" : undefined }, {"x" : date2, "y" : undefined },{"x" : date3, "y" : valueD }, {"x" : date4, "y" : valueE }]
]

So, each dataset contains the same number of tuples, that is the result of merging dates from the first dataset and the second one and removing duplicates.

Leave a comment