Skip to content

Commit

Permalink
Show x-axis with only month and day without year
Browse files Browse the repository at this point in the history
  • Loading branch information
yykamei committed Apr 3, 2024
1 parent 14f113a commit 768d1b8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
7 changes: 3 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29433,9 +29433,8 @@ class MermaidXYChart {
return m;
}
const date = r.date.toLocaleDateString("en-CA", {
year: "numeric",
month: "2-digit",
day: "2-digit",
month: "short",
day: "numeric",
});
const d = m.get(date);
if (d) {
Expand All @@ -29454,7 +29453,7 @@ class MermaidXYChart {
const xAxis = [];
const seconds = [];
for (const [date, mean] of means.entries()) {
xAxis.unshift(date);
xAxis.unshift(`"${date}"`);
seconds.unshift(mean);
}
const status = this.input.status ? ` for status=${this.input.status}` : "";
Expand Down
7 changes: 3 additions & 4 deletions src/MermaidXYChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ export class MermaidXYChart {
return m;
}
const date = r.date.toLocaleDateString("en-CA", {
year: "numeric",
month: "2-digit",
day: "2-digit",
month: "short",
day: "numeric",
});
const d = m.get(date);
if (d) {
Expand All @@ -35,7 +34,7 @@ export class MermaidXYChart {
const xAxis: string[] = [];
const seconds: number[] = [];
for (const [date, mean] of means.entries()) {
xAxis.unshift(date);
xAxis.unshift(`"${date}"`);
seconds.unshift(mean);
}
const status = this.input.status ? ` for status=${this.input.status}` : "";
Expand Down
4 changes: 2 additions & 2 deletions tests/GitHubIssueContent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ config:
---
xychart-beta
title "ABC (abc.yml)"
x-axis [2024-02-27]
x-axis ["Feb 27"]
y-axis "Duration (in seconds)"
bar [4]
\`\`\`
Expand All @@ -91,7 +91,7 @@ config:
---
xychart-beta
title "XYZ (xyz.yml)"
x-axis [2024-03-27]
x-axis ["Mar 27"]
y-axis "Duration (in seconds)"
bar [2]
\`\`\`
Expand Down
4 changes: 2 additions & 2 deletions tests/MermaidXYChart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ config:
---
xychart-beta
title "ABC (abc.yml)"
x-axis [2024-02-19,2024-02-20,2024-02-21,2024-02-22,2024-02-23,2024-02-24,2024-02-25,2024-02-26,2024-02-27]
x-axis ["Feb 19","Feb 20","Feb 21","Feb 22","Feb 23","Feb 24","Feb 25","Feb 26","Feb 27"]
y-axis "Duration (in seconds)"
bar [424,942,971,1055,911,734,684,658,815]
\`\`\`
Expand Down Expand Up @@ -143,7 +143,7 @@ config:
---
xychart-beta
title "ABC (abc.yml for status=success)"
x-axis [2024-02-19]
x-axis ["Feb 19"]
y-axis "Duration (in seconds)"
bar [521]
\`\`\`
Expand Down

0 comments on commit 768d1b8

Please sign in to comment.