Skip to content
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: count plots #100

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

feat: count plots #100

wants to merge 5 commits into from

Conversation

gtdang
Copy link
Member

@gtdang gtdang commented Dec 17, 2024

Added functions to generate:

  1. counts bar plots
  2. cumulative sum line plot
  3. combined bar plot and cumulative line plot

Notes:

  • Currently dummy data is being used--they are not the actual publication counts!
  • The plots are added to the bottom of the pubs page for review but will be on a separate page in the future.

@gtdang gtdang requested a review from eldu December 17, 2024 21:23
Copy link

github-actions bot commented Dec 17, 2024

Visit the preview URL for this PR (updated for commit 1cb857d):

https://ccv-pubs--pr100-counts-barplot-p7o1nv21.web.app

(expires Wed, 25 Dec 2024 18:42:56 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f75c16b3bdd7d81b7a0b7f8d3eed826b541e7a2a

@gtdang
Copy link
Member Author

gtdang commented Dec 17, 2024

@paulstey, Opinions on the plots? Want to see anything different?

Copy link

@s-bessey s-bessey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I wonder if there's a way to somehow note that the current-year numbers are incomplete? I know this is test data, but the "tiny current year bar" will still be true with real data.

Otherwise, looking good!

import React from 'react';
import { Vega } from 'react-vega';

const bar_color = '#00c398'; // ccv green

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe pull the colors to global styles?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these are being used in Vega, they might not be able to be pulled into the global styles list...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that is really annoying

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ vega ✨


function generateBarPlot({ data = {}, xLabel = '', yLabel = '' }) {
// Validate input JSON structure
if (!Array.isArray(data) || data.some((item) => !('label' in item && 'count' in item))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are users seeing if the plots throw errors?

Copy link
Contributor

@anna-murphy anna-murphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good George!! I'd love to include some screencaps in the PR if you have them handy, because I haven't run the code myself yet. It looks good though! How are you finding Vega so far?

Edit: I'm so sorry I just noticed that there's a preview link 🤦‍♀️ -- don't worry about those screencaps lol

import React from 'react';
import { Vega } from 'react-vega';

const bar_color = '#00c398'; // ccv green
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these are being used in Vega, they might not be able to be pulled into the global styles list...

src/components/BarChart.js Outdated Show resolved Hide resolved
@gtdang
Copy link
Member Author

gtdang commented Dec 18, 2024

Hmm... I wonder if there's a way to somehow note that the current-year numbers are incomplete? I know this is test data, but the "tiny current year bar" will still be true with real data.

Otherwise, looking good!

One option could be adding an * on the last year label. Then having a note elsewhere about it being incomplete.

@eldu
Copy link
Contributor

eldu commented Dec 20, 2024

That's good to me. For your next PR for the functions can you make it as a PR merging into this branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants