diff --git a/lib/riemann/dash/public/views/timeseries.js b/lib/riemann/dash/public/views/timeseries.js index 30b6ce1..cef8337 100644 --- a/lib/riemann/dash/public/views/timeseries.js +++ b/lib/riemann/dash/public/views/timeseries.js @@ -8,7 +8,10 @@ var TimeSeriesView = function(json) { var self = this; - self.smoothie = new SmoothieChart(); + self.smoothie = new SmoothieChart({ + grid: {strokeStyle:'#ccc', fillStyle:'rgba(255, 255, 255, 0.0)', lineWidth: 1, millisPerLine: 1000}, + labels: { fillStyle:'#262626' } + }); var seriesCollection = {}; @@ -16,7 +19,6 @@ return series.append(new Date(event.time).getTime(), format.float(event.metric)); }; - var colorTemplate = _.template("hsla(<%=hue%>,<%=saturation%>%,<%=lightness%>%,<%=alpha%>)"); var HSLfromString = function(s) { @@ -39,7 +41,17 @@ var sat = Math.abs(sum) % 101; var lum = Math.abs(sum) % 101; - lum = (lum > 50) ? lum : lum+50; + while (sat < 35) { + sat += 10; + } + + while (lum > 85) { + lum -= 10; + } + + while (lum < 35) { + lum += 10; + } return [hue, sat, lum]; }; @@ -58,19 +70,20 @@ var seriesName = nameFor(event); var seriesColor = HSLfromString(seriesName); var series = new TimeSeries(); - series.append = _.throttle(series.append, 750); + series.append = _.throttle(series.append, 750); - self.smoothie.addTimeSeries(series, {lineWidth: self.lineWidth || 2, - strokeStyle: colorStringFromHSL(seriesColor) - }); + var seriesOpts = {lineWidth: self.lineWidth || 2, + strokeStyle: colorStringFromHSL(seriesColor), + fillStyle: colorStringFromHSL(seriesColor, 0.1)}; + self.smoothie.addTimeSeries(series, seriesOpts); return series; }; var intoSeries = function(event) { var seriesName = nameFor(event) - var cachedSeries = seriesCollection[seriesName]; + if (cachedSeries) { return appendEvent(cachedSeries, event); } else { @@ -88,7 +101,7 @@ this.clickFocusable = true; this.el.addClass('timeseries'); this.el.append( - '