ui fix
This commit is contained in:
parent
63eccadb98
commit
53fa571ee5
3350
package-lock.json
generated
3350
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -94,6 +94,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"https": "^1.0.0",
|
"https": "^1.0.0",
|
||||||
"jsconfig.json": "^2.3.3",
|
"jsconfig.json": "^2.3.3",
|
||||||
|
"plotly.js": "^2.35.3",
|
||||||
|
"svelte-plotly.js": "^1.2.0",
|
||||||
"ua-parser-js": "^1.0.37"
|
"ua-parser-js": "^1.0.37"
|
||||||
},
|
},
|
||||||
"description": "UI of stocknear - Stock Analysis & Community Platform for Small Investors.",
|
"description": "UI of stocknear - Stock Analysis & Community Platform for Small Investors.",
|
||||||
|
|||||||
@ -273,7 +273,7 @@
|
|||||||
optionType: { order: "none", type: "string" },
|
optionType: { order: "none", type: "string" },
|
||||||
unusualType: { order: "none", type: "string" },
|
unusualType: { order: "none", type: "string" },
|
||||||
dte: { order: "none", type: "number" },
|
dte: { order: "none", type: "number" },
|
||||||
sentiment: { order: "none", type: "string" },
|
sentiment: { order: "none", type: "sentiment" },
|
||||||
size: { order: "none", type: "number" },
|
size: { order: "none", type: "number" },
|
||||||
strike: { order: "none", type: "number" },
|
strike: { order: "none", type: "number" },
|
||||||
avgPrice: { order: "none", type: "number" },
|
avgPrice: { order: "none", type: "number" },
|
||||||
@ -319,6 +319,13 @@
|
|||||||
return sortOrder === "asc"
|
return sortOrder === "asc"
|
||||||
? valueA.localeCompare(valueB)
|
? valueA.localeCompare(valueB)
|
||||||
: valueB.localeCompare(valueA);
|
: valueB.localeCompare(valueA);
|
||||||
|
case "sentiment":
|
||||||
|
const sentimentOrder = { BULLISH: 1, NEUTRAL: 2, BEARISH: 3 };
|
||||||
|
const sentimentA = sentimentOrder[a?.sentiment?.toUpperCase()] || 4;
|
||||||
|
const sentimentB = sentimentOrder[b?.sentiment?.toUpperCase()] || 4;
|
||||||
|
return sortOrder === "asc"
|
||||||
|
? sentimentA - sentimentB
|
||||||
|
: sentimentB - sentimentA;
|
||||||
case "number":
|
case "number":
|
||||||
default:
|
default:
|
||||||
valueA = parseFloat(a[key]);
|
valueA = parseFloat(a[key]);
|
||||||
@ -326,11 +333,10 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortOrder === "asc") {
|
// Default comparison for numbers and fallback case
|
||||||
return valueA < valueB ? -1 : valueA > valueB ? 1 : 0;
|
if (valueA < valueB) return sortOrder === "asc" ? -1 : 1;
|
||||||
} else {
|
if (valueA > valueB) return sortOrder === "asc" ? 1 : -1;
|
||||||
return valueA > valueB ? -1 : valueA < valueB ? 1 : 0;
|
return 0;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sort using the generic comparison function
|
// Sort using the generic comparison function
|
||||||
|
|||||||
@ -1,17 +1,47 @@
|
|||||||
<script lang="ts">
|
<script>
|
||||||
import { onMount } from "svelte";
|
import Plot from "svelte-plotly.js";
|
||||||
|
|
||||||
export let data; // Expect `data` to include necessary Plotly configuration.
|
// Treemap data configuration
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
type: "treemap",
|
||||||
|
labels: [
|
||||||
|
"Eve",
|
||||||
|
"Cain",
|
||||||
|
"Seth",
|
||||||
|
"Enos",
|
||||||
|
"Noam",
|
||||||
|
"Abel",
|
||||||
|
"Awan",
|
||||||
|
"Enoch",
|
||||||
|
"Azura",
|
||||||
|
],
|
||||||
|
parents: ["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"],
|
||||||
|
textinfo: "label+parent",
|
||||||
|
marker: { line: { width: 2 } },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
let plotContainer;
|
// Layout configuration with black background
|
||||||
|
const layout = {
|
||||||
|
title: "Family Tree Treemap",
|
||||||
|
margin: { l: 0, r: 0, b: 20, t: 40 },
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
paper_bgcolor: "#09090b", // Sets the outer background to black
|
||||||
|
font: { color: "#FFFFFF" }, // Optional: Change text color to white for better contrast
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{@html data?.getData}
|
<div class="w-full min-h-screen">
|
||||||
|
<div class="treemap-container">
|
||||||
|
<Plot {data} {layout} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.plot-container {
|
.treemap-container {
|
||||||
width: 100%;
|
margin: 1rem;
|
||||||
height: 100%;
|
padding: 1rem;
|
||||||
min-height: 500px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user