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

Scriptable value based option demo. 4am edition #5146

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Eltee-Taiwo
Copy link

@Eltee-Taiwo Eltee-Taiwo commented Nov 14, 2023

My quickfix/workaround for being able to use a custom formatter for chart data labels.

See this discussion for more details.

Copy link
Contributor

github-actions bot commented Nov 14, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@Eltee-Taiwo
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@Eltee-Taiwo
Copy link
Author

recheck

github-actions bot added a commit that referenced this pull request Nov 14, 2023
@@ -52,7 +52,12 @@ function compileDatasetsOptionsCallbacks(options) {

Object.keys(options).forEach(function (key) {
if (options[key] && options[key].startsWith("function")) {
options[key] = parseFunction(options[key]);
if (key === 'scriptableFormatter') {
options['formatter'] = parseFunction(options[key]);
Copy link
Author

Choose a reason for hiding this comment

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

Hacky way to make it backwards compatible and be able to keep the existing int rounding rules.

@Eltee-Taiwo Eltee-Taiwo changed the title [WIP] Scriptable value based option demo. 4am edition Scriptable value based option demo. 4am edition Nov 15, 2023
@@ -182,7 +182,8 @@ public partial class ChartsDataLabelsPage
BackgroundColor = BackgroundColors[2],
BorderColor = BorderColors[2],
Align = "center",
Anchor = "center"
Anchor = "center",
SoftCodeFormatter = "function(value, context) { return \"$\" + value; }"
Copy link
Author

Choose a reason for hiding this comment

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

I tried using the scriptableOption method but using this method allows us to soft code the formatter logic and make it as complex as we want.

@stsrki
Copy link
Collaborator

stsrki commented Nov 15, 2023

Hey, thanks for the contribution. I still need to review it properly but it seems good from what I can see.

@stsrki
Copy link
Collaborator

stsrki commented Jan 3, 2024

The feature is planned for 1.5. The review is still on hold as I have more ideas and changes to make it more flexible.

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.

None yet

2 participants