diff --git a/frontend/express/public/javascripts/countly/vue/components/vis.js b/frontend/express/public/javascripts/countly/vue/components/vis.js index 7444777424c..dbef2a352cc 100644 --- a/frontend/express/public/javascripts/countly/vue/components/vis.js +++ b/frontend/express/public/javascripts/countly/vue/components/vis.js @@ -1047,8 +1047,23 @@ return notes; }, graphNotesTooltipFormatter: function(arr, params) { - var template = ""; var filteredNotes = arr.filter(x=>x.dateStr === params.data.note.dateStr && x.times > 1); + var minimizeTooltip = false; + var template = ""; + var conditionalClassName = "graph-notes-tooltip"; + + if ((this.$refs && this.$refs.echarts) && (this.$refs.echarts.getHeight() < 200 || this.$refs.echarts.getWidth() < 500)) { + minimizeTooltip = true; + } + + + if (minimizeTooltip) { + conditionalClassName = 'graph-notes-tooltip minimize'; + } + else if (!minimizeTooltip && filteredNotes.length > 0) { + conditionalClassName = 'graph-notes-tooltip bu-mb-4 bu-mx-2'; + } + if (filteredNotes.length > 0) { for (var i = 0; i < filteredNotes.length; i++) { if (i === 0) { @@ -1059,18 +1074,18 @@ \
'; } - template += '
\ + template += '
\
#' + filteredNotes[i].indicator + '
\
\
\
' + filteredNotes[i].owner_name + '
\ -
' + moment.utc(filteredNotes[i].ts).format("MMM D, YYYY hh:mm A") + '
\ +
' + moment.utc(filteredNotes[i].ts).format("MMM D, YYYY hh:mm A") + '
\
\
\ - ' + filteredNotes[i].noteType + '\ + ' + filteredNotes[i].noteType + '\
\
\ -
' + filteredNotes[i].note + '
\ +
' + filteredNotes[i].note + '
\
'; if (i === filteredNotes.length) { template = "
"; @@ -1078,11 +1093,11 @@ } } else { - template = '
\ + template += '
\
\
\
' + params.data.note.owner_name + '
\ -
' + moment.utc(params.data.note.ts).format("MMM D, YYYY hh:mm A") + '
\ +
' + moment.utc(params.data.note.ts).format("MMM D, YYYY hh:mm A") + '
\
\
\ \ @@ -1091,7 +1106,7 @@ ' + params.data.note.noteType + '\
\
\ -
' + params.data.note.note + '
\ +
' + params.data.note.note + '
\
'; } return template; @@ -1224,7 +1239,7 @@ this.seriesOptions.markPoint.data = []; } }, - onClick() { + onClick: function() { if (!document.querySelectorAll(".graph-overlay").length) { var overlay = document.createElement("div"); overlay.setAttribute("class", "graph-overlay"); diff --git a/frontend/express/public/stylesheets/styles/blocks/_vis.scss b/frontend/express/public/stylesheets/styles/blocks/_vis.scss index 9dd4ce70638..ab61b397d73 100644 --- a/frontend/express/public/stylesheets/styles/blocks/_vis.scss +++ b/frontend/express/public/stylesheets/styles/blocks/_vis.scss @@ -413,6 +413,8 @@ } } &__body { + margin-top: 12px; + .input-notes { word-break: break-word; display: inline-block; @@ -421,6 +423,44 @@ } } +.graph-notes-tooltip.minimize { + width: 180px; + + .input-owner { + font-size: 12px; + } + + &__header { + margin-top: 0px; + } + + .input-notes { + font-size: 12px; + } + + .input-minimizer { + margin-bottom: 10px; + } + + .graph-notes-tooltip__body { + margin-top: 5px; + } + + .name-wrapper { + margin-top: 0px; + } + + .note-date { + font-size: 11px; + } + + .note-type { + margin-top: 2px; + font-size: 11px; + margin-right: 4px; + } +} + .graph-tooltip-wrapper { margin-right: 2px; margin-bottom: 4px;