diff --git a/static/scripts/grapher.js b/static/scripts/grapher.js index 28f00f8..8425389 100644 --- a/static/scripts/grapher.js +++ b/static/scripts/grapher.js @@ -298,14 +298,15 @@ function updateMode() { if (_.has(_elements, 'mode')) { - - + _elements.mode.attr({ + text: _data.mode + }); } else { _elements.mode = _canvas.text( (_width - _bracketSize) / 2, _height - _modeSize / 2, - 'x' + _data.mode ).attr({ 'dominant-baseline': 'middle', 'text-anchor': 'middle' diff --git a/util.go b/util.go index a3146b5..a837d09 100644 --- a/util.go +++ b/util.go @@ -39,7 +39,7 @@ func fixFeatures(features featureMap) featureMap { "affordable": 0.0, "atmospheric": 0.0} - for name, _ := range fixedFeatures { + for name := range fixedFeatures { value, _ := features[name] fixedFeatures[name] = value } @@ -48,13 +48,20 @@ func fixFeatures(features featureMap) featureMap { } func fixModes(modes map[string]string) modeMap { - result := make(modeMap) + fixedModes := modeMap{ + "nearby": ModeTypeProduct, + "accessible": ModeTypeProduct, + "delicious": ModeTypeProduct, + "accommodating": ModeTypeProduct, + "affordable": ModeTypeProduct, + "atmospheric": ModeTypeProduct} - for name, value := range modes { - result[name] = strToModeType(value) + for name := range fixedModes { + value, _ := modes[name] + fixedModes[name] = strToModeType(value) } - return result + return fixedModes } func innerProduct(features1 featureMap, features2 featureMap) float64 {