Dynamic resizing of ggvis plots in shiny apps - r

When adding a ggvis plot to a shiny app, the width and height of the plot are fixed and don't automatically adjust to the size of the div the ggvis object is placed in. This obviously causes some problems when app users have different screen sizes for instance, or adjust the size of the app window.
It's possible to modify the size of the ggvis object on the server side using set_options, but this doesn't really help since I don't think there is a way to pass the size of the div to the server side.
I've tried modifying the css of the different classes associated with the ggvis object on the ui side (e.g. ggvis-output, ggvis-output-container, etc.) but this doesn't help either. The ggvisOutput function seems to override the css length and width no matter what.
Has anybody found a solution/workaround to dynamically resize a ggvis plot as function of the size of the surrounding div?
Thanks for your help.

This is now possible in the development version of ggvis. See https://github.com/rstudio/ggvis/pull/381

Related

qt/qml quick item - scale without pixelation

I'm trying to design a zoomable view in qt/qml where you can adjust the scaling of the rendered widgets similar like in a browser or QtWebView.
My first try was to use the scale attribute. Though scaling everything, an unwanted side effect is that the UI gets pixelated.
There exists the QT_SCALE_FACTOR environment variable. The rendered result is what I'm looking for but the scale factor cannot be changed anymore after creating the QGuiApplication.
Additionally it scales everything on the gui, but maybe this issue could be solved if i found a way to manipulate QT_SCALE_FACTOR dynamically at runtime.
I assume that QT_SCALE_FACTOR overrides the QScreen::devicePixelRatio property, but i didn't found a way to manually set this property since it is readonly.
Is there a way to manipulate QT_SCALE_FACTOR at runtime or exists another way to implement such a zoomable view?
With kind regards,
Neconspictor

Custom shaped menu with shadow in Qt

I'd like to create a context menu looking similar to this one:
I read suggestions on the web that QWidget::setMask() should be used to create a shape. But how can it fit the variable number of items then? Moreover, the same menu item may take more or less screen space on different machines.
Another question is how to create a shadow around this custom shape? As far as I understand, the mask allows to crop the widget, but not to make it semi-transparent.
I don’t found an easy way to do that! But here goes a way!
Instead of using the Qt mask API, I've used a frame-less widget with transparency enabled!
To draw the shadow, I've used radial gradient!
You can change the size of the menu before opening it, however you can’t resize it after opened (for example resize with mouse).
It’s quite easy add or remove widgets, just respect the layout margin to not draw outside the bounds destined to widgets. To simplify your life I created an inherited class of QPushButton with colors you can easily customize with style sheet.
See the result:
You can browse the source
Hope that helps!

Interactive ZoomGraph in R Shiny

Is it possible to create interactive Shiny graph that when you click zoom button on a Shiny Page, the graph will expand to the entire size of the browser window? Right now I have four ggplots on one shiny page and would like to expand one to full screen size when I click zoom. I think it could be using either shinyjs or conditional panels, but can't seem to figure it out. This has similar logic:https://gallery.shinyapps.io/105-plot-interaction-zoom/, instead of zooming in the graphic, would just like to zoom the entire graphic to the browser.
Thanks!
My solution was much easier actually and I ended up using Shiny BS that has a built in modal function.

Dojo Graph Tooltip Arrow Appears Incorrectly

For some reason, the arrow on the tooltip for each graph point appears below the actual label(see image). I have tried doing everything to move it and can not figure out why this is happening. The tooltip is generated automatically by dojo's chart library. It appears fine in the demos.
Does anybody have an idea why?
EDIT:
I am using Dojo 1.7.2.
The code is question is
this.linePlotName is part of the object that the method below resides in.
var anim = new dojox.charting.action2d.Tooltip(newLineChart, this.linePlotName);
I had the same issue after I upgraded my Dojo from 1.6 to 1.7.2, but this issue was actually a bug and it is fixed now in 1.7.3: http://bugs.dojotoolkit.org/ticket/15016
Upgrade and it should be fine.
It's hard to say, without seeing what else is going on in your code. However, it's important to keep in mind that the tooltip's behavior is influenced by the widget/div/frame it's contained in. If there's not enough room to render the tooltip graphic on top of the plot line, it will be drawn under it. Try increasing the size of the container the chart is contained in, and try increasing the size of the chart itself, so there's plenty of room above the plot line for the tooltip to appear, or even try just scrolling up/down. It's best to rule out the easy fixes first. :) If that doesn't work, please comment, and we can go from there...

asp.net sizing the non-sizable

I'm using the asp.net charting control, and liking it for the most part. However, I would like my charts to size with the panels they are contained in. I cannot set the width of the chart to 100%, I have to give them an exact size. I don't want to stretch and distort the rendered chart image.
Does anyone have an example of how I might do this, or could you point me in the right direction?
If you don't want to stretch generated chart you can load it via ajax and pass size of current image container in an ajax request (e.g. www.site.com/generateCoolChart?height=200&width=300 ). But size of the container may be changed after the user change size of the browser so your chart may become bigger than your container.
With sizing requirement I would consider using flash or silverlight or javascript based charts like amCharts or other. I mean anything not generating static images. These are generated on the client so they can easily adopt to the dedicated space.

Resources