diff --git a/src/lib/components/CorporateLobbying.svelte b/src/lib/components/CorporateLobbying.svelte index 344b1245..eaa07abd 100644 --- a/src/lib/components/CorporateLobbying.svelte +++ b/src/lib/components/CorporateLobbying.svelte @@ -21,17 +21,6 @@ use([BarChart, GridComponent, TooltipComponent, CanvasRenderer]) let displayMaxLobbying = 0; let displayYear = 'n/a'; -function normalizer(value) { - 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: 1e3 }; - } else { - return { unit: '', denominator: 1 }; - } -} function getPlotOptions() { @@ -48,8 +37,6 @@ function getPlotOptions() { }); - const {unit, denominator } = normalizer(Math.max(...valueList) ?? 0) - const option = { silent: true, animation: false, @@ -71,26 +58,25 @@ function getPlotOptions() { } }, yAxis: [ - { - type: 'value', - splitLine: { - show: false, // Disable x-axis grid lines - }, - axisLabel: { - color: '#fff', // Change label color to white - formatter: function (value) { - return '$'+(value / denominator)?.toFixed(1) + unit; // Format value in millions - }, - }, + { + type: 'value', + splitLine: { + show: false, // Disable x-axis grid lines + }, + + axisLabel: { + show: false // Hide y-axis labels + } }, ], series: [ { - data: valueList, - type: 'bar', - itemStyle: { + name: 'Spending [$]', + data: valueList, + type: 'bar', + itemStyle: { color: '#F8901E' // Change bar color to white - } + } } ] }; diff --git a/src/lib/components/GovernmentContract.svelte b/src/lib/components/GovernmentContract.svelte index ad9bf0b2..1e6d51d0 100644 --- a/src/lib/components/GovernmentContract.svelte +++ b/src/lib/components/GovernmentContract.svelte @@ -96,31 +96,27 @@ use([BarChart, GridComponent, CanvasRenderer]) }, yAxis: [ - { - type: 'value', - splitLine: { - show: false, // Disable x-axis grid lines - }, - axisLabel: { - color: '#fff', // Change label color to white - formatter: function (value, index) { - if(index % 2) { - return '$'+(value / denominator)?.toFixed(1) + unit; // Format value in millions - } else { - return '' - } - }, - }, - }, - { - type: 'value', - show: false, - splitLine: { - show: false, // Disable x-axis grid lines - }, - position: 'right', - + { + type: 'value', + splitLine: { + show: false, // Disable x-axis grid lines }, + + axisLabel: { + show: false // Hide y-axis labels + } + }, + { + type: 'value', + splitLine: { + show: false, // Disable x-axis grid lines + }, + + axisLabel: { + show: false // Hide y-axis labels + }, + position: 'right', + }, ], series: [ {