@@ -0,0 +1,44 @@
|
||||
import React from "react";
|
||||
import { Bar } from "react-chartjs-2";
|
||||
import { Chart, CategoryScale, BarElement, LogarithmicScale } from "chart.js";
|
||||
import styles from "./RepoSummary.module.sass";
|
||||
|
||||
Chart.register(CategoryScale, BarElement, LogarithmicScale);
|
||||
|
||||
function sortByValue(obj) {
|
||||
return Object.entries(obj).sort(([, a], [, b]) => b - a);
|
||||
}
|
||||
export function RepoSummary(props) {
|
||||
const langs = sortByValue(props.stats.languages);
|
||||
console.log(props.publicGithubRepos);
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Bar
|
||||
options={{
|
||||
indexAxis: "y",
|
||||
responsive: true,
|
||||
scales: {
|
||||
myScale: {
|
||||
type: "logarithmic",
|
||||
position: "bottom",
|
||||
},
|
||||
},
|
||||
}}
|
||||
data={{
|
||||
labels: langs.map((obj) => {
|
||||
return obj[0];
|
||||
}),
|
||||
datasets: [
|
||||
{
|
||||
label: "D1",
|
||||
data: langs.map((obj) => {
|
||||
return obj[1];
|
||||
}),
|
||||
backgroundColor: "#355070",
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
.container
|
||||
max-width: 1000px
|
||||
width: 50vw
|
||||
margin: 150px 0
|
||||
@@ -0,0 +1,3 @@
|
||||
import { RepoSummary } from "./RepoSummary";
|
||||
|
||||
export default RepoSummary;
|
||||
Reference in New Issue
Block a user