fixing custom range options

This commit is contained in:
ppisljar 2016-12-16 15:32:04 +01:00
parent 3fbb3f7480
commit 644453de19
3 changed files with 17 additions and 10 deletions

View file

@ -116,7 +116,7 @@
type="number"
class="form-control"
name="range.from"
greater-than="{{getGreaterThan($index)}}"
greater-or-equal-than="{{getGreaterThan($index)}}"
step="any" />
</td>
<td>

View file

@ -8,6 +8,7 @@ function makeDirectiveDef(id, compare) {
const getBound = function () { return $parse($attr[id])(); };
const defaultVal = {
'greaterThan': -Infinity,
'greaterOrEqualThan': -Infinity,
'lessThan': Infinity
}[id];
@ -36,4 +37,7 @@ uiModules
}))
.directive('lessThan', makeDirectiveDef('lessThan', function (a, b) {
return a < b;
}))
.directive('greaterOrEqualThan', makeDirectiveDef('greaterOrEqualThan', function (a, b) {
return a >= b;
}));

View file

@ -47,14 +47,15 @@ export default function HeatmapChartFactory(Private) {
const zScale = this.getValueAxis().getScale();
const [min, max] = zScale.domain();
const labels = [];
for (let i = 0; i < colorsNumber; i++) {
let label;
if (cfg.get('setColorRange')) {
const from = colorsRange[i].from;
const to = colorsRange[i].to;
label = `${from} - ${to}`;
} else {
if (cfg.get('setColorRange')) {
colorsRange.forEach(range => {
const from = range.from;
const to = range.to;
labels.push(`${from} - ${to}`);
});
} else {
for (let i = 0; i < colorsNumber; i++) {
let label;
let val = i / colorsNumber;
let nextVal = (i + 1) / colorsNumber;
if (percentageMode) {
@ -70,9 +71,11 @@ export default function HeatmapChartFactory(Private) {
}
label = `${val} - ${nextVal}`;
}
labels.push(label);
}
labels.push(label);
}
return labels;
}