Updated graph lib

This commit is contained in:
projectsodoo 2021-02-23 09:06:58 +05:30
parent ef73c8f3b4
commit 84237ed6d1
1 changed files with 26 additions and 0 deletions

View File

@ -324,6 +324,32 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
boxColor: boxColor,
};
},
/**
* This function extracts the information from the data points in tooltipModel.dataPoints
* (corresponding to datapoints over a given label determined by the mouse position)
* that will be displayed in a custom tooltip.
*
* @private
* @param {Object} tooltipModel see chartjs documentation
* @return {Object[]}
*/
_getTooltipItems: function (tooltipModel) {
var self = this;
var data = this.chart.config.data;
var orderedItems = tooltipModel.dataPoints.sort(function (dPt1, dPt2) {
return dPt2.yLabel - dPt1.yLabel;
});
return orderedItems.reduce(
function (acc, item) {
if (item.value > 0) {
acc.push(self._getTooltipItemContent(item, data));
}
return acc;
},
[]
);
},
_isRedirectionEnabled: function () {
return !this.disableLinking &&