{"action":"created","issue":{"url":"https://api.github.com/repos/htmlwidgets/sparkline/issues/3","labels_url":"https://api.github.com/repos/htmlwidgets/sparkline/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/htmlwidgets/sparkline/issues/3/comments","events_url":"https://api.github.com/repos/htmlwidgets/sparkline/issues/3/events","html_url":"https://github.com/htmlwidgets/sparkline/issues/3","id":52778653,"number":3,"title":"rendering a dataTable using sparklines","user":{"login":"pssguy","id":2775918,"avatar_url":"https://avatars.githubusercontent.com/u/2775918?v=3","gravatar_id":"","url":"https://api.github.com/users/pssguy","html_url":"https://github.com/pssguy","followers_url":"https://api.github.com/users/pssguy/followers","following_url":"https://api.github.com/users/pssguy/following{/other_user}","gists_url":"https://api.github.com/users/pssguy/gists{/gist_id}","starred_url":"https://api.github.com/users/pssguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pssguy/subscriptions","organizations_url":"https://api.github.com/users/pssguy/orgs","repos_url":"https://api.github.com/users/pssguy/repos","events_url":"https://api.github.com/users/pssguy/events{/privacy}","received_events_url":"https://api.github.com/users/pssguy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2014-12-23T22:03:48Z","updated_at":"2015-07-10T14:43:14Z","closed_at":null,"body":"Thanks for this Ramnath. It is a great way to indicate information concisely\r\n\r\nWould it be possible to provide a more advanced example based on the table you provided\r\n\r\nI would like to show, say, soccer results by season in a table with two columns, one the season in question and the other a sparkline of results - with a tooltip showing data from another column of the source data.frame\r\n\r\n```r\r\ndf <- data.frame(season=rep(1992:1993,each=5), result = c(1,0,1,-1,0,0,1,1,0,-1), goals=c(2,0,1,0,3,0,2,3,1,0))\r\n\r\n\r\nexample sparkline for one season\r\nsparkline(df[df$season==1992,]$result,type='tristate',posBarColor=\"green\",negBarColor=\"red\", zeroBarColor=\"blue\"\r\n          ,highlightColor=\"orange\")\r\n```\r\n\r\nThis sparkline shows win,loss etc. which is good out of the box but it would be nice to have a tooltip that showed the goals instead. Guess, if possible, this is javascript for which I'd appreciate a hand\r\n"},"comment":{"url":"https://api.github.com/repos/htmlwidgets/sparkline/issues/comments/120426049","html_url":"https://github.com/htmlwidgets/sparkline/issues/3#issuecomment-120426049","issue_url":"https://api.github.com/repos/htmlwidgets/sparkline/issues/3","id":120426049,"user":{"login":"Alainafox","id":10172116,"avatar_url":"https://avatars.githubusercontent.com/u/10172116?v=3","gravatar_id":"","url":"https://api.github.com/users/Alainafox","html_url":"https://github.com/Alainafox","followers_url":"https://api.github.com/users/Alainafox/followers","following_url":"https://api.github.com/users/Alainafox/following{/other_user}","gists_url":"https://api.github.com/users/Alainafox/gists{/gist_id}","starred_url":"https://api.github.com/users/Alainafox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alainafox/subscriptions","organizations_url":"https://api.github.com/users/Alainafox/orgs","repos_url":"https://api.github.com/users/Alainafox/repos","events_url":"https://api.github.com/users/Alainafox/events{/privacy}","received_events_url":"https://api.github.com/users/Alainafox/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T14:43:14Z","updated_at":"2015-07-10T14:43:14Z","body":"Thinks for the example you give above, but I encounter some problems when running your code ,This is the code : \r\ndf <- data.frame(\r\n  season = rep(1992:1993, each=5), \r\n  result = c(1,0,1,-1,0,0,1,1,0,-1), \r\n  goals = c(2,0,1,0,3,0,2,3,1,0)\r\n)\r\n\r\nlibrary(dplyr)\r\nx = df %>%\r\n  group_by(season) %>%\r\n  summarize(\r\n    result = paste(result, collapse = \",\"),\r\n    goals = paste(goals, collapse = \",\")\r\n  )\r\n\r\nlibrary(sparkline)\r\nlibrary(DT)\r\ncolumnDefs = list(list(\r\n  targets = c(1, 2),\r\n  render = JS(\"function(data, type, full){\r\n    return '<span class=spark>' + data + '</span>'           \r\n  }\")\r\n))\r\n\r\nfnDrawCallback = JS(\"function (oSettings, json) {\r\n  $('.spark:not(:has(canvas))').sparkline('html', {\r\n    type: 'bar',\r\n    highlightColor: 'orange'\r\n  });\r\n}\")\r\n\r\nd1 <- datatable(x, options = list(\r\n  columnDefs = columnDefs,\r\n  fnDrawCallback = fnDrawCallback\r\n))\r\nd1$dependencies <- htmlwidgets:::getDependency('sparkline')\r\nd1\r\n\r\nbut it dose not show me a graph,so would you please help me with that? Thanks\r\n![snap1](https://cloud.githubusercontent.com/assets/10172116/8620854/e4301bc2-2754-11e5-84d1-eeb60ff174e9.png)\r\n\r\nmaybe it is because the version change of DT?"}}