-
Notifications
You must be signed in to change notification settings - Fork 103
Description
I'm using a heatmap, so the color of the label on each cell needs to vary based on the intensity. ApexCharts supports using a function OR a string value for a color, but Blazor-ApexCharts always passes the value as a string.
Here is some example data passed to the JS library:
"style": {
"colors": [
"function(opts) { return 'red'; }"
]
}
In the DataLabelsStyle class, here is the Colors list – which of type string with no converter. It should be able to support a function, but doesn't.
public class DataLabelsStyle
{
// Summary:
// Fore colors for the dataLabels. Accepts an array of string colors (['#333', '#999'])
// or an array of functions ([function(opts) { return '#333' }]) (Each index in
// the array corresponds to the series).
public List<string> Colors { get; set; }
}
In other places a function is created like this, but that only works when it's always going to be a function.
public class DataLabels
{
[JsonConverter(typeof(FunctionStringConverter))]
public string Formatter { get; set; }
}
Right now I'm going to just have to settle for a single color, but maybe FunctionStringConverter could be modified such that if the string begins with function (or whatever it needs to do to support lambdas) then it will become a function, then it could be added to the list of Colors. Or maybe a FunctionOrStringListConverter that just checks for StartsWith("function") to avoid being a potential breaking change.