Skip to content

Commit

Permalink
feat: hide grid by setting it to false; closes: #212
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh00710 committed May 19, 2024
1 parent e75e73e commit 993b707
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Customize the appearance of your Activity Graph however you want with URL params
| `days` | number of to days display on graph | number between (1 - 90) [Recommended below 40] |
| `from` | date from which the graph starts | format `YYYY-MM-DD` |
| `to` | date where the graph will end | format `YYYY-MM-DD` |
| `grid` | show grid | boolean (default: `true`) |

**For `custom_title` please make sure that you are using %20 for spaces**

Expand Down
5 changes: 4 additions & 1 deletion src/GraphCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export class Card {
private readonly radius: number,
private readonly colors: Colors,
private readonly title = '',
private readonly area = false
private readonly area = false,
private readonly showGrid = true
) {}

private getOptions() {
Expand All @@ -24,13 +25,15 @@ export class Card {
y: 4.5,
},
low: 0,
showGrid: this.showGrid,
},
axisX: {
title: 'Days',
offset: 50,
labelOffset: {
x: -4.5,
},
showGrid: this.showGrid,
},
chartPadding: {
top: 80,
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class QueryOption {
custom_title?: string;
from?: string;
to?: string;
grid: boolean;
colors: Colors;
area: boolean;
radius: number;
Expand All @@ -46,6 +47,7 @@ export class ParsedQs {
days?: string;
from?: string;
to?: string;
grid?: string;
}

export class GraphArgs {
Expand Down
4 changes: 3 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export class Utilities {
? Math.min(Math.max(this.queryString.height, 200), 600)
: 420, // Custom height implementation from range [200, 600], if not specified use default value - 420
days: isFromValid && isToValid ? days : this.validateDays(this.queryString.days),
grid: this.queryString.grid === 'false' ? false : true,
from,
to,
};
Expand Down Expand Up @@ -150,7 +151,8 @@ export class Utilities {
options.radius,
options.colors,
title,
options.area
options.area,
options.grid
);
const getChart = await graph.buildGraph(fetchCalendarData.contributions);
return {
Expand Down

0 comments on commit 993b707

Please sign in to comment.