anhoej / qicharts2

R package: Quality improvement charts
36 stars 12 forks source link

add interactivity with ggiraph package #22

Closed seamus-mckinsey closed 5 years ago

seamus-mckinsey commented 5 years ago

Hi Jacob,

First, thank you for developing qicharts2! It's been very useful for developing control charts in my work.

I wanted to create interactive control charts, so I joined your work together with the ggiraph package. (It was pretty straightforward – I duplicated the qic.R and qic.plot.R files, and added the necessary conversion of a ggplot object to a girafe object and switched the normal geom_*s to interactive ones.)

I thought others might find this functionality useful, so I created this pull request. If it's not something you'd like to incorporate into qicharts2 itself, I can definitely create a standalone package and reference/import yours as needed. If it is something you're interested in, I'm sure there are improvements to be made, so looking forward to your feedback. This is my first time developing a package, so hopefully I've not messed anything up too much. 😄

Thanks, Seamus

seamus-mckinsey commented 5 years ago

Sounds good, thanks! Happy to answer any questions

anhoej commented 5 years ago

I have given your suggestion some more thought. I is really a good idea. I have previously tinkered with making qic charts interactive. But I also want to keep qicharts2 as independent as possible, so at this time, I am not going to include ggiraph. But I would be very interested if you could develop a stand-alone function that could take a qic object and add interactivity. Something like: iqic(p) where p is a qic object, e.g. p <- qic(rnorm(12)). I guess you would have to grab the data part of p, p$data, to get things working. Also you might need some other parts of p, e.g. p$labels$title etc. Everything you need should be in p.