Skip to content

Commit

Permalink
Updated font for the chart
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobWeinbren committed Jan 26, 2024
1 parent 51c907f commit f15eb0e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
4 changes: 3 additions & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
"@mapbox/mapbox-gl-geocoder": "^5.0.2",
"astro": "^4.2.4",
"chart.js": "^4.4.1",
"fontfaceobserver": "^2.3.0",
"mapbox-gl": "^3.1.0",
"react-map-gl": "^7.1.7",
"tailwindcss": "^3.4.1"
"tailwindcss": "^3.4.1",
"webfontloader": "^1.6.28"
}
}
15 changes: 2 additions & 13 deletions site/src/components/Chart.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

const chartElement = document.getElementById("chart");
let myChart;
console.log("Test");

if (chartElement) {
const ctx = (chartElement as HTMLCanvasElement).getContext("2d");
Expand Down Expand Up @@ -37,27 +38,20 @@
max: 100,
ticks: {
callback: (value) => `${value}%`,
font: { size: 16, family: "Inter" },
},
},
x: {
stacked: true, // Enable stacking
ticks: { font: { size: 16, family: "Inter" } },
},
},
plugins: {
title: {
display: true,
text: "Bloc Percentage at Polling Station",
font: { size: 16, family: "Inter" },
padding: { bottom: 20 },
},
legend: { display: false },
tooltip: {
titleFont: {
size: 16,
family: "Inter",
},
animation: false,
backgroundColor: "rgba(0, 0, 0, 1)",
callbacks: {
Expand All @@ -76,13 +70,9 @@
return `${truncatedPartyName}: ${percentage}%`;
},
},
bodyFont: {
size: 16,
family: "Inter",
},
usePointStyle: true,
boxPadding: 5,
padding: 10,
padding: 5,
},
},
elements: { bar: { borderRadius: 2 } },
Expand Down Expand Up @@ -165,7 +155,6 @@
myChart.data.datasets = myChart.data.datasets.filter((dataset) =>
newDatasets.includes(dataset)
);

myChart.update();
}
};
Expand Down
4 changes: 0 additions & 4 deletions site/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ const dropdownHtml = `<label for="json-selector" class="sr-only">Select Knesset
href="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.7.0/mapbox-gl-geocoder.css"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="geocoder" class="geocoder fixed top-4 left-4 z-10"></div>
Expand Down

0 comments on commit f15eb0e

Please sign in to comment.