-
Notifications
You must be signed in to change notification settings - Fork 928
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
Arbitrary chart variable assignment by @gotkaren's PR714 #1673
Conversation
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #1673 +/- ##
=======================================
Coverage 81.69% 81.69%
=======================================
Files 18 18
Lines 1393 1393
Branches 271 271
=======================================
Hits 1138 1138
Misses 209 209
Partials 46 46 ☔ View full report in Codecov by Sentry. |
backgroundColor: convertColorOpacity(s.Color), | ||
data: [], | ||
}; | ||
for (var property in s){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be const
instead of var
.
for (var property in s){ | ||
new_series[property] = s[property]; | ||
} | ||
new_series["backgroundColor"] = convertColorOpacity(s.Color) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has already been specified in L31.
@catherinedevlin I tried to edit your branch to apply my comments, but it appears that I am not able to push to the main branch of a fork. I will reopen your PR in a new PR instead. |
Superseded by #1685. |
Original work: projectmesa#714 and projectmesa#1673. Co-Authored-By: Catherine Devlin <devlinch@corning.com>
Original work: projectmesa#714 and projectmesa#1673. Co-Authored-By: Catherine Devlin <devlinch@corning.com>
Original work: projectmesa#714 and projectmesa#1673. Co-Authored-By: Catherine Devlin <devlinch@corning.com>
Original work: projectmesa#714 and projectmesa#1673. Co-authored-by: Karen Gonzalez <karenyglez.tr@gmail.com> Co-authored-by: rht <rhtbot@protonmail.com>
Supports passing arbitrary chart variables to the Chart Module.
Supersedes #714 by @gotkaren. I apologize that I wasn't able to preserve any of her commits, but there have been too many changes since then and I wasn't able to unsnarl git.
I don't know if we have a way to test JavaScript, but I informally tried some examples mesa-examples; they didn't break, and I was able to change chart visual parameters. For instance, changed https://github.com/projectmesa/mesa-examples/blob/68c8e87c8e9b0eed5cf87419bcec4de5839ff5a1/examples/forest_fire/forest_fire/server.py#L23 to
[{"Label": label, "Color": color, "borderWidth": 10, "pointRadius": 10} for (label, color) in COLORS.items()]
and got the desired effect.
I didn't make any changes to the docs - as far as I can see, they already imply that you ought to be able to submit arbitrary parameters to a chart, so this PR just brings the code into sync with the docs.