{"action":"created","issue":{"url":"https://api.github.com/repos/simeydotme/jQuery-ui-Slider-Pips/issues/79","labels_url":"https://api.github.com/repos/simeydotme/jQuery-ui-Slider-Pips/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/simeydotme/jQuery-ui-Slider-Pips/issues/79/comments","events_url":"https://api.github.com/repos/simeydotme/jQuery-ui-Slider-Pips/issues/79/events","html_url":"https://github.com/simeydotme/jQuery-ui-Slider-Pips/issues/79","id":117234953,"number":79,"title":"Irregularly-spaced pips","user":{"login":"alpha-beta-soup","id":5925045,"avatar_url":"https://avatars.githubusercontent.com/u/5925045?v=3","gravatar_id":"","url":"https://api.github.com/users/alpha-beta-soup","html_url":"https://github.com/alpha-beta-soup","followers_url":"https://api.github.com/users/alpha-beta-soup/followers","following_url":"https://api.github.com/users/alpha-beta-soup/following{/other_user}","gists_url":"https://api.github.com/users/alpha-beta-soup/gists{/gist_id}","starred_url":"https://api.github.com/users/alpha-beta-soup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpha-beta-soup/subscriptions","organizations_url":"https://api.github.com/users/alpha-beta-soup/orgs","repos_url":"https://api.github.com/users/alpha-beta-soup/repos","events_url":"https://api.github.com/users/alpha-beta-soup/events{/privacy}","received_events_url":"https://api.github.com/users/alpha-beta-soup/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-16T22:37:39Z","updated_at":"2015-11-17T03:40:09Z","closed_at":"2015-11-17T03:40:09Z","body":"My use case: I want a slider allowing a user to select a point in time for which data can be presented on a map (a forecast). The time steps from `t=0` into the future are not required to be regularly-spaced: it may be that there are forecasts every hour for 24 hours, and then only two per day out to 7 days. In reality, the steps can be arbitrary, so I can't rely on any pattern. I would like to display a slider with pips spaced appropriately: a regular spacing would not indicate the irregular nature of the forecasts across time. Perhaps passing pips as a list of proportions, `[0, 0.05, 0.1, 0.15, 0.2, 0.4, 0.6, 1]`, indicating where they should be placed along the slider. Is this functionality currently provided? I couldn't find anything in the documentation to suggest it is, as pips always seem to require a single multiplicative step."},"comment":{"url":"https://api.github.com/repos/simeydotme/jQuery-ui-Slider-Pips/issues/comments/157258816","html_url":"https://github.com/simeydotme/jQuery-ui-Slider-Pips/issues/79#issuecomment-157258816","issue_url":"https://api.github.com/repos/simeydotme/jQuery-ui-Slider-Pips/issues/79","id":157258816,"user":{"login":"alpha-beta-soup","id":5925045,"avatar_url":"https://avatars.githubusercontent.com/u/5925045?v=3","gravatar_id":"","url":"https://api.github.com/users/alpha-beta-soup","html_url":"https://github.com/alpha-beta-soup","followers_url":"https://api.github.com/users/alpha-beta-soup/followers","following_url":"https://api.github.com/users/alpha-beta-soup/following{/other_user}","gists_url":"https://api.github.com/users/alpha-beta-soup/gists{/gist_id}","starred_url":"https://api.github.com/users/alpha-beta-soup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpha-beta-soup/subscriptions","organizations_url":"https://api.github.com/users/alpha-beta-soup/orgs","repos_url":"https://api.github.com/users/alpha-beta-soup/repos","events_url":"https://api.github.com/users/alpha-beta-soup/events{/privacy}","received_events_url":"https://api.github.com/users/alpha-beta-soup/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T03:40:09Z","updated_at":"2015-11-17T03:40:09Z","body":"Actually the slider has irregular intervals as well. Imagine that there are forecasts available for now, in three hours, in six hours, in a day, in two days, in four days, and in seven days. That is what I mean by an irregular interval. Visually, something like this:\r\n\r\n![screenshot from 2015-11-17 15 58 04](https://cloud.githubusercontent.com/assets/5925045/11201582/3437d9ca-8d44-11e5-97d1-4cbcb94c2cb9.png)\r\n\r\nThere is a continuum of possible values, but because the duration of time between available forecasts is not constant, I do not want to present them as a regular interval, nor allow users to select an intermediate point on the slider.\r\n\r\nYour example has been very helpful for me (reasonably new to web development):\r\n\r\n![screenshot from 2015-11-17 16 31 47](https://cloud.githubusercontent.com/assets/5925045/11202044/cb12e57a-8d48-11e5-977a-808c7329b6e4.png)\r\n\r\nI'll post a complete snippet from my coffeescript code in case it helps anyone else. Let me know if you'd like this added to any documentation, I can make a PR as thanks.\r\n\r\n```coffeescript\r\nmake_slider = (values, step, slider_class, slider_id) ->\r\n    s = $(\".#{slider_class}\")\r\n    .slider\r\n      min: Math.min.apply(Math, values)\r\n      max: Math.max.apply(Math, values)\r\n      step: if step? then step else 10800 # Smallest step present in values\r\n    .slider \"pips\",\r\n      first: 'label'\r\n      last: 'pip'\r\n      rest: 'pip'\r\n      labels: moment.unix(t).fromNow() for t in values\r\n    $pips = $(\".#{slider_class}\").find(\".ui-slider-pip\") # Hold all the pips for filtering\r\n    $pips.filter(\".ui-slider-pip-#{val}\").show() for val in values\r\n```\r\n\r\nWhich compiles to:\r\n\r\n```javascript\r\nmake_global_slider = function(values, step, slider_class, slider_id) {\r\n    var $pips, j, len, results, s, t, val;\r\n    s = $(\".\" + slider_class).slider({\r\n      min: Math.min.apply(Math, values),\r\n      max: Math.max.apply(Math, values),\r\n      step: step != null ? step : 10800\r\n    }).slider(\"pips\", {\r\n      first: 'label',\r\n      last: 'pip',\r\n      rest: 'pip',\r\n      labels: (function() {\r\n        var j, len, results;\r\n        results = [];\r\n        for (j = 0, len = values.length; j < len; j++) {\r\n          t = values[j];\r\n          results.push(moment.unix(t).fromNow());\r\n        }\r\n        return results;\r\n      })()\r\n    });\r\n    $pips = $(\".\" + slider_class).find(\".ui-slider-pip\");\r\n    results = [];\r\n    for (j = 0, len = values.length; j < len; j++) {\r\n      val = values[j];\r\n      results.push($pips.filter(\".ui-slider-pip-\" + val).show());\r\n    }\r\n    return results;\r\n  };\r\n```\r\n"}}