From b4f08845fb889a85267e2fff0b1d9eca1b52f1a9 Mon Sep 17 00:00:00 2001 From: agent3bood Date: Thu, 11 Oct 2018 12:57:23 +0300 Subject: [PATCH] fix tooltip when chart updated issue: https://github.com/reactjs/react-chartjs/issues/81 now the chart will update the tooltip when the values are changed. I have tested using line chart. --- lib/core.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core.js b/lib/core.js index fa9b7c2..e7a4f4d 100644 --- a/lib/core.js +++ b/lib/core.js @@ -142,8 +142,10 @@ var updatePoints = function(nextProps, chart, dataKey) { var addData = function(nextProps, chart, setIndex, pointIndex) { var values = []; + var labels = []; nextProps.data.datasets.forEach(function(set) { values.push(set.data[pointIndex]); + labels.push(set.data[pointIndex]); }); - chart.addData(values, nextProps.data.labels[setIndex]); + chart.addData(values, labels); };