chart fix
This commit is contained in:
parent
97c137fb95
commit
6c401a34c4
@ -1,10 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { displayCompanyName, stockTicker } from "$lib/store";
|
import { displayCompanyName, stockTicker } from "$lib/store";
|
||||||
import {
|
import { abbreviateNumber, removeCompanyStrings } from "$lib/utils";
|
||||||
abbreviateNumber,
|
|
||||||
monthNames,
|
|
||||||
removeCompanyStrings,
|
|
||||||
} from "$lib/utils";
|
|
||||||
import SEO from "$lib/components/SEO.svelte";
|
import SEO from "$lib/components/SEO.svelte";
|
||||||
|
|
||||||
//import * as XLSX from 'xlsx';
|
//import * as XLSX from 'xlsx';
|
||||||
@ -16,6 +12,7 @@
|
|||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let config = null;
|
let config = null;
|
||||||
|
let chartInstance;
|
||||||
|
|
||||||
let rawData = data?.getHistoricalRevenue || {};
|
let rawData = data?.getHistoricalRevenue || {};
|
||||||
let tableList = [];
|
let tableList = [];
|
||||||
@ -67,6 +64,13 @@
|
|||||||
timeIdx = state;
|
timeIdx = state;
|
||||||
|
|
||||||
config = plotData();
|
config = plotData();
|
||||||
|
try {
|
||||||
|
config.yAxis.labels.formatter = function () {
|
||||||
|
return abbreviateNumber(this.value);
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function plotData() {
|
function plotData() {
|
||||||
@ -96,8 +100,8 @@
|
|||||||
title: {
|
title: {
|
||||||
text:
|
text:
|
||||||
timeIdx === 0
|
timeIdx === 0
|
||||||
? "Palantir Revenue - Annual"
|
? `${removeCompanyStrings($displayCompanyName)} Revenue - Annual`
|
||||||
: "Palantir Revenue - Quarterly",
|
: `${removeCompanyStrings($displayCompanyName)} Revenue - Quarterly`,
|
||||||
style: { color: "white" },
|
style: { color: "white" },
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
@ -106,7 +110,7 @@
|
|||||||
labels: {
|
labels: {
|
||||||
style: { color: "white" },
|
style: { color: "white" },
|
||||||
formatter: function () {
|
formatter: function () {
|
||||||
return timeIdx === 0 ? this?.value?.substring(0, 4) : this?.value; // Extracts the year (YYYY) from 'YYYY-MM-DD'
|
return timeIdx === 0 ? this?.value?.substring(0, 4) : this?.value;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user