mroberts / stmBrowser

Visualizations for the stm package
Other
59 stars 7 forks source link

an htmlwidgets version? #1

Open timelyportfolio opened 9 years ago

timelyportfolio commented 9 years ago

As discussed on Twitter, here is a start toward a htmlwidget version of this fine project https://github.com/timelyportfolio/stmBrowser/tree/htmlwidget. While it sort of works right now, there are some things I would like to address before saying it really works.

  1. Remove all global variables (data, topics, settings) and keep them scoped within the widget container. This seems to be the hardest by far.
  2. Clean up my hacked innerHTML to properly render the stmBrowser_html container on the R side. Should be easy.
  3. Size appropriately -- this should be really easy.
  4. Scope the css to make sure no conflicts with other HTML elements and assets.
  5. Add shiny functions. This should be relatively painless.
  6. Test it in all contexts.

Thanks for sharing your work. I'll also have a look at stmCorrViz to see if it can be widgetized.

mkfreeman commented 9 years ago

I think I can really only contribute to point #1 — I’m not sure how the widget container works, but I’ve previously wrapped data/topics/settings in an application object and referred to them throughout as app.settings, app.data, etc. I imagine the same would be applicable for the widget container. Let me know if I can be of any help/insight on this front. Thanks,

Mike

On Mar 31, 2015, at 9:47 PM, timelyportfolio notifications@github.com wrote:

As discussed on Twitter, here is a start toward a htmlwidget version of this fine project https://github.com/timelyportfolio/stmBrowser/tree/htmlwidget https://github.com/timelyportfolio/stmBrowser/tree/htmlwidget. While it sort of works right now, there are some things I would like to address before saying it really works.

Remove all global variables (data, topics, settings) and keep them scoped within the widget container. This seems to be the hardest by far. Clean up my hacked innerHTML to properly render the stmBrowser_html container. Should be easy. Size appropriately -- this should be really easy. Thanks for sharing your work. I'll also have a look at stmCorrViz to see if it can be widgetized.

— Reply to this email directly or view it on GitHub https://github.com/mroberts/stmBrowser/issues/1.

timelyportfolio commented 9 years ago

Here it is mostly working http://timelyportfolio.github.io/stmBrowser/ as an htmlwidget. If @mroberts or @mkfreeman get some time, would you test it out by doing with some of your stm examples?

devtools::install_github("ramnathv/htmlwidgets")
devtools::install_github("timelyportfolio/stmBrowser@htmlwidget")

stmBrowser_widget(stm.out, data=out$meta, c("rating", "date"),
                  text="text")

From the list 2,3,5, and 6 remain for me to do.

mroberts commented 9 years ago

This is awesome, thanks for doing this! We will discuss how to best incorporate!

Best, Molly

On Wed, Apr 1, 2015 at 1:37 PM, timelyportfolio notifications@github.com wrote:

Here it is mostly working http://timelyportfolio.github.io/stmBrowser/ as an htmlwidget.

From the list 2,3,5, and 6 remain for me to do.

— Reply to this email directly or view it on GitHub https://github.com/mroberts/stmBrowser/issues/1#issuecomment-88624330.

timelyportfolio commented 9 years ago

Hope I represented your work acceptably in the post and that I was able to direct a few more eyes your way. I think 3 is now done, so only 2, 5, and 6 left now.

Please let me know if you would like to replace the original function with the widgetized version, or if you would like to continue to offer two functions. If the latter, I'll need to circle back and make sure that the changes get properly implemented. Happy to do either way and then just submit a pull to your repo.

Thanks again for all your great work.

mroberts commented 9 years ago

That was great! Thanks. I think we'll go with two functions -- that way people can have the option. Thanks for doing this!

On Thu, Apr 2, 2015 at 9:14 PM, timelyportfolio notifications@github.com wrote:

Hope I represented your work acceptably in the post and that I was able to direct a few more eyes to your work. I think 3 is now down, so only 2, 5, and 6 left now.

Please let me know if you would like to replace the original function with the widgetized version, or if you would like to continue to offer two functions. If the latter, I'll need to circle back and make sure that the changes get properly implemented. Happy to do either way and then just submit a pull to your repo.

Thanks again for all your great work.

— Reply to this email directly or view it on GitHub https://github.com/mroberts/stmBrowser/issues/1#issuecomment-89156314.

timelyportfolio commented 9 years ago

@mroberts, I'm happy to do either, and I'll get to work on the both option.

For the purposes of discussion, if you have time, what benefit does the original method provide over htmlwidgets? If you are not aware, htmlwidgets also has a built-in saveWidget function to make a standalone html file similar to that provided by the original method.

mroberts commented 9 years ago

Sorry for the delay! We think they are almost interchangeable, except for these two issue:

Do you think these are easy to fix within widgets? Again, thanks so much for the time you've put into this!

Best, Molly

On Wed, Apr 8, 2015 at 12:33 PM, timelyportfolio notifications@github.com wrote:

@mroberts https://github.com/mroberts, I'm happy to do either, and I'll get to work on the both option.

For the purposes of discussion, if you have time, what benefit does the original method provide over htmlwidgets? If you are not aware, 'htmlwidgetsalso has a built-insaveWidget` function to make a standalone html file similar to that provided by the original method.

— Reply to this email directly or view it on GitHub https://github.com/mroberts/stmBrowser/issues/1#issuecomment-91012993.

timelyportfolio commented 9 years ago

No problem on delay at all. I think the continuous legend is a chronology problem that I introduced, since it fixes itself when you reset the zoom. I believe that will be a very simple change. Do you have a screenshot of the line spacing? I would think that is an easy fix also. I'm very design challenged :)

mkfreeman commented 9 years ago

Hey,

I've put a screenshot of the line spacing below (sorry for letting this slip through my inboxes). It might be more demonstrative if you use an example with longer text, but just looks like lots of space between each line. Thanks,

Mike

On Thu, Apr 16, 2015 at 7:14 AM, timelyportfolio notifications@github.com wrote:

No problem on delay at all. I think the continuous legend is a chronology problem, since it fixes itself when you reset the zoom. I believe that will be a very simple change. Do you have a screenshot of the line spacing? I would think that is an easy fix also. I'm very design challenged :)

— Reply to this email directly or view it on GitHub https://github.com/mroberts/stmBrowser/issues/1#issuecomment-93745119.

timelyportfolio commented 8 years ago

@mkfreeman Revisiting this after attempting to convert stmCorrViz. I forgot these last remaining items. I have reduced the line-height to 0.75 in lines, so now it looks like this

image

I am definitely not a designer, so happy to change to whatever you like.

I will now get to work debugging the legend.

timelyportfolio commented 8 years ago

@mkfreeman I think I got the legend issue sorted out in 47e0bc8f61a45bfe5f8061f267b7a9fce93908d3. I have updated the example http://timelyportfolio.github.io/stmBrowser/.