Spaces:
Running
Running
fix: Use hovertext for heatmap to fix TypeError in Plotly
Browse files- index.html +11 -0
index.html
CHANGED
@@ -801,6 +801,17 @@
|
|
801 |
hoverongaps: false, colorscale: 'Viridis', reversescale: true,
|
802 |
colorbar: { title: 'Avg Latency (ms)', titleside: 'right', thickness: 15 },
|
803 |
xgap: 2, ygap: 2, hovertemplate: hoverText
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
804 |
}];
|
805 |
|
806 |
const layout = mergeLayout({
|
|
|
801 |
hoverongaps: false, colorscale: 'Viridis', reversescale: true,
|
802 |
colorbar: { title: 'Avg Latency (ms)', titleside: 'right', thickness: 15 },
|
803 |
xgap: 2, ygap: 2, hovertemplate: hoverText
|
804 |
+
const avg = data?.count > 0 ? (data.sum / data.count).toFixed(0) : 'N/A';
|
805 |
+
const count = data?.count || 0;
|
806 |
+
return `Model: ${model}<br>Provider: ${provider}<br>Avg Latency: ${avg} ms<br>Requests: ${count}<extra></extra>`;
|
807 |
+
}));
|
808 |
+
|
809 |
+
const plotData = [{
|
810 |
+
z: zValues, x: sortedProviders, y: sortedModels, type: 'heatmap',
|
811 |
+
hoverongaps: false, colorscale: 'Viridis', reversescale: true,
|
812 |
+
colorbar: { title: 'Avg Latency (ms)', titleside: 'right', thickness: 15 },
|
813 |
+
xgap: 2, ygap: 2, hovertext: hoverText, // Use hovertext instead of hovertemplate
|
814 |
+
hoverinfo: 'text' // Tell plotly to use the hovertext
|
815 |
}];
|
816 |
|
817 |
const layout = mergeLayout({
|