-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
base: master
Are you sure you want to change the base?
Scriptable value based option demo. 4am edition #5146
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
@@ -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]); |
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.
Hacky way to make it backwards compatible and be able to keep the existing int rounding rules.
Source/Extensions/Blazorise.Charts/ScriptableValueBasedOptionsConverter.cs
Outdated
Show resolved
Hide resolved
Source/Extensions/Blazorise.Charts/ScriptableValueBasedOptions.cs
Outdated
Show resolved
Hide resolved
@@ -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; }" |
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.
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.
Hey, thanks for the contribution. I still need to review it properly but it seems good from what I can see. |
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. |
My quickfix/workaround for being able to use a custom formatter for chart data labels.
See this discussion for more details.