Skip to content

Commit d9d1844

Browse files
committed
fix small chart issues
1 parent bf09a0b commit d9d1844

File tree

10 files changed

+20
-18
lines changed

10 files changed

+20
-18
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ lint:
1717
cd data && make lint
1818
cd data-lib && make lint
1919
cd data-wasm && make lint
20+
cd website && bun run check
2021

2122
submodule-update:
2223
git submodule update --init --remote

data-lib/src/plugin/packages.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl PackageManager {
5252
}
5353

5454
pub fn iter_variants() -> impl Iterator<Item = PackageManager> {
55-
PackageManager::variants().into_iter().cloned()
55+
PackageManager::variants().iter().cloned()
5656
}
5757

5858
pub const fn variants() -> &'static [PackageManager] {

data-lib/src/release/data_array.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl ReleaseDataArray {
9090
)
9191
})
9292
})
93-
.sort_by(|a, b| a.0.cmp(&b.0))
93+
.sort_by(|a, b| a.0.cmp(b.0))
9494
.map(|(version, os, value)| StackedNamedDataPoint {
9595
name: version.to_fancy_string(),
9696
layer: os,
@@ -254,7 +254,7 @@ impl ReleaseDataArray {
254254
)
255255
})
256256
})
257-
.sort_by(|a, b| a.0.cmp(&b.0).then_with(|| b.2.total_cmp(&a.2)))
257+
.sort_by(|a, b| a.0.cmp(b.0).then_with(|| b.2.total_cmp(&a.2)))
258258
.map(|(version, file_type, value)| StackedNamedDataPoint {
259259
name: version.to_fancy_string(),
260260
layer: file_type,
@@ -315,7 +315,7 @@ impl ReleaseDataArray {
315315
.iter()
316316
.filter(|release| release.platform == ObsidianPlatform::Desktop)
317317
.dedup_by(|a, b| a.version == b.version)
318-
.filter_map(|release| {
318+
.map(|release| {
319319
let mut changes = ChangelogChanges {
320320
version: release.version.clone(),
321321
version_string: release.version.to_fancy_string(),
@@ -386,7 +386,7 @@ impl ReleaseDataArray {
386386
}
387387
}
388388

389-
Some(changes)
389+
changes
390390
})
391391
.sort_by(|a, b| a.version.cmp(&b.version))
392392
.collect()

data-wasm/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
mod utils;
22

33
use data_lib::{
4-
plugin::{data_array::PluginDataArray, PluginData, PluginExtraData},
5-
release::{data_array::ReleaseDataArray, GithubReleaseInfo, ObsidianReleaseInfo},
6-
theme::{data_array::ThemeDataArray, ThemeData},
4+
plugin::{PluginData, PluginExtraData, data_array::PluginDataArray},
5+
release::{GithubReleaseInfo, ObsidianReleaseInfo, data_array::ReleaseDataArray},
6+
theme::{ThemeData, data_array::ThemeDataArray},
77
};
88
use wasm_bindgen::prelude::*;
99

website/src/components/Plugin.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (!plugin) {
1919
throw new Error(`Plugin with ID ${pluginId} not found.`);
2020
}
2121
22-
function getFundingLinks(urls: string | Record<string, string> | undefined): { text: string; href: string }[] {
22+
function getFundingLinks(urls: string | Map<string, string> | undefined): { text: string; href: string }[] {
2323
if (!urls) {
2424
return [];
2525
}
@@ -28,7 +28,7 @@ function getFundingLinks(urls: string | Record<string, string> | undefined): { t
2828
return [{ text: 'Support the Author', href: urls }];
2929
}
3030
31-
return Object.entries(urls).map(([text, href]) => ({ text: `Support the Author via ${text}`, href }));
31+
return Array.from(urls.entries()).map(([text, href]) => ({ text: `Support the Author via ${text}`, href }));
3232
}
3333
3434
const helpUrl = plugin.help_url();
@@ -43,7 +43,7 @@ const external_links: { text: string; href: string }[] = [
4343
obsidianUrl ? { text: 'View in Obsidian', href: obsidianUrl } : undefined,
4444
obsidianHubUrl ? { text: 'View on the Obsidian Hub', href: obsidianHubUrl } : undefined,
4545
authorUrl ? { text: 'Author Website', href: authorUrl } : undefined,
46-
...getFundingLinks(plugin.funding_url()),
46+
...getFundingLinks(fundingUrl),
4747
].filter(x => x !== undefined);
4848
4949
const warnings = plugin.warnings();

website/src/components/svelte/charts/StackedBarChart.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
skewLabels?: boolean;
1111
percentages?: boolean;
1212
yDomain?: [number, number];
13+
xPadding?: number;
1314
}
1415
15-
const { dataPoints, xLabel, yLabel, yDomain, skewLabels = false, percentages = false }: Props = $props();
16+
const { dataPoints, xLabel, yLabel, yDomain, skewLabels = false, percentages = false, xPadding = undefined }: Props = $props();
1617
1718
const mappedDataPoints = dataPoints.map((point, index) => {
1819
return {
@@ -27,7 +28,7 @@
2728
<ChartWrapper>
2829
<Plot
2930
color={{ legend: true, scheme: 'tableau10' }}
30-
x={{ type: 'band', label: `${xLabel} →`, tickRotate: skewLabels ? 45 : 0 }}
31+
x={{ type: 'band', label: `${xLabel} →`, tickRotate: skewLabels ? 45 : 0, padding: xPadding }}
3132
y={{ label: `↑ ${yLabel}`, domain: yDomain, tickFormat: percentages ? d => `${String(d)}%` : d => String(d) }}
3233
class="no-overflow-clip"
3334
>

website/src/components/svelte/charts/release/AssetSizeChart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
>
3333
<GridY />
3434
<Dot data={mappedDataPoints} x="label" y="value" stroke="stack" sort="index" />
35-
<Pointer data={mappedDataPoints} x="label" z="stack" maxDistance={2}>
35+
<Pointer data={mappedDataPoints} x="label" z="stack" maxDistance={5}>
3636
{#snippet children({ data })}
3737
<Text {data} fill="stack" x="label" y="value" text={d => formatSize(d.value)} lineAnchor="bottom" dy={-7} />
3838
<Dot {data} x="label" y="value" fill="stack" />

website/src/components/svelte/charts/release/ChangelogChart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<ChartWrapper>
2323
<Plot
2424
color={{ legend: true, scheme: 'tableau10' }}
25-
x={{ type: 'band', label: `Version Number →`, tickRotate: 45 }}
25+
x={{ type: 'band', label: `Version Number →`, tickRotate: 45, padding: 0 }}
2626
y={{ label: `↑ Changes` }}
2727
class="no-overflow-clip"
2828
>

website/src/pages/releasestats/downloads.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ const downloadsPercentages = dataArray.total_downloads_per_version_by_os_as_perc
2929

3030
<p>The below graph depicts the total number of downloads for every release, split by OS.</p>
3131

32-
<StackedBarChart dataPoints={downloads} xLabel="Version Number" yLabel="Downloads" skewLabels client:idle />
32+
<StackedBarChart dataPoints={downloads} xLabel="Version Number" yLabel="Downloads" skewLabels xPadding={0} client:idle />
3333

3434
<p>This graph shows the distribution of downloads among the different operating systems.</p>
3535

36-
<StackedBarChart dataPoints={downloadsPercentages} xLabel="Version Number" yLabel="Downloads" skewLabels percentages client:idle />
36+
<StackedBarChart dataPoints={downloadsPercentages} xLabel="Version Number" yLabel="Downloads" skewLabels percentages xPadding={0} client:idle />
3737
</StarlightPage>

website/src/pages/releasestats/overview.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const changelogCategories = dataArray.get_changelog_categories();
7474
<tr>
7575
<td>{item.version_string}</td>
7676
{changelogCategories.map(category => (
77-
<td>{item.changes[category] || 0}</td>
77+
<td>{item.changes.get(category) || 0}</td>
7878
))}
7979
</tr>
8080
))

0 commit comments

Comments
 (0)