bugfixing
This commit is contained in:
parent
1fd81b2be3
commit
92e7304989
@ -59,27 +59,21 @@
|
|||||||
|
|
||||||
function getPlotOptions(state) {
|
function getPlotOptions(state) {
|
||||||
|
|
||||||
|
// Combine the data into an array of objects to keep them linked
|
||||||
|
const combinedData = rawData?.map(item => ({
|
||||||
|
date: state === 'effectiveDate' ? item['Effective Date'] : item['Expiration Date'],
|
||||||
|
notionalAmount: item['Notional amount-Leg 1'],
|
||||||
|
notionalQuantity: item['Total notional quantity-Leg 1']
|
||||||
|
}));
|
||||||
|
|
||||||
let dates = [];
|
// Sort the combined data array based on the date
|
||||||
let notionalAmount = [];
|
combinedData?.sort((a, b) => new Date(a.date) - new Date(b.date));
|
||||||
let notionalQuantity = [];
|
|
||||||
|
// Separate the sorted data back into individual arrays
|
||||||
|
const dates = combinedData?.map(item => item?.date);
|
||||||
|
const notionalAmount = combinedData?.map(item => item?.notionalAmount);
|
||||||
|
const notionalQuantity = combinedData?.map(item => item?.notionalQuantity);
|
||||||
|
|
||||||
// Iterate over the data and extract required information
|
|
||||||
rawData?.forEach(item => {
|
|
||||||
|
|
||||||
if ( state === 'effectiveDate') {
|
|
||||||
dates?.push(item['Effective Date']);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dates?.push(item['Expiration Date']);
|
|
||||||
}
|
|
||||||
notionalAmount?.push(item['Notional amount-Leg 1']);
|
|
||||||
notionalQuantity?.push(item['Total notional quantity-Leg 1']);
|
|
||||||
});
|
|
||||||
|
|
||||||
dates?.sort((a, b) => {
|
|
||||||
return new Date(a) - new Date(b);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Compute the average of item?.traded
|
// Compute the average of item?.traded
|
||||||
const totalNotionalAmount = notionalAmount?.reduce((acc, item) => acc + item, 0);
|
const totalNotionalAmount = notionalAmount?.reduce((acc, item) => acc + item, 0);
|
||||||
|
|||||||
@ -335,7 +335,7 @@ $: {
|
|||||||
{#each weekday as day,index}
|
{#each weekday as day,index}
|
||||||
|
|
||||||
<div class="w-full {index === selectedWeekday ? '' : 'hidden sm:block'}">
|
<div class="w-full {index === selectedWeekday ? '' : 'hidden sm:block'}">
|
||||||
<label on:click={() => toggleDate(index)} class="w-11/12 m-auto sm:w-full cursor-pointer h-16 {index === selectedWeekday ? 'bg-[#27272A]' : ''} rounded-lg sm:rounded-none flex bg-[#09090B] border border-gray-600 mb-3">
|
<label on:click={() => toggleDate(index)} class="w-11/12 m-auto sm:w-full cursor-pointer h-16 {index === selectedWeekday ? 'bg-[#141417]' : ''} rounded-lg sm:rounded-none flex bg-[#09090B] border border-gray-600 mb-3">
|
||||||
<div class=" flex flex-row justify-center items-center w-full ">
|
<div class=" flex flex-row justify-center items-center w-full ">
|
||||||
<label on:click={() => clickWeekday('previous', index) } class="{previousMax === true && index === 0? 'opacity-20' : ''} sm:hidden ml-auto">
|
<label on:click={() => clickWeekday('previous', index) } class="{previousMax === true && index === 0? 'opacity-20' : ''} sm:hidden ml-auto">
|
||||||
<svg class="w-8 h-8 inline-block rotate-180 " xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="white" d="M8.025 22L6.25 20.225L14.475 12L6.25 3.775L8.025 2l10 10l-10 10Z"/></svg>
|
<svg class="w-8 h-8 inline-block rotate-180 " xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="white" d="M8.025 22L6.25 20.225L14.475 12L6.25 3.775L8.025 2l10 10l-10 10Z"/></svg>
|
||||||
|
|||||||
@ -30,16 +30,19 @@
|
|||||||
|
|
||||||
async function plotDividend() {
|
async function plotDividend() {
|
||||||
|
|
||||||
let dates = [];
|
// Combine the data into an array of objects to keep them linked
|
||||||
let dividendList = [];
|
const combinedData = rawData?.history?.map(item => ({
|
||||||
// Iterate over the data and extract required information
|
date: item?.paymentDate,
|
||||||
rawData?.history?.forEach(item => {
|
dividend: item?.adjDividend
|
||||||
|
}));
|
||||||
dates?.push(item?.paymentDate);
|
|
||||||
dividendList?.push(item?.adjDividend);
|
// Sort the combined data array based on the date
|
||||||
});
|
combinedData.sort((a, b) => new Date(a.date) - new Date(b.date));
|
||||||
|
|
||||||
dates?.sort((a,b) => new Date(a) - new Date(b));
|
// Separate the sorted data back into individual arrays
|
||||||
|
const dates = combinedData.map(item => item.date);
|
||||||
|
const dividendList = combinedData.map(item => item.dividend);
|
||||||
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
|||||||
@ -30,16 +30,19 @@ let dividendGrowth = rawData?.dividendGrowth;
|
|||||||
|
|
||||||
async function plotDividend() {
|
async function plotDividend() {
|
||||||
|
|
||||||
let dates = [];
|
// Combine the data into an array of objects to keep them linked
|
||||||
let dividendList = [];
|
const combinedData = rawData?.history?.map(item => ({
|
||||||
// Iterate over the data and extract required information
|
date: item?.paymentDate,
|
||||||
rawData?.history?.forEach(item => {
|
dividend: item?.adjDividend
|
||||||
|
}));
|
||||||
|
|
||||||
dates?.push(item?.paymentDate);
|
// Sort the combined data array based on the date
|
||||||
dividendList?.push(item?.adjDividend);
|
combinedData.sort((a, b) => new Date(a.date) - new Date(b.date));
|
||||||
});
|
|
||||||
|
// Separate the sorted data back into individual arrays
|
||||||
|
const dates = combinedData.map(item => item.date);
|
||||||
|
const dividendList = combinedData.map(item => item.dividend);
|
||||||
|
|
||||||
dates?.sort((a,b) => new Date(a) - new Date(b));
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user