update clincial trial

This commit is contained in:
MuslemRahimi 2024-10-14 19:55:04 +02:00
parent 9519d2e606
commit bfbe16a6fc

View File

@ -60,22 +60,6 @@ function handleViewData(trialData) {
openPopup?.dispatchEvent(new MouseEvent('click')) openPopup?.dispatchEvent(new MouseEvent('click'))
} }
function normalizer(value) {
if (Math?.abs(value) >= 1e18) {
return { unit: 'Q', denominator: 1e18 };
} else if (Math?.abs(value) >= 1e12) {
return { unit: 'T', denominator: 1e12 };
} else if (Math?.abs(value) >= 1e9) {
return { unit: 'B', denominator: 1e9 };
} else if (Math?.abs(value) >= 1e6) {
return { unit: 'M', denominator: 1e6 };
} else if (Math?.abs(value) >= 1e5) {
return { unit: 'K', denominator: 1e5 };
} else {
return { unit: '', denominator: 1 };
}
}
function getPlotOptions() { function getPlotOptions() {
let dates = []; let dates = [];
@ -109,11 +93,9 @@ function getPlotOptions() {
// Update valueList with the count of each fiscal year // Update valueList with the count of each fiscal year
valueList = dates?.map(fiscalYear => fiscalYearCount[fiscalYear]); valueList = dates?.map(fiscalYear => fiscalYearCount[fiscalYear]);
const {unit, denominator } = normalizer(Math.max(...valueList) ?? 0)
const option = { const option = {
silent: true, silent: true,
animation: false,
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
hideDelay: 100, // Set the delay in milliseconds hideDelay: 100, // Set the delay in milliseconds
@ -138,12 +120,9 @@ function getPlotOptions() {
show: false, // Disable x-axis grid lines show: false, // Disable x-axis grid lines
}, },
axisLabel: { axisLabel: {
color: '#fff', // Change label color to white show: false // Hide y-axis labels
formatter: function (value) { }
return '#'+(value / denominator)?.toFixed(0) + unit; // Format value in millions }
},
},
},
], ],
series: [ series: [
{ {
@ -264,13 +243,11 @@ let charNumber = 20;
<!--
<h2 class="mt-10 mr-1 flex flex-row items-center text-white text-xl sm:text-2xl font-bold mb-3"> <h2 class="mt-10 mr-1 flex flex-row items-center text-white text-xl sm:text-2xl font-bold mb-3">
Latest Information Latest Information
</h2> </h2>
<div class="rounded-lg sm:min-h-[330px]"> <div class="rounded-lg sm:min-h-[330px]">
<div class="w-full m-auto h-auto max-h-[500px] overflow-x-scroll sm:overflow-hidden sm:overflow-y-scroll scroller "> <div class="w-full m-auto h-auto max-h-[500px] overflow-x-scroll sm:overflow-hidden sm:overflow-y-scroll scroller ">
<table class="table table-sm table-compact table-pin-rows table-pin-cols w-full"> <table class="table table-sm table-compact table-pin-rows table-pin-cols w-full">
@ -289,11 +266,9 @@ let charNumber = 20;
<td class="text-white font-medium whitespace-nowrap"> <td class="text-white font-medium whitespace-nowrap">
{item["Interventions"]?.length === 0 ? '-' : item["Interventions"]?.length > charNumber ? formatString(item["Interventions"]?.slice(0,charNumber)) + "..." : formatString(item["Interventions"])} {item["Interventions"]?.length === 0 ? '-' : item["Interventions"]?.length > charNumber ? formatString(item["Interventions"]?.slice(0,charNumber)) + "..." : formatString(item["Interventions"])}
</td> </td>
<!--
<td class="text-white font-medium w-full text-start"> <td class="text-white font-medium w-full text-start">
{item['Start Date'] === null ? 'n/a' : new Date(item["Start Date"])?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} {item['Start Date'] === null ? 'n/a' : new Date(item["Start Date"])?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })}
</td> </td>
-->
<td class="text-white text-start font-medium"> <td class="text-white text-start font-medium">
{formatString(item['Study Status'])} {formatString(item['Study Status'])}
@ -312,10 +287,9 @@ let charNumber = 20;
{/each} {/each}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
-->
{/if} {/if}