# Encouraging User Participation - Some Ideas, More welcome

**URL:** https://meta.discourse.org/t/encouraging-user-participation-some-ideas-more-welcome/42511
**Category:** Community Building
**Created:** [13 april 2016 om 16:37 UTC](https://meta.discourse.org/t/encouraging-user-participation-some-ideas-more-welcome/42511 "2016-04-13T16:37:23Z")
**Posts on this page:** 1
**Showing post:** 75

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [8 mei 2016 om 02:42 UTC](https://meta.discourse.org/t/encouraging-user-participation-some-ideas-more-welcome/42511/75 "2016-05-08T02:42:44Z")

</div>

> [@mcwumbly](#):
>
> These screenshots do make me want a “per week” drop down to smooth them out a bit though… 🙂

Played around a little with smoothing today, in case anyone wants to explore further:

 ![](https://global.discourse-cdn.com/meta/original/3X/2/e/2ee623d407d0dfbc7f0e7f4c62ca89c0a074e20a.png)

```javascript
    var smooth = function(data, windowSize) {
      var smoothed = [];
      var movingWindow = [];

      for(var i = 0; i < windowSize; i++) {
        movingWindow.push(data[i]);
      }

      for(var i = 0; i < data.length; i++) {
        movingWindow.push(data[i]);
        movingWindow.shift();
        smoothed.push(movingWindow.reduce((a, v) => a + v, 0) / windowSize);
      }
      return smoothed;
    }

    var samples = rawData.map(r => r.y);

    var data = {
      labels: rawData.map(r => r.x),
      datasets: [{
        data: samples,
        label: model.get('title'),
        backgroundColor: "rgba(200,220,240,0.3)",
        borderColor: "#08C"
      },{
        data: smooth(samples, 7),
        label: '7 Day Moving Average',
        backgroundColor: "rgba(0,0,0,0)",
        borderColor: "#C80"
      }]
    };

```

---

_[View the full topic](https://meta.discourse.org/t/encouraging-user-participation-some-ideas-more-welcome/42511)._
