table panel: additional fixes for value to text mapping

Make the value to text mapping more similar to singlestat solution.
Adds more tests.
Also, allows string to be mapped to other string besides numeric values.
This commit is contained in:
Marcus Efraimsson
2018-03-27 19:04:45 +02:00
parent 67f0382222
commit f673ec16d1
4 changed files with 211 additions and 88 deletions

View File

@@ -113,29 +113,30 @@ export class ColumnOptionsCtrl {
this.render();
};
}
addValueMapping(style) {
if (!style.valueMappings) {
style.valueMappings = [];
addValueMap(style) {
if (!style.valueMaps) {
style.valueMaps = [];
}
style.valueMappings.push({ value: '', text: '' });
style.valueMaps.push({ value: '', text: '' });
this.panelCtrl.render();
}
removeValueMapping(style, index) {
style.valueMappings.splice(index, 1);
removeValueMap(style, index) {
style.valueMaps.splice(index, 1);
this.panelCtrl.render();
}
removeRangeMapping(style, index) {
style.rangeMappings.splice(index, 1);
this.panelCtrl.render();
}
addRangeMapping(style) {
if (!style.rangeMappings) {
style.rangeMappings = [];
addRangeMap(style) {
if (!style.rangeMaps) {
style.rangeMaps = [];
}
style.rangeMappings.push({ from: '', to: '', text: '' });
style.rangeMaps.push({ from: '', to: '', text: '' });
this.panelCtrl.render();
}
removeRangeMap(style, index) {
style.rangeMaps.splice(index, 1);
this.panelCtrl.render();
}
}