Skip to content

Commit

Permalink
trying to use array_keys in a matrix to reorder chart
Browse files Browse the repository at this point in the history
  • Loading branch information
mtcnxd committed Nov 20, 2024
1 parent c782967 commit f3c3df5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions details.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
$values[$key] = $invest->amount;
$labels[$key] = $dateTime->format('d-m-Y');

# $data[$dateTime->format('d-m-Y')] = $invest->amount;
$data[$dateTime->format('d-m-Y')] = $invest->amount;

echo "<tr>";
echo " <td>". ($key +1) ."</td>";
Expand Down Expand Up @@ -104,8 +104,6 @@
<?php
$percentage = ($result/$values[0]) * 100;
echo number_format($percentage, 2) .'%';

krsort($values);
?>
</h5>
</div>
Expand Down Expand Up @@ -149,7 +147,7 @@
const myChart = new Chart(currentChart, {
type: 'line',
data: {
labels: <?=json_encode( $labels );?>,
labels: <?=json_encode( array_keys($data) );?>,
datasets: [{
label: 'Wallet Balance',
data: <?=json_encode( $values );?>,
Expand Down

0 comments on commit f3c3df5

Please sign in to comment.