[Rt-commit] rt branch 5.0/JSChart-fix-tool-tip-multiple-charts created. rt-5.0.2-51-gf612d84522
BPS Git Server
git at git.bestpractical.com
Fri Dec 17 20:19:52 UTC 2021
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/JSChart-fix-tool-tip-multiple-charts has been created
at f612d845229ecbc03c0fc75d529903e04f162fee (commit)
- Log -----------------------------------------------------------------
commit f612d845229ecbc03c0fc75d529903e04f162fee
Author: Brian Conry <bconry at bestpractical.com>
Date: Fri Dec 17 13:48:45 2021 -0600
Show correct tooltips with multiple charts
When displaying multiple charts built with JSChart, such as in a
dashboard, the mouseover tool tip labels for the earlier charts were
overwritten by the labels for the last chart on the page.
Fixes:I#37268
diff --git a/share/html/Search/JSChart b/share/html/Search/JSChart
index 027b14fcd4..09cdfa7f1a 100644
--- a/share/html/Search/JSChart
+++ b/share/html/Search/JSChart
@@ -60,7 +60,8 @@ $StackedGroupBy => undef
% my $id = join '-', 'search-chart', $SavedSearchId || ();
<canvas id="<% $id %>" width="<% $Width %>" height="<% $Height %>"></canvas>
<script type="text/javascript">
-var data_labels = <% JSON( \@data_labels ) |n %>;
+var data_labels = data_labels || [];
+data_labels['<% $SavedSearchId %>'] = <% JSON( \@data_labels ) |n %>;
% if ( $#data == 1 ) {
var backgroundColor = Chart.colorschemes[<% $scheme_parts[0] |n,j %>][<% $scheme_parts[1] |n,j %>];
@@ -112,7 +113,7 @@ var searchChart = new Chart(ctx, {
if (label) {
label += ': ';
}
- label += data_labels[tooltipItem.datasetIndex][tooltipItem.index];
+ label += data_labels['<% $SavedSearchId %>'][tooltipItem.datasetIndex][tooltipItem.index];
return label;
}
}
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list