{"action":"created","issue":{"url":"https://api.github.com/repos/datastorm-open/visNetwork/issues/103","repository_url":"https://api.github.com/repos/datastorm-open/visNetwork","labels_url":"https://api.github.com/repos/datastorm-open/visNetwork/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/datastorm-open/visNetwork/issues/103/comments","events_url":"https://api.github.com/repos/datastorm-open/visNetwork/issues/103/events","html_url":"https://github.com/datastorm-open/visNetwork/issues/103","id":182726833,"number":103,"title":"Any example of scaling.customScalingFunction?","user":{"login":"lordbitin","id":7083752,"avatar_url":"https://avatars.githubusercontent.com/u/7083752?v=3","gravatar_id":"","url":"https://api.github.com/users/lordbitin","html_url":"https://github.com/lordbitin","followers_url":"https://api.github.com/users/lordbitin/followers","following_url":"https://api.github.com/users/lordbitin/following{/other_user}","gists_url":"https://api.github.com/users/lordbitin/gists{/gist_id}","starred_url":"https://api.github.com/users/lordbitin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lordbitin/subscriptions","organizations_url":"https://api.github.com/users/lordbitin/orgs","repos_url":"https://api.github.com/users/lordbitin/repos","events_url":"https://api.github.com/users/lordbitin/events{/privacy}","received_events_url":"https://api.github.com/users/lordbitin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-13T08:32:27Z","updated_at":"2016-10-13T21:35:33Z","closed_at":null,"body":"Hi,\r\n\r\nIs there any example of how to use the attribute \"customScalingFunction\" from the property \"scaling\" ?\r\n\r\nThanks in advance!"},"comment":{"url":"https://api.github.com/repos/datastorm-open/visNetwork/issues/comments/253645878","html_url":"https://github.com/datastorm-open/visNetwork/issues/103#issuecomment-253645878","issue_url":"https://api.github.com/repos/datastorm-open/visNetwork/issues/103","id":253645878,"user":{"login":"bthieurmel","id":8750326,"avatar_url":"https://avatars.githubusercontent.com/u/8750326?v=3","gravatar_id":"","url":"https://api.github.com/users/bthieurmel","html_url":"https://github.com/bthieurmel","followers_url":"https://api.github.com/users/bthieurmel/followers","following_url":"https://api.github.com/users/bthieurmel/following{/other_user}","gists_url":"https://api.github.com/users/bthieurmel/gists{/gist_id}","starred_url":"https://api.github.com/users/bthieurmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bthieurmel/subscriptions","organizations_url":"https://api.github.com/users/bthieurmel/orgs","repos_url":"https://api.github.com/users/bthieurmel/repos","events_url":"https://api.github.com/users/bthieurmel/events{/privacy}","received_events_url":"https://api.github.com/users/bthieurmel/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T21:35:33Z","updated_at":"2016-10-13T21:35:33Z","body":"First you can have a look to ``visDocumentation``. And this is the default function, pass in R : \r\n\r\n````\r\nnodes <- data.frame(id = 1:3, label = c(\"A\", \"B\", \"A\"), size = c(10,20,30))\r\nedges <- data.frame(from = c(1,2), to = c(1,3))\r\n\r\nvisNetwork(nodes, edges) %>%\r\n  visNodes(scaling = list(customScalingFunction = 'function (min,max,total,value) {\r\n    if (max === min) {\r\n      return 0.5;\r\n    }\r\n    else {\r\n      var scale = 1 / (max - min);\r\n      return Math.max(0,(value - min)*scale);\r\n    }\r\n  }'))\r\n````"}}
{"actor":{"display_login":"bthieurmel"}}