|
446 | 446 | returnObj.grid = {bottom: 40};
|
447 | 447 |
|
448 | 448 | returnObj.xAxis.axisLabel.formatter = function(value) {
|
| 449 | + value = countlyCommon.encodeHtml(value); |
449 | 450 | var ellipsis = "...";
|
450 | 451 | var lengthToTruncate = (Math.floor(maxLen / Math.ceil(longestLabelTextW / labelW)) * 2);
|
451 | 452 | if (value.length > lengthToTruncate) {
|
|
622 | 623 | cap: "round"
|
623 | 624 | }
|
624 | 625 | },
|
625 |
| - formatter: function(params) { |
| 626 | + formatter: (params) => { |
626 | 627 | var template = "";
|
627 | 628 | let formatter = self.valFormatter;
|
628 | 629 | if (params.seriesType === 'pie') {
|
629 | 630 | template += '<div class="bu-is-flex">\
|
630 | 631 | <div class="chart-tooltip__bar bu-mr-2 bu-mt-1" style="background-color: ' + params.color + ';"></div>\
|
631 | 632 | <div>\
|
632 |
| - <div class="chart-tooltip__header text-smaller font-weight-bold bu-mb-3">' + params.seriesName + '</div>\ |
633 |
| - <div class="text-small"> ' + params.data.name + '</div>\ |
634 |
| - <div class="text-big">' + formatter(params.data.value) + '</div>\ |
| 633 | + <div class="chart-tooltip__header text-smaller font-weight-bold bu-mb-3">' + countlyCommon.encodeHtml(params.seriesName) + '</div>\ |
| 634 | + <div class="text-small"> ' + countlyCommon.encodeHtml(params.data.name) + '</div>\ |
| 635 | + <div class="text-big">' + formatter(countlyCommon.encodeHtml(params.data.value)) + '</div>\ |
635 | 636 | </div>\
|
636 | 637 | </div>';
|
637 | 638 |
|
|
640 | 641 | else {
|
641 | 642 | template = "<div class='chart-tooltip" + ((params.length > 10) ? " chart-tooltip__has-scroll" : "") + "'>";
|
642 | 643 | if (params.length > 0) {
|
643 |
| - template += "<span class='chart-tooltip__header text-smaller font-weight-bold'>" + params[0].axisValueLabel + "</span></br>"; |
| 644 | + template += "<span class='chart-tooltip__header text-smaller font-weight-bold'>" + countlyCommon.encodeHtml(params[0].axisValueLabel) + "</span></br>"; |
644 | 645 | }
|
645 | 646 |
|
646 | 647 | if (self.sortBy === "index") {
|
|
669 | 670 | template += '<div class="chart-tooltip__body' + ((params.length > 4) ? " chart-tooltip__single-row" : " ") + '">\
|
670 | 671 | <div class="chart-tooltip__bar" style="background-color: ' + params[i].color + ';"></div>\
|
671 | 672 | <div class="chart-tooltip__series">\
|
672 |
| - <span class="text-small">' + params[i].seriesName + '</span>\ |
| 673 | + <span class="text-small">' + countlyCommon.encodeHtml(params[i].seriesName) + '</span>\ |
673 | 674 | </div>\
|
674 | 675 | <div class="chart-tooltip__value">\
|
675 |
| - <span class="text-big">' + (typeof params[i].value === 'object' ? formatter((isNaN(params[i].value[1]) ? 0 : params[i].value[1]), params[i].value, i) : formatter((isNaN(params[i].value) ? 0 : params[i].value), null, i)) + '</span>\ |
| 676 | + <span class="text-big">' + (typeof params[i].value === 'object' ? formatter((isNaN(countlyCommon.encodeHtml(params[i].value[1])) ? 0 : countlyCommon.encodeHtml(params[i].value[1])), countlyCommon.encodeHtml(params[i].value), i) : formatter((isNaN(params[i].value) ? 0 : countlyCommon.encodeHtml(params[i].value)), null, i)) + '</span>\ |
676 | 677 | </div>\
|
677 | 678 | </div>';
|
678 | 679 | }
|
|
728 | 729 | fontSize: 12,
|
729 | 730 | formatter: function(value) {
|
730 | 731 | if (typeof value === "number") {
|
731 |
| - return countlyCommon.getShortNumber(value); |
| 732 | + return countlyCommon.getShortNumber(countlyCommon.encodeHtml(value)); |
732 | 733 | }
|
733 | 734 | return value;
|
734 | 735 | }
|
|
865 | 866 | this.patchLegend(options);
|
866 | 867 |
|
867 | 868 | return options;
|
868 |
| - } |
| 869 | + }, |
869 | 870 | }
|
870 | 871 | });
|
871 | 872 |
|
|
1112 | 1113 | </div>\
|
1113 | 1114 | <div class="graph-tooltip-wrapper__container">';
|
1114 | 1115 | }
|
1115 |
| - template += '<div class="' + conditionalClassName + '">\ |
1116 |
| - <div class="bu-mb-1"><span class="text-small color-cool-gray-50">#' + filteredNotes[i].indicator + '</span></div>\ |
| 1116 | + template += '<div class="' + countlyCommon.encodeHtml(conditionalClassName) + '">\ |
| 1117 | + <div class="bu-mb-1"><span class="text-small color-cool-gray-50">#' + countlyCommon.encodeHtml(filteredNotes[i].indicator) + '</span></div>\ |
1117 | 1118 | <div class="bu-is-flex bu-is-justify-content-space-between graph-notes-tooltip__header">\
|
1118 | 1119 | <div class="bu-is-flex bu-is-flex-direction-column">\
|
1119 |
| - <div class="text-small input-owner">' + filteredNotes[i].owner_name + '</div>\ |
| 1120 | + <div class="text-small input-owner">' + countlyCommon.encodeHtml(filteredNotes[i].owner_name) + '</div>\ |
1120 | 1121 | <div class="text-small color-cool-gray-50 note-date">' + moment(filteredNotes[i].ts).format("MMM D, YYYY hh:mm A") + '</div>\
|
1121 | 1122 | </div>\
|
1122 | 1123 | <div class="bu-is-flex bu-is-flex-direction-column bu-is-align-items-flex-end">\
|
1123 |
| - <span class="text-small color-cool-gray-50 bu-is-capitalized note-type">' + filteredNotes[i].noteType + '</span>\ |
| 1124 | + <span class="text-small color-cool-gray-50 bu-is-capitalized note-type">' + countlyCommon.encodeHtml(filteredNotes[i].noteType) + '</span>\ |
1124 | 1125 | </div>\
|
1125 | 1126 | </div>\
|
1126 |
| - <div class="bu-mt-2 graph-notes-tooltip__body"><span class="text-small input-notes input-minimizer">' + filteredNotes[i].note + '</span></div>\ |
| 1127 | + <div class="bu-mt-2 graph-notes-tooltip__body"><span class="text-small input-notes input-minimizer">' + countlyCommon.encodeHtml(filteredNotes[i].note) + '</span></div>\ |
1127 | 1128 | </div>';
|
1128 | 1129 | if (i === filteredNotes.length) {
|
1129 | 1130 | template = "</div>";
|
1130 | 1131 | }
|
1131 | 1132 | }
|
1132 | 1133 | }
|
1133 | 1134 | else {
|
1134 |
| - template += '<div class="' + conditionalClassName + '">\ |
| 1135 | + template += '<div class="' + countlyCommon.encodeHtml(conditionalClassName) + '">\ |
1135 | 1136 | <div class="bu-is-flex bu-is-justify-content-space-between graph-notes-tooltip__header">\
|
1136 | 1137 | <div class="bu-is-flex bu-is-flex-direction-column name-wrapper">\
|
1137 |
| - <div class="text-medium input-owner">' + params.data.note.owner_name + '</div>\ |
| 1138 | + <div class="text-medium input-owner">' + countlyCommon.encodeHtml(params.data.note.owner_name) + '</div>\ |
1138 | 1139 | <div class="text-small color-cool-gray-50 note-date">' + moment(params.data.note.ts).format("MMM D, YYYY hh:mm A") + '</div>\
|
1139 | 1140 | </div>\
|
1140 | 1141 | <div class="bu-is-flex bu-is-flex-direction-column bu-is-align-items-flex-end">\
|
1141 | 1142 | <span onClick="window.hideGraphTooltip()">\
|
1142 | 1143 | <i class="el-icon-close"></i>\
|
1143 | 1144 | </span>\
|
1144 |
| - <span class="text-small color-cool-gray-50 bu-is-capitalized note-type">' + params.data.note.noteType + '</span>\ |
| 1145 | + <span class="text-small color-cool-gray-50 bu-is-capitalized note-type">' + countlyCommon.encodeHtml(params.data.note.noteType) + '</span>\ |
1145 | 1146 | </div>\
|
1146 | 1147 | </div>\
|
1147 |
| - <div class="graph-notes-tooltip__body"><span class="text-medium input-notes">' + params.data.note.note + '</span></div>\ |
| 1148 | + <div class="graph-notes-tooltip__body"><span class="text-medium input-notes">' + countlyCommon.encodeHtml(params.data.note.note) + '</span></div>\ |
1148 | 1149 | </div>';
|
1149 | 1150 | }
|
1150 | 1151 | return template;
|
|
0 commit comments