Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 0a3df19

Browse files
Switched to Cavas Graphs for line and network
This helps the applicaiton deal better with bigger datasets.
1 parent 40c0541 commit 0a3df19

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

components/Form.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from "react";
22
import { Octokit } from "@octokit/rest";
33
import styles from "./Form.module.css";
44
import { ResponsiveCalendar } from "@nivo/calendar";
5-
import { ResponsiveNetwork } from "@nivo/network";
5+
import { ResponsiveNetworkCanvas } from "@nivo/network";
66
import { ResponsivePie } from "@nivo/pie";
7-
import { ResponsiveLine } from "@nivo/line";
7+
import { ResponsiveLineCanvas } from "@nivo/line";
88

99
class Form extends React.Component {
1010
constructor(props) {
@@ -297,16 +297,17 @@ class Form extends React.Component {
297297
repo: input2,
298298
});
299299

300-
const contributors = await octokit.repos.getContributorsStats({
301-
owner: input1,
302-
repo: input2,
303-
});
300+
const contributors = await octokit.paginate(
301+
"GET /repos/" + input1 + "/" + input2 + "/stats/contributors"
302+
);
303+
304+
console.log(contributors);
304305

305306
this.setState({ repo_url: repo["data"]["html_url"] });
306307

307308
console.log(contributors);
308309

309-
contributors["data"].forEach((contributor) => {
310+
contributors.forEach((contributor) => {
310311
let contributor_data = {
311312
id: contributor["author"]["login"],
312313
data: [],
@@ -491,7 +492,7 @@ class Form extends React.Component {
491492
{this.state.nodes.length > 0 && !this.state.search_error && (
492493
<div className={styles.network_data}>
493494
<h4>User Followers Connections at 2 degrees</h4>
494-
<ResponsiveNetwork
495+
<ResponsiveNetworkCanvas
495496
nodes={this.state.nodes}
496497
links={this.state.links}
497498
margin={{ top: 0, right: 0, bottom: 0, left: 0 }}
@@ -554,9 +555,9 @@ class Form extends React.Component {
554555
{this.state.line_data.length > 0 && !this.state.search_error && (
555556
<div className={styles.repo_contributions}>
556557
<h4>User Contributions Over Time</h4>
557-
<ResponsiveLine
558+
<ResponsiveLineCanvas
558559
data={this.state.line_data}
559-
margin={{ top: 20, right: 20, bottom: 60, left: 80 }}
560+
margin={{ top: 20, right: 120, bottom: 60, left: 80 }}
560561
animate={true}
561562
xScale={{
562563
type: "time",
@@ -573,18 +574,20 @@ class Form extends React.Component {
573574
}}
574575
colors={{ scheme: "set1" }}
575576
axisLeft={{
576-
legend: "linear scale",
577-
legendOffset: 12,
577+
orient: "left",
578+
tickSize: 5,
579+
tickPadding: 5,
580+
tickRotation: 0,
581+
legend: "Lines of Code Additions",
582+
legendOffset: -45,
583+
legendPosition: "middle",
578584
}}
579585
axisBottom={{
580-
format: "%b %d",
581-
legend: "time scale",
586+
format: "%b %d %Y",
582587
legendOffset: -12,
583588
tickRotation: 90,
584589
}}
585-
legend="Date"
586590
curve={"monotoneX"}
587-
enablePointLabel={true}
588591
pointSize={16}
589592
pointBorderWidth={1}
590593
pointBorderColor={{
@@ -624,7 +627,7 @@ class Form extends React.Component {
624627
)}
625628
{this.state.search_error && (
626629
<div>
627-
<h4>Error in search, try again</h4>
630+
<h4>Error in search, try again.</h4>
628631
</div>
629632
)}
630633
</div>

0 commit comments

Comments
 (0)