ui fix
This commit is contained in:
parent
d847a1b1d5
commit
da8a443ee5
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { abbreviateNumberWithColor } from "$lib/utils";
|
import { abbreviateNumberWithColor, monthNames } from "$lib/utils";
|
||||||
import { screenWidth } from "$lib/store";
|
import { screenWidth } from "$lib/store";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import TableHeader from "$lib/components/Table/TableHeader.svelte";
|
import TableHeader from "$lib/components/Table/TableHeader.svelte";
|
||||||
@ -49,14 +49,6 @@
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const dates = processedData?.map((d) => d.expiry);
|
const dates = processedData?.map((d) => d.expiry);
|
||||||
const formattedDates = dates.map((date) => {
|
|
||||||
const d = new Date(date);
|
|
||||||
return d.toLocaleDateString("en-US", {
|
|
||||||
month: "short", // Abbreviated month name
|
|
||||||
day: "numeric", // Day of the month
|
|
||||||
year: "2-digit", // Two-digit year
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const callValues = processedData?.map((d) => d.callValue?.toFixed(2));
|
const callValues = processedData?.map((d) => d.callValue?.toFixed(2));
|
||||||
const putValues = processedData?.map((d) => d.putValue?.toFixed(2));
|
const putValues = processedData?.map((d) => d.putValue?.toFixed(2));
|
||||||
@ -100,15 +92,24 @@
|
|||||||
show: false, // Hide x-axis labels
|
show: false, // Hide x-axis labels
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: [
|
||||||
|
{
|
||||||
type: "category",
|
type: "category",
|
||||||
data: formattedDates,
|
data: dates,
|
||||||
axisLine: { lineStyle: { color: "#fff" } },
|
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: "#fff",
|
color: "#fff",
|
||||||
|
|
||||||
|
formatter: function (value) {
|
||||||
|
// Assuming dates are in the format 'yyyy-mm-dd'
|
||||||
|
const dateParts = value.split("-");
|
||||||
|
const monthIndex = parseInt(dateParts[1]) - 1; // Months are zero-indexed in JavaScript Date objects
|
||||||
|
const year = parseInt(dateParts[0]);
|
||||||
|
const day = parseInt(dateParts[2]);
|
||||||
|
return `${day} ${monthNames[monthIndex]} ${year}`;
|
||||||
},
|
},
|
||||||
splitLine: { show: false },
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: `Put`,
|
name: `Put`,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user