Skip to content

Commit

Permalink
Package rename
Browse files Browse the repository at this point in the history
trying to combine all effort into a single package
  • Loading branch information
adymimos committed Feb 16, 2015
1 parent a2e0089 commit 34312c3
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 45 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
@@ -1,10 +1,9 @@
Package: solrCloud
Package: rWordCloud
Title: d3 word Cloud htmlwidget
Version: 0.1
Authors@R: c(person("Adline", "Dsilva", role = c("cre", "aut"), email = "adline.dsilva@mimos.my"),
person("Jeff", "Heer", role = "aut"))
Authors@R: c(person("Adline", "Dsilva", role = c("cre", "aut"), email = "adline.dsilva@mimos.my"))
Description: htmlwidget package for word cloud using solr
http://bl.ocks.org/mbostock/4063269.
.
Depends:
R (>= 3.0)
Imports:
Expand Down
6 changes: 3 additions & 3 deletions NAMESPACE
@@ -1,6 +1,6 @@
# Generated by roxygen2 (4.1.0): do not edit by hand

export(solrCloud)
export(solrCloudOutput)
export(rendersolrCloud)
export(d3TextCloud)
export(d3TextCloudOutput)
export(renderd3TextCloud)
import(htmlwidgets)
5 changes: 5 additions & 0 deletions R/d3TextCloud-package.r
@@ -0,0 +1,5 @@
#' d3TextCloud.
#'
#' @name d3TextCloud
#' @docType package
NULL
14 changes: 7 additions & 7 deletions R/solrCloud.r → R/d3TextCloud.r
@@ -1,4 +1,4 @@
solrCloud <- function(content, label, tooltip = "", color = "#EEEEEE",
d3TextCloud <- function(content, label, tooltip = "", color = "#EEEEEE",
textColor = "#333333", width = NULL, height = NULL) {

# forward options using x
Expand All @@ -12,11 +12,11 @@ solrCloud <- function(content, label, tooltip = "", color = "#EEEEEE",

# create widget
htmlwidgets::createWidget(
name = 'solrCloud',
name = 'd3TextCloud',
x,
width = width,
height = height,
package = 'solrCloud',
package = 'rWordCloud',
sizingPolicy = sizingPolicy(
defaultWidth = 600,
defaultHeight = 600
Expand All @@ -25,11 +25,11 @@ solrCloud <- function(content, label, tooltip = "", color = "#EEEEEE",
}


solrCloudOutput <- function(outputId, width = '600px', height = '600px'){
shinyWidgetOutput(outputId, 'solrCloud', width, height, package = 'solrCloud')
d3TextCloudOutput <- function(outputId, width = '600px', height = '600px'){
shinyWidgetOutput(outputId, 'd3TextCloud', width, height, package = 'rWordCloud')
}

rendersolrCloud <- function(expr, env = parent.frame(), quoted = FALSE) {
renderd3TextCloud <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
shinyRenderWidget(expr, solrCloudOutput, env, quoted = TRUE)
shinyRenderWidget(expr, d3TextCloudOutput, env, quoted = TRUE)
}
5 changes: 0 additions & 5 deletions R/solrCloud-package.r

This file was deleted.

24 changes: 9 additions & 15 deletions README.md
@@ -1,34 +1,28 @@
# d3.js word cloud htmlwidget for R

# solrCloud

This is just an experimentation of https://github.com/ywng/Progressive-News-Cloud app ( this app no longer works, but i used its component )



word count is performed by javascript which tends to make it slow. For simpler implementation checkout d3cloud branch
rWordCloud - An htmlwidget interface to D3 word cloud

to install
```
require(devtools)
install_github('adymimos/solrCloud')
install_github('adymimos/rWordCloud')
```


```server.R
library(solrCloud)
library(rWordCloud)
function(input, output, session) {
output$solrCloud <- rendersolrCloud({
output$d3TextCloud <- renderd3TextCloud({
content <- c('test test1 test2 hi ho hurray hi hurray ho ho ho ho','ho hi uh ho','test')
label <- c('a1','a2','a3')
solrCloud(content = content, label = label)
d3TextCloud(content = content, label = label)
})
}

library(solrCloud)
ui.R

library(rWordCloud)
fluidPage(
solrCloudOutput("solrCloud", width = "100%", height = 500)
d3TextCloudOutput("solrCloud", width = "100%", height = 500)
)
```
output
Expand Down
6 changes: 3 additions & 3 deletions inst/examples/shiny/server.R
@@ -1,7 +1,7 @@
library(solrCloud)
library(rWordCloud)
library(XML)
function(input, output, session) {
output$solrCloud <- rendersolrCloud({
output$d3TextCloud <- renderd3TextCloud({
doc.html = htmlTreeParse('http://en.wikipedia.org/wiki/R_(programming_language)',
useInternal = TRUE)

Expand All @@ -10,7 +10,7 @@ function(input, output, session) {
doc.text = gsub('\\n', ' ', doc.text)

data <- as.data.frame(doc.text)
solrCloud(content = doc.text, label = rownames(data))
d3TextCloud(content = doc.text, label = rownames(data))
})
}

4 changes: 2 additions & 2 deletions inst/examples/shiny/ui.R
@@ -1,4 +1,4 @@
library(solrCloud)
library(rWordCloud)

fluidPage(
h1("testing Solr Cloud"),
Expand All @@ -9,7 +9,7 @@ fluidPage(
<div id='chart1'>
</div>
"),
solrCloudOutput("solrCloud", width = "100%", height = 500)
d3TextCloudOutput("d3TextCloud", width = "100%", height = 500)

)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
4 changes: 4 additions & 0 deletions inst/htmlwidgets/lib/jquery/jquery-1.11.2.min.js

Large diffs are not rendered by default.

@@ -1,6 +1,6 @@
HTMLWidgets.widget({

name: 'solrCloud',
name: 'd3TextCloud',

type: 'output',

Expand All @@ -15,11 +15,11 @@ HTMLWidgets.widget({
var cloud = d3.layout.cloud().size([width, height])
.padding(5);
var svg = d3.select(el).append("svg")
.attr("class", "solrCloud");
.attr("class", "d3TextCloud");

return {
svg: svg,
solrCloud: cloud
rWordCloud: cloud
}

},
Expand Down
Expand Up @@ -5,10 +5,13 @@ dependencies:
script:
- d3.js
- d3.layout.cloud.js
- name : custom
src: htmlwidgets/lib/custom
script:
- fetchData.js
- fisheye.js
- stopWord.js
- name: jquery
version: 1.7.2
version: 1.11.2
src: htmlwidgets/lib/jquery
script: jquery-1.7.2.min.js
script: jquery-1.11.2.min.js
2 changes: 1 addition & 1 deletion solrCloud.Rproj
@@ -1,4 +1,4 @@
Version: 1.0
Version: 0.1

RestoreWorkspace: No
SaveWorkspace: No
Expand Down

0 comments on commit 34312c3

Please sign in to comment.