Comments (26)
I am indeed in the middle of PhD hell, but I'll get back to Clickme in a week :) @ramnathv I like what you're doing with rCharts. I think our approaches are complementary, so I'd love to make both packages inter-operable.
from rcharts.
I see a lot of potential here as well. Clickme can benefit from some refactoring, since there is repeated code across the the templates, and across data translators. Given that d3.js uses a limited amount of data structures, it might make sense to just have a bunch of translators, and shift the innovation to the templates.
Effectively, it should be possible to just have a single Rmd file with YAML front matter representing the config and the javascript function in the body. The YAML front matter can take scripts
and styles
as a list of external asests.
Another way to go about this is to think of a clickme
as a highly specialized library. Taking that route makes things simpler, since config.yml
can map to the YAML configuration and layouts/chart.html
can map to.
from rcharts.
Here is forcedirected implemented in rCharts
require(RCurl)
dat = read.csv(text = getURL('https://raw.github.com/nachocab/clickme/master/inst/examples/force_directed/data/original_data.csv'))
dat = toJSONArray(dat, json = F)
p1 <- rCharts$new()
p1$field('lib', 'forcedirected')
p1$set(x = 'source', y = 'target', type = 'type', data = dat)
p1
from rcharts.
Some explanation is in order. Here is what I am doing
- We initialize a new instance of the class rCharts
- I set the
lib
field manually toforcedirected
so that it will now look for everything ininst/forcedirected
- I have to use
x
andy
sincerCharts
needs them by default. But, you can map it to any name, as I have done in my code here. You can also use arbitrary field names, butx
andy
are a must. This is necessary to be able to take advantage of the formula interface as well. - Finally, we print the chart.
Note that I used toJSONArray
to convert the data frame into a JSON Array, rather than a JSON object, which is what toJSON would do. This is similar to what df2json
would do. I use json = F
, because I want the R object. rCharts
by default converts its payload to JSON
, so that would be taken care of automatically.
from rcharts.
Here is my simple example. Where clickme can be extremely helpful is combining multiple charts and also potentially adding the javascript interactive functions and components. Correct me if I am wrong but rCharts excels at creating a single chart. These can be combined in a ractive to create a powerful whole.
This example I think helps highlight some of the data duplication.
from rcharts.
What you are doing can be achieved using Slidify
and rCharts
. I will post an example shortly.
UPDATE. Here you go http://ramnathv.github.io/rChartsPerfAnalytics/
from rcharts.
very nice!
Some questions though as I still wrestle with the differences of rCharts and clickme.
What happens though when we want to loop through 40 managers and produce this for each with this as our content template? clickme allows us to simply do
clickme(get(paste0(manager,i)), ractivename)
Also what happens if we want to combine the charts into one group for interactivity, such as when we hover over an area in the cumul chart, we want a vertical line to appear on both charts representing the x location and trigger the appearance of a tooltip? clickme would allow us to provide the functionality in the template.Rmd.
from rcharts.
I just added a Shiny app too. You can either try it by downloading the repo or use
runGitHub('rChartsPerfAnalytics', 'ramnathv', ref = 'gh-pages', subdir = 'app')
This should answer your question about multiple managers :)
from rcharts.
now we are talking! sweet! @jfreels
from rcharts.
did you manually or programatically produce?
from rcharts.
I have an idea to programmatically produce it :-). For now, I just cut paste code.
Basically
- global.R all data prep code
- ui.R interface for manager selection + two outputs
- server.R cut-paste code for the two charts, replacing 1 with input$manager.
I was thinking of writing up a shinify
function that would create a shiny rCharts
app, given a bunch of inputs. It should not be too difficult.
I tried your clickme version. I don't see any interactivity there. Am I missing something?
from rcharts.
I have some ideas on clickme and rCharts integration. Essentially, I can reprogram rCharts such that a clickme
type of folder can make use of the rCharts
class. Once that happens, clickme
users can benefit fully by all the supporting functions including publish
.
However, for that to happen, design changes are required at both ends. If you see my forcedirected
example, you will see what I am talking about. I am happy to talk through this with @nachocab and see where this leads. For starters, I will convert a few more clickmes into a structure that rCharts can take. We can iterate to arrive at a design that works for everyone (hopefully!)
from rcharts.
so what did you copy for the forcedirected example? was it the ractive?
from rcharts.
I am totally willing to do this. I love the publishing feature. My goal is to make interactive plots as easy to use as static plots. I'm not married to any tool or library (not even my own). Give me a week until I pass my qualifying exam, so I have some free time and let's talk about it.
from rcharts.
The structure of a library in rCharts (which is essential for it to seamlessly integrate as a widget in Slidify) is as shown below. config.yml
provides metadata about scripts and styles (and other info). layouts
contains a chart.html
which is just a mustache template with javascript
. The js
and css
folders are self explanatory.
lib
config.yml
layouts
chart.html
js
css
In the case of the forcedirected ractive,
- I replaced js and css with external (since it only matters for how they are referred to in config.yml).
- I modified template.Rmd by stripping everything other than the js within script tags. rCharts only passes a single js object by default called
chartParams
. I captured it in the JS variableparams
and then modified the js function. My idea is not to have any placeholders in the JS function, and essentially use R to direct the payload. This will be clearer once I post more clickme examples formatted for rCharts.
You can see the final structure here.
Good luck with your qualifiers @nachocab. Let us talk once you are done with that. I know how qualifiers can hang over your head :) Meanwhile, I will post more examples of integrating ractives. We will need a few iterations, but I can totally see how they will work great.
from rcharts.
forcedirected worked very nicely, and I hope to run many more experiments. On a side note, the publish feature worked great.
from rcharts.
Now I believe I understand enough to play along. Let me know as soon as you have one or two more examples, so I can get right on it. Thanks.
from rcharts.
@timelyportfolio @nachocab Another example: Parallel Coordinates
http://ramnathv.github.io/rChartsParCoords/
from rcharts.
Here is a version published using the publish
method
http://pagist.github.io/?5448776
from rcharts.
alright I'm pretty dang convinced. Well done! I will do all the standalone polycharts, but what next? Still want me to focus on NVD3? I'm not the biggest fan of NVD3 but it does offer some of the best built-in interactivity.
from rcharts.
I want to take a step back and revisit the design of rCharts to see what changes are needed to more flexibly accomodate clickme style charts. I also want to refactor, adhere to a consistent naming policy and follow a coding style.
I think you should try to do what excites you. Feel free to bounce ideas around.
from rcharts.
rChartsExtra will house custom visualizations.
from rcharts.
Good to hear!
from rcharts.
Thanks. rCharts was getting too dense to hold everything, so I decided to spin-off custom visualizations into an rChartsExtra. Nice zoomable scatterplot with clickme btw.
from rcharts.
Thanks, more are coming. Good luck presenting on the NYC R meetup.
from rcharts.
Great. Look forward to seeing more! And thanks.
from rcharts.
Related Issues (20)
- Domain expiry of rcharts.io HOT 2
- Installation failed:comand failed(1) on windows 10
- Is there a way for me to modify the size of the circle in nvd3's interactive layer? HOT 1
- rCharts no longer works in a shiny application while using highcharter also
- dyLegend showZeroValues is broken HOT 1
- Remove legend from rChart
- nPlot prints text instead of graph
- Handling Cyclic or Circular data
- Why does it keep trying to install a new version of 'yaml'?? HOT 2
- rCharts dormant? HOT 2
- Hide all series EXCEPT selected series from legend HOT 1
- x axis wih Date variable shown in numbers rather than "Y-m-d" format
- rPlot no compatible with R 4.0 ?
- rCharts: Error in UseMethod("rPlot") : HOT 2
- Can't use rPlot for anything.
- Can't install packages(rCharts) for mac OS X 11.1 R4.0
- exporting function does not work anymore
- nPyramid function
- rCharts::Highcharts radar plot only renders legends in shiny
- r stock type r
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rcharts.