Chartjs-Get value onclick chart.js

0👍

You are getting the current value from your values array.

1- First get the corresponding key/index

$month = array(202301, 202302, 202303, 202304, 202305, 202306); 
$values = array(153, 152, 170, 40, 80, 112);

$valueIndex =  array_search(153, $values); 
echo $valueIndex; // 0

2 – Get the corresponding month of your valueIndex

echo $month[$valueIndex]; // 202301

Leave a comment