Forum Discussion
AakashMarasini
2 years agoFrequent Visitor
Max Min Limit setup in custom visual
Hi Developers! I am building a custom visual and added the Max Area height for x axis. Now i want to set the min and max value to it. I have tried putting those values in capabilities.json file an...
- 2 years ago
I don't know if you already got it, but I managed to do it with something like this (in your settings.ts file):
import powerbi from "powerbi-visuals-api"; ... class MyMaxValidator implements powerbi.visuals.MaxValidator<number> { type: powerbi.visuals.ValidatorType.Max; value: number; constructor(max: number) { this.value = max; } } class MyMinValidator implements powerbi.visuals.MinValidator<number> { type: powerbi.visuals.ValidatorType.Min; value: number; constructor(min: number) { this.value = min; } } ... public maxAreaHeightX = new formattingSettings.Slider({ name: "maxAreaHeightX", displayName: "Max Area Height", value: 20, options: { maxValue: new MyMaxValidator(30), minValue: new MyMinValidator(10) } });
ewaghabi
2 years agoFrequent Visitor
I don't know if you already got it, but I managed to do it with something like this (in your settings.ts file):
import powerbi from "powerbi-visuals-api";
...
class MyMaxValidator implements powerbi.visuals.MaxValidator<number> {
type: powerbi.visuals.ValidatorType.Max;
value: number;
constructor(max: number) {
this.value = max;
}
}
class MyMinValidator implements powerbi.visuals.MinValidator<number> {
type: powerbi.visuals.ValidatorType.Min;
value: number;
constructor(min: number) {
this.value = min;
}
}
...
public maxAreaHeightX = new formattingSettings.Slider({
name: "maxAreaHeightX",
displayName: "Max Area Height",
value: 20,
options: { maxValue: new MyMaxValidator(30), minValue: new MyMinValidator(10) }
});