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

188616847 stroke point plot background color import/export V2 #1802

Merged
merged 10 commits into from
Feb 13, 2025

Conversation

eireland
Copy link
Contributor

Adds import from V2 and export to V2 for graph:

  • point color and transparency
  • stroke color and transparency
  • plot background color and transparency

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 88.63636% with 5 lines in your changes missing coverage. Please review.

Project coverage is 85.81%. Comparing base (b2bc4b2) to head (ca7a334).
Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
...src/components/graph/models/graph-content-model.ts 0.00% 2 Missing ⚠️
v3/src/utilities/color-utils.ts 88.23% 2 Missing ⚠️
v3/src/components/graph/v2-graph-importer.ts 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1802      +/-   ##
==========================================
+ Coverage   84.66%   85.81%   +1.15%     
==========================================
  Files         633      633              
  Lines       32585    32621      +36     
  Branches     8507     9151     +644     
==========================================
+ Hits        27587    27994     +407     
+ Misses       4842     4288     -554     
- Partials      156      339     +183     
Flag Coverage Δ
cypress 73.24% <39.02%> (+2.60%) ⬆️
jest 55.28% <88.63%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cypress bot commented Feb 11, 2025

codap-v3    Run #6308

Run Properties:  status check passed Passed #6308  •  git commit 674ffcc31b: Increment the build number
Project codap-v3
Branch Review main
Run status status check passed Passed #6308
Run duration 01m 47s
Commit git commit 674ffcc31b: Increment the build number
Committer eireland
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 3
View all changes introduced in this branch ↗︎

@eireland eireland marked this pull request as ready for review February 11, 2025 22:35
@eireland eireland requested a review from kswenson February 11, 2025 22:35
Copy link
Member

@kswenson kswenson left a comment

Choose a reason for hiding this comment

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

👍 LGTM -- I added a commit which tweaked some of the types and moved some of the graph-specific logic from color-utils to v2-graph-exporter. Note the remaining comments/questions.

? 0.4 : getTransparency(graph.pointDescription.pointStrokeColor, "stroke"),
pointSizeMultiplier: graph.pointDescription.pointSizeMultiplier,
strokeSameAsFill: graph.pointDescription.pointStrokeSameAsFill,
plotBackgroundColor: graph.plotBackgroundColor === "#FFFFFF"
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to worry about other variations (e.g. #ffffff or white?) or is this string canonicalized to this format?

@@ -230,13 +232,39 @@ function getPlotModels(graph: IGraphContentModel): Partial<ICodapV2GraphStorage>
return storage
}

const getTransparency = (color: string, type: "point" | "stroke") => {
const rgbaColor = colord(color).toRgb()
return rgbaColor.a ?? (type === "point" ? 0.84 : 1)
Copy link
Member

Choose a reason for hiding this comment

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

I moved this function here because it contains graph-specific logic rather than something appropriate to all clients of color-utils. That said, in practice it doesn't matter because toRgb() is documented to always return an alpha, so the ?? (type === "point" ? 0.84 : 1) will never have any effect. If there are some circumstances in which 0.84 should be returned, then the logic will need to be clarified.

@kswenson kswenson added v3 CODAP v3 and removed v2 CODAP v2 labels Feb 12, 2025
@eireland
Copy link
Contributor Author

@kswenson I tweaked the code based on your comments.

@eireland eireland merged commit fc322b0 into main Feb 13, 2025
21 checks passed
@eireland eireland deleted the 188616847-stroke-point-color branch February 13, 2025 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants