Skip to content

Commit

Permalink
Update RT code for Chart.js API changes
Browse files Browse the repository at this point in the history
Most of the big changes were in version 3, noted in
the migration guide.

https://www.chartjs.org/docs/latest/migration/v3-migration.html
  • Loading branch information
cbrandtbuffalo committed Dec 4, 2024
1 parent 5b6b12e commit f47569e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions share/html/Search/JSChart
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,23 @@ var searchChart = new Chart(ctx, {
}
},
scales: {
xAxes: [{
x: {
stacked: <% $stacked ? 'true' : 'false' %>,
scaleLabel: {
title: {
display: true,
labelString: <% join(' - ', map $report->Label( $_), @{ $columns{'Groups'} }) |n,j %>
},
gridLines: {
grid: {
display: false
}
}],
yAxes: [{
},
y: {
stacked: <% $stacked ? 'true' : 'false' %>,
scaleLabel: {
title: {
display: true,
labelString: <% $report->Label( $columns{'Functions'}[0] ) |n,j %>
},
gridLines: {
grid: {
drawTicks: true,
drawOnChartArea: false
},
Expand All @@ -155,7 +155,7 @@ var searchChart = new Chart(ctx, {
% }
}
}
}]
}
}
% }
}
Expand All @@ -165,17 +165,17 @@ var group_by = <% JSON( \@GroupBy ) |n %>;
var data_queries = <% JSON( \@data_queries ) |n %>;

jQuery('[id="<% $id |n %>"]').click(function(e) {
var slice = searchChart.getElementAtEvent(e);
if ( !slice[0] ) return;
let slice = searchChart.getElementsAtEventForMode(e, 'nearest', { intersect: true }, true);

if ( !slice[0] ) return;
var query;
% if ( $stacked ) { # data_queries is array of array for stacked charts
if ( data_queries[slice[0]._datasetIndex][slice[0]._index] ) {
query = data_queries[slice[0]._datasetIndex][slice[0]._index];
if ( data_queries[slice[0].datasetIndex][slice[0].index] ) {
query = data_queries[slice[0].datasetIndex][slice[0].index];
}
% } else {
if ( data_queries[slice[0]._index] ) {
query = data_queries[slice[0]._index];
if ( data_queries[slice[0].index] ) {
query = data_queries[slice[0].index];
}
% }
window.open(RT.Config.WebPath + '/Search/Results.html?' + query);
Expand Down

0 comments on commit f47569e

Please sign in to comment.