|
@@ -626,6 +626,7 @@ const EXPORT_JS = `
|
|
|
const FULL_TREE_KEY = 'full';
|
|
const FULL_TREE_KEY = 'full';
|
|
|
const DEFAULT_DEPTH = 3;
|
|
const DEFAULT_DEPTH = 3;
|
|
|
const DEFAULT_DIMS = [
|
|
const DEFAULT_DIMS = [
|
|
|
|
|
+ { key: 'total_score', label: '全局热度' },
|
|
|
{ key: 'ext_pop', label: '外部热度' },
|
|
{ key: 'ext_pop', label: '外部热度' },
|
|
|
{ key: 'plat_sust_pop', label: '平台持续热度' },
|
|
{ key: 'plat_sust_pop', label: '平台持续热度' },
|
|
|
{ key: 'plat_ly_pop', label: '去年同期热度' },
|
|
{ key: 'plat_ly_pop', label: '去年同期热度' },
|
|
@@ -724,6 +725,13 @@ const EXPORT_JS = `
|
|
|
return Math.min(1, Math.max(0, lo / n));
|
|
return Math.min(1, Math.max(0, lo / n));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function scoreHeatT(dim, weight, sortedScale) {
|
|
|
|
|
+ if (dim === 'total_score') {
|
|
|
|
|
+ return Math.min(1, Math.max(0, weight / 4));
|
|
|
|
|
+ }
|
|
|
|
|
+ return weightHeatT(weight, sortedScale);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function heatColor(t) {
|
|
function heatColor(t) {
|
|
|
if (t == null) return '#f1f5f9';
|
|
if (t == null) return '#f1f5f9';
|
|
|
const clamp = Math.min(1, Math.max(0, t));
|
|
const clamp = Math.min(1, Math.max(0, t));
|
|
@@ -754,6 +762,13 @@ const EXPORT_JS = `
|
|
|
return avg.toFixed(2);
|
|
return avg.toFixed(2);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function formatWeightScore(dim, score, count) {
|
|
|
|
|
+ if (count != null && count <= 0) return '—';
|
|
|
|
|
+ if (score == null || Number.isNaN(score)) return '—';
|
|
|
|
|
+ if (dim === 'total_score') return score.toFixed(2);
|
|
|
|
|
+ return formatAvgScore(score, count);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function isFullTree() { return state.activeTab === FULL_TREE_KEY; }
|
|
function isFullTree() { return state.activeTab === FULL_TREE_KEY; }
|
|
|
function activeDim() { return isFullTree() ? null : state.activeTab; }
|
|
function activeDim() { return isFullTree() ? null : state.activeTab; }
|
|
|
|
|
|
|
@@ -820,7 +835,7 @@ const EXPORT_JS = `
|
|
|
const weight = dim ? ((node.weights && node.weights[dim]) || 0) : null;
|
|
const weight = dim ? ((node.weights && node.weights[dim]) || 0) : null;
|
|
|
const count = dim ? ((node.counts && node.counts[dim]) || 0) : 0;
|
|
const count = dim ? ((node.counts && node.counts[dim]) || 0) : 0;
|
|
|
let heatT = null;
|
|
let heatT = null;
|
|
|
- if (dim && count > 0 && weight != null) heatT = weightHeatT(weight, scale);
|
|
|
|
|
|
|
+ if (dim && count > 0 && weight != null) heatT = scoreHeatT(dim, weight, scale);
|
|
|
const bg = heatColor(heatT);
|
|
const bg = heatColor(heatT);
|
|
|
const color = heatTextColor(heatT);
|
|
const color = heatTextColor(heatT);
|
|
|
const borderColor = heatT == null ? '#d8dee6' : 'rgba(15, 23, 42, 0.12)';
|
|
const borderColor = heatT == null ? '#d8dee6' : 'rgba(15, 23, 42, 0.12)';
|
|
@@ -830,7 +845,9 @@ const EXPORT_JS = `
|
|
|
const name = node.name || '(未命名)';
|
|
const name = node.name || '(未命名)';
|
|
|
let title;
|
|
let title;
|
|
|
if (!dim) title = name;
|
|
if (!dim) title = name;
|
|
|
- else if (count > 0) title = 'avg=' + weight + ' count=' + count;
|
|
|
|
|
|
|
+ else if (count > 0 && dim === 'total_score') {
|
|
|
|
|
+ title = '全局热度=' + weight + ' 覆盖维度=' + count + '/4';
|
|
|
|
|
+ } else if (count > 0) title = 'avg=' + weight + ' count=' + count;
|
|
|
else title = '无数据';
|
|
else title = '无数据';
|
|
|
|
|
|
|
|
let html = '<div class="tree-node">';
|
|
let html = '<div class="tree-node">';
|
|
@@ -846,7 +863,7 @@ const EXPORT_JS = `
|
|
|
html += '<div class="node-main"><div class="node-text">';
|
|
html += '<div class="node-main"><div class="node-text">';
|
|
|
html += '<span class="node-name">' + esc(name) + '</span>';
|
|
html += '<span class="node-name">' + esc(name) + '</span>';
|
|
|
if (dim) {
|
|
if (dim) {
|
|
|
- html += '<span class="node-weight">' + esc(formatAvgScore(weight, count)) + '</span>';
|
|
|
|
|
|
|
+ html += '<span class="node-weight">' + esc(formatWeightScore(dim, weight, count)) + '</span>';
|
|
|
}
|
|
}
|
|
|
html += '</div>';
|
|
html += '</div>';
|
|
|
if (demands.length) {
|
|
if (demands.length) {
|