-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add a PR activity chart #19
Conversation
❌ Deploy Preview for contributor-info failed.
|
So far have this providing the data I think I need. Going to start exploring adding this to a nivo line chart next. example json for http://localhost:3000/open-sauced/app |
I figured it out. When looking at the data in this example, I saw I needed to provide an array or lines. Sorry for the ping but thanks for reading @open-sauced/engineering |
For the const ChildWithSWR = (props: { owner: string; repo: string }) => {
const { owner, repo } = props;
const { data, error, mutate } = useSWR<PaginatedDataResponse, Error>(`prs/search?repo=${owner}%2F${repo}`);
if (!data) {
return <>Loading...</>;
}
const chartData = prCounts(data);
return (
<>
- data && <CIResponsiveLine data={chartData.prsPerDay} />
+ { data && <CIResponsiveLine data={chartData.prsPerDay} /> }
</>
);
}; That'll get rid of the I know it's a WIP, but I adjusted the height for the responsive line to 400, and it looks less squished. |
Also, to get rid of your TypeScript errors here in the responsive line. And you'll just need to ensure that the data matches the shape expected of From the Nivo types: export interface Serie {
id: string | number
data: Datum[]
[key: string]: any
} + import { ResponsiveLine, Serie } from "@nivo/line";
interface CIResponsiveLineProps {
- data?: CIResponsiveLinePropseDatum[];
+ data: Serie[];
}
const CIResponsiveLine = ({ data }: CIResponsiveLineProps) => {
return (
<>
<div style={{ height: 200 }}>
<ResponsiveLine
data={data}
margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
xScale={{ type: "point" }}
yScale={{
type: "linear",
min: "auto",
max: "auto",
stacked: true,
reverse: false,
}}
yFormat=" >-.2f"
axisTop={null}
axisRight={null}
axisBottom={{
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: "transportation",
legendOffset: 36,
legendPosition: "middle",
}}
axisLeft={{
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: "count",
legendOffset: -40,
legendPosition: "middle",
}}
pointSize={10}
pointColor={{ theme: "background" }}
pointBorderWidth={2}
pointBorderColor={{ from: "serieColor" }}
pointLabelYOffset={-12}
useMesh={true}
legends={[
{
anchor: "bottom-right",
direction: "column",
justify: false,
translateX: 100,
translateY: 0,
itemsSpacing: 0,
itemDirection: "left-to-right",
itemWidth: 80,
itemHeight: 20,
itemOpacity: 0.75,
symbolSize: 12,
symbolShape: "circle",
symbolBorderColor: "rgba(0, 0, 0, .5)",
effects: [
{
on: "hover",
style: {
itemBackground: "rgba(0, 0, 0, .03)",
itemOpacity: 1,
},
},
],
},
]}
/>
</div>
</>
);
};
export default CIResponsiveLine; |
Moving this to ready for review while I fix the build errors. Going to do styling of the chart and other elements in a later PR. |
Merging in preparation for #20 This will break beta for a bit. |
## [1.2.0-beta.1](v1.1.0...v1.2.0-beta.1) (2024-01-05) ### 🍕 Features * Add a PR activity chart ([#19](#19)) ([9bac59a](9bac59a)) * spice up contributors pr chart styles ([#20](#20)) ([bdf937f](bdf937f)) * use v2 pr/search ([#16](#16)) ([f1f78ff](f1f78ff)) * Working Nivo chart ([#22](#22)) ([22c07a9](22c07a9))
Description
This PR adds a lib file to count PRs merged and closed. This is to be displayed in a chart.
What type of PR is this? (check all applicable)
Related Tickets & Documents
fixes #18
Mobile & Desktop Screenshots/Recordings
Steps to QA
Added to documentation?
[optional] Are there any post-deployment tasks we need to perform?
[optional] What gif best describes this PR or how it makes you feel?