Skip to content

Commit 7119fb3

Browse files
committed
Merge branch 'master' of
https://github.com/jdbranham/grafana-diagram.git Conflicts: dist/diagramControl.js.map
2 parents 72520fc + 4fde4b2 commit 7119fb3

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

dist/diagramControl.js

+8-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/diagramControl.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"lint": "eslint --color .",
88
"test": "grunt",
9+
"preinstall": "npm install -g bower",
910
"postinstall": "bower install",
1011
"build": "grunt"
1112
},
@@ -50,6 +51,6 @@
5051
"sass": "^1.0.0-beta.3"
5152
},
5253
"dependencies": {
53-
"lodash": "~4.0.0"
54+
"lodash": "^4.17.11"
5455
}
5556
}

src/diagramControl.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const panelDefaults = {
3737
mappingType: 1,
3838
maxWidth: false,
3939
nullPointMode: 'connected',
40+
moddedSeriesVal: 0,
4041
format: 'none',
4142
valueName: 'avg',
4243
valueOptions: ['avg', 'min', 'max', 'total', 'current'],
@@ -451,6 +452,9 @@ class DiagramCtrl extends MetricsPanelCtrl {
451452
for (var j = 0; j < aComposite.metrics.length; j++) {
452453
var aMetric = aComposite.metrics[j];
453454
var seriesName = aMetric.seriesName;
455+
// For testing
456+
console.debug("aMetric value: " + seriesItem.valueFormatted);
457+
console.debug("aMetric: " + seriesName);
454458
// make sure we have a match
455459
if (!data.hasOwnProperty(seriesName)) continue;
456460
var seriesItem = data[seriesName];
@@ -671,11 +675,11 @@ class DiagramCtrl extends MetricsPanelCtrl {
671675

672676
for (var key in data) {
673677
var seriesItem = data[key];
674-
678+
675679
// Find nodes by ID if we can
676680
//console.info('finding targetElement');
677681
var targetElement = d3.select(svg[0].getElementById(key)); // $(svg).find('#'+key).first(); // jquery doesnt work for some ID expressions [prometheus data]
678-
682+
console.debug("Series item: " + seriesItem.valueFormated);
679683
if (targetElement[0][0] !== null) { // probably a flowchart
680684
targetElement.selectAll('rect,circle,polygon').style('fill', seriesItem.color);
681685

@@ -750,7 +754,9 @@ function getColorForValue(data, value) {
750754
console.debug(value);
751755
for (var i = data.thresholds.length; i > 0; i--) {
752756
if (value >= data.thresholds[i - 1]) {
753-
return data.colorMap[i];
757+
console.debug('Color['+(i-1)+']: ' + data.colorMap[i]);
758+
return data.colorMap[i-1];
759+
//return data.colorMap[i];
754760
}
755761
}
756762
return _.first(data.colorMap);

0 commit comments

Comments
 (0)