Giter Site home page Giter Site logo

nx10 / httpgd Goto Github PK

View Code? Open in Web Editor NEW
365.0 6.0 19.0 6.98 MB

Asynchronous http server graphics device for R.

Home Page: https://nx10.github.io/httpgd

License: GNU General Public License v2.0

R 3.08% HTML 0.94% C++ 88.85% JavaScript 0.29% TypeScript 4.75% C 0.12% Shell 0.01% EJS 0.52% SCSS 1.38% Dockerfile 0.06%

httpgd's Introduction

httpgd

R-CMD-check CRAN downloads Codecov test coverage

A graphics device for R that is accessible via network protocols. This package was created to make it easier to embed live R graphics in integrated development environments and other applications. The included HTML/JavaScript client (plot viewer) aims to provide a better overall user experience when dealing with R graphics. The device asynchronously serves graphics via HTTP and WebSockets.

Features

  • Fast plotting
  • Interactive plot viewer (client)
  • Supports multiple clients concurrently
  • Plot resizing and history
  • Export various image formats (SVG, PNG, PDF, EPS, ...)
  • Powered by unigd
  • For developers:
    • Stateless asynchronous HTTP/WebSocket API
    • HTML/JavaScript client (TypeScript module)

Demo

Installation

Install httpgd from CRAN:

install.packages("httpgd")

Or get the latest development version from GitHub:

remotes::install_github("nx10/httpgd")

See system requirements for troubleshooting.

Documentation

Contributions welcome!

The various components of httpgd are written in C++, R and TypeScript. We welcome contributions of any kind.

Other areas in need of improvement are testing and documentation.

Links & Articles

About & License

Depends on cpp11.

Webserver based on CrowCpp/Crow.

This project is licensed GPL v2.0.

The HTML client includes Material Design icons by Google which are licensed under the Apache License Version 2.0.

Full copies of the license agreements used by these components are included in ./inst/licenses.

httpgd's People

Contributors

benz0li avatar dependabot[bot] avatar eitsupi avatar jeroen avatar kguidonimartins avatar nx10 avatar renkun-ken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

httpgd's Issues

restore or indicate "neutral" size

Nice package! Its timely reveal to me might better enable working in WSL2 where I don't want to rely on an x-server in windows to show the plots. (I still have to test it in wsl2, networking b/w wsl2 and windows is allegedly not always perfect.)

The ability to increase/decrease fonts is nice, but if I had a moment of caffeine-induced impatience and pressed it several times, I don't know how many clicks it takes to restore to "neutral" (default). I can reload the page, but then I lose the image cache.

Two suggestions, not necessarily exclusive:

  • add a "0" button to restore to the default size

    image

  • display the percentage (or raw size) increase/decrease

    image

Security issue

The http server works nicely with demand that requires an external viewer to view the graphics outside R. If the user is using a personal computer and httpgd http server is started from localhost, there's no security issue on this. However, if the http server is started in a server with many users, there might be some demand that the graphics should be private to the user that creates the graphics, i.e. not visible to other users.

Currently, any user on the same server could visit the localhost:port (if port is known by others) and see the graphics.

I'm wondering if something could be done so that there's a way to prevent other users from seeing the graphics. One way that comes to my mind is that user could supply or httpgd to generate a token before starting the http server. Only user with this token specified somewhere (e.g URL query params) could visit the graphics.

More than 1-sec delay on live page when plot is updated

I'm using the following code to test:

httpgd::httpgd()
plot(rnorm(100), main = "title")
abline(h = 0, col = "red")

When the first plot is called, the webpage is updated roughly more than 1 second later. And the same occurs with the abline call. I'm wondering if it is possible that the live page updates in a more responsive manner?

Use snake case for function names

The Tidyverse style guide recommends snake case for function names.
I propose these function name changes:

old new
httpgd hgd
httpgdBrowse hgd_browse
httpgdClear hgd_clear
httpgdCloseAllServers hgd_close(all = T)
httpgdCloseServer hgd_close
httpgdGenerateToken hgd_generate_token
httpgdRemove hgd_remove
httpgdSVG hgd_svg
httpgdState hgd_state
httpgdURL hgd_url

This breaking change should probably be done as soon as possible (before we release to CRAN).

As httpgd_ is pretty long we could also consider to use hgd_ instead as a shorter prefix.

Http server disconnected

I'm testing on a Ubuntu 18.04 Server in local network.

httpgd::httpgd(host = "0.0.0.0", port = 24680)

When I open the URL http://localserver:24680, it shows httpgd server running. which looks normal. But in http://localserver:24680/live, the page is blank and then shows Disconnected on the top-right corner:

image

Then I run the following code in R:

plot(rnorm(100), main = "title")
abline(h = 0, col = "red")

and the webpage in browser shows the graphics in a couple of seconds.

If I open the page in a webview in VSCode,

getOption("browser")("http://localhost:24680/live")

The graphics is never shown.

I'm not sure if there's something missing but httpgd works nicely via VSCode Remote Development as I tested from my macOS connecting via sshuttle to my work place desktop server.

Cleanup SVG rendering code

The SVG rendering code is bloated and unoptimized.
It should be cleaned up and make use of modern c++ features and fmt library features, to decrease file sizes and increase rendering speed and maintainability.

Copy to clipboard not working on all platforms

Copy to clipboard is confirmed not working in:

  • Safari 14.0.2 (macOS Big Sur 11.1)
  • VSCode webview (1.52.1)

Safari throws "NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission."

Maybe calling the clipboard API wrapped in the image load callback is not allowed?

It not working in the VSCode webview might be caused by IFrame security settings. (Needs further investigation)

The associated code is

httpgd/inst/www/httpgd.ts

Lines 486 to 502 in abe90b9

public copyPlotPNG() {
if (!navigator.clipboard) return;
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.width = this.plotParams.width / this.scale;
canvas.height = this.plotParams.height / this.scale;
const ctx = canvas.getContext('2d');
if (!ctx) return;
const img = new Image();
img.crossOrigin = 'anonymous';
img.onload = () => {
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
canvas.toBlob(blob => { if (blob) navigator.clipboard.write?.([new ClipboardItem({ 'image/png': blob })]) });
};
img.src = this.svgURL();
document.body.removeChild(canvas);
}

Thank you @psobolewskiPhD for the bug report.

Toolbar opacity

Does it make sense to make the toolbar have some opacity in the background so that it does not fully cover the graphics element behind it?

Deleting the wrong plot

Hitting delete could delete the wrong plot. For example, run the following code:

httpgd::httpgd()
utils::browseURL(httpgd::httpgdURL())
for (i in 1:10) {
  plot(rnorm(100), main = sprintf("plot %d", i))
  abline(h = 0, col = "red")
  points(rnorm(100), col = "blue")
}

Ten plots are created. Now it is showing plot 10.

Press right and navigate to plot 1 and hit delete. Then it shows plot 10. Now press right again. It is showing plot 1 again, which is supposed to be deleted. Now press right, it shows plot 3. Now it looks like plot 2 is removed instead of plot 1.

install package error: invalid value 'gnu++17' in '-std=gnu++17'

Hi, this package looks amazing, I was trying to install it in R.4.0.2, Mac OS 10.15.7.

I encountered following error:

> devtools::install_github("nx10/httpgd")
Downloading GitHub repo nx10/httpgd@HEAD
โœ”  checking for file โ€˜/private/var/folders/hx/y7h1vl9d25q9mppm8kwh7t7m0000gp/T/RtmpeWbR0L/remotes313d2f4e8353/nx10-httpgd-0e2b009/DESCRIPTIONโ€™ ...
โ”€  preparing โ€˜httpgdโ€™:
โœ”  checking DESCRIPTION meta-information ...
โ”€  cleaning src
โ”€  checking for LF line-endings in source and make files and shell scripts
โ”€  checking for empty or unneeded directories
โ”€  building โ€˜httpgd_1.0.0.tar.gzโ€™

* installing *source* package โ€˜httpgdโ€™ ...
** using staged installation
** libs
clang++ -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c AsyncLater.cpp -o AsyncLater.o
error: invalid value 'gnu++17' in '-std=gnu++17'
make: *** [/Library/Frameworks/R.framework/Resources/etc/Makeconf:175: AsyncLater.o] Error 1
ERROR: compilation failed for package โ€˜httpgdโ€™
* removing โ€˜/Library/Frameworks/R.framework/Versions/4.0/Resources/library/httpgdโ€™
Error: Failed to install 'httpgd' from GitHub:
  (converted from warning) installation of package โ€˜/var/folders/hx/y7h1vl9d25q9mppm8kwh7t7m0000gp/T//RtmpeWbR0L/file313d6dd61aca/httpgd_1.0.0.tar.gzโ€™ had non-zero exit status

I'm not familiar with C++, and cannot find similar error on google. Could you please help me out? Thank you!

How is png resolution determined?

In the httpgd window, graphics are razor sharp, but PNGs are generated with relatively low resolution (72 dpi). On a retina screen Mac, this is painfully small and ugly. Is this user adjustable?

Release 1.0.0

This is a tracking issue for major tasks that have to be done for a 1.0.0 release. The goal is to ship a reliable and fast graphics device and a HTML/JS client that is easy to use.
Bugfixes and small feature requests will also be worked on when they arise.

Backend

  • Use Boost Beast
    • Get beast servers (http & websocket) to compile + run in an R package (done!)
    • Switch from cpphttplib server to beast
    • Implement websockets
  • Unit tests (If you want to contribute, this would be a great way to start)
  • Generate better SVGs
    • Improve SVG rendering (Number formatting, string building, ...)
  • Offline mode

HTML/JS Client

  • Handle websockets (and optionally polling, if ws are not available)
  • Display disconnected status (#23)
  • Render PNG / raster graphics (#9)

Other

  • Create logo
  • Investigate build and R CMD CHECK output for all platforms (Win, Linux, macOS)
  • Clean up code & meta data
  • Release 1.0.0 to CRAN

After 1.0

  • Improve documentation
  • Replace Belle (might not be necessary: octobanana/belle#13)
  • Consider switching from Rcpp to cpp11
  • Analyze draw call data to generate small optimized SVGs

Connect remotely (bind to 0.0.0.0)

I would like to SSH into my remote machine, and see plots locally in my browser. However if I bind to the default 127.0.0.1 then we cannot connect from outside.

So instead on the remote machine, I start with:

httpgd::httpgd('0.0.0.0')
# httpgd live server running at:
#   http://0.0.0.0:33095/live?token=WNoy3Nsn

My local browser can connect to the remote http server (if I replace 0.0.0.0 with my hostname) however the html/js client page doesn't work because javascript is trying to connect to 0.0.0.0.

Screen Shot 2020-06-23 at 12 11 07 AM

I also tried starting the server with httpgd::httpgd('actual.hostname.com') but then I couldn't even connect to the http server remotely.

Build warnings on macOS

On macOS, there are plenty of build warnings:

โœ”  checking for file โ€˜/Users/ken/Workspaces/github/httpgd/DESCRIPTIONโ€™ ...
โ”€  preparing โ€˜httpgdโ€™: (421ms)
โœ”  checking DESCRIPTION meta-information ...
โ”€  cleaning src
โ”€  checking for LF line-endings in source and make files and shell scripts
โ”€  checking for empty or unneeded directories
โ”€  building โ€˜httpgd_0.4.0.tar.gzโ€™
   
Running /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL \
  /var/folders/8n/fdyp8ztd42gd2s61p6nzqrgh0000gn/T//RtmpzqhdDC/httpgd_0.4.0.tar.gz \
  --install-tests 
* installing to library โ€˜/Library/Frameworks/R.framework/Versions/4.0/Resources/libraryโ€™
* installing *source* package โ€˜httpgdโ€™ ...
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c DrawData.cpp -o DrawData.o
In file included from DrawData.cpp:11:
./DrawData.h:66:37: warning: private field 'm_hadj' is not used [-Wunused-private-field]
            double m_x, m_y, m_rot, m_hadj;
                                    ^
1 warning generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c Httpgd.cpp -o Httpgd.o
In file included from Httpgd.cpp:13:
./HttpgdDev.h:82:22: warning: 'dev_activate' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_activate(pDevDesc dd);
                     ^
./devGeneric.h:25:22: note: overridden virtual function is here
        virtual void dev_activate(pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:83:22: warning: 'dev_deactivate' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_deactivate(pDevDesc dd);
                     ^
./devGeneric.h:27:22: note: overridden virtual function is here
        virtual void dev_deactivate(pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:84:22: warning: 'dev_close' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_close(pDevDesc dd);
                     ^
./devGeneric.h:29:22: note: overridden virtual function is here
        virtual void dev_close(pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:85:22: warning: 'dev_clip' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_clip(double x0, double x1, double y0, double y1, pDevDesc dd);
                     ^
./devGeneric.h:31:22: note: overridden virtual function is here
        virtual void dev_clip(double x0, double x1, double y0, double y1, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:86:22: warning: 'dev_size' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_size(double *left, double *right, double *bottom, double *top, pDevDesc dd);
                     ^
./devGeneric.h:33:22: note: overridden virtual function is here
        virtual void dev_size(double *left, double *right, double *bottom, double *top, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:87:22: warning: 'dev_newPage' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_newPage(pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:35:22: note: overridden virtual function is here
        virtual void dev_newPage(pGEcontext gc, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:88:22: warning: 'dev_line' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_line(double x1, double y1, double x2, double y2, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:37:22: note: overridden virtual function is here
        virtual void dev_line(double x1, double y1, double x2, double y2, pGEcontext gc, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:89:22: warning: 'dev_text' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_text(double x, double y, const char *str, double rot, double hadj, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:39:22: note: overridden virtual function is here
        virtual void dev_text(double x, double y, const char *str, double rot, double hadj, pGEcontext gc, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:90:24: warning: 'dev_strWidth' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual double dev_strWidth(const char *str, pGEcontext gc, pDevDesc dd);
                       ^
./devGeneric.h:41:24: note: overridden virtual function is here
        virtual double dev_strWidth(const char *str, pGEcontext gc, pDevDesc dd);
                       ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:91:22: warning: 'dev_rect' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_rect(double x0, double y0, double x1, double y1, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:43:22: note: overridden virtual function is here
        virtual void dev_rect(double x0, double y0, double x1, double y1, pGEcontext gc, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:92:22: warning: 'dev_circle' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_circle(double x, double y, double r, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:45:22: note: overridden virtual function is here
        virtual void dev_circle(double x, double y, double r, pGEcontext gc, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:93:22: warning: 'dev_polygon' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_polygon(int n, double *x, double *y, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:47:22: note: overridden virtual function is here
        virtual void dev_polygon(int n, double *x, double *y, pGEcontext gc, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:94:22: warning: 'dev_polyline' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_polyline(int n, double *x, double *y, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:49:22: note: overridden virtual function is here
        virtual void dev_polyline(int n, double *x, double *y, pGEcontext gc, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:95:22: warning: 'dev_path' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_path(double *x, double *y, int npoly, int *nper, Rboolean winding, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:51:22: note: overridden virtual function is here
        virtual void dev_path(double *x, double *y, int npoly, int *nper, Rboolean winding, pGEcontext gc, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:96:22: warning: 'dev_mode' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_mode(int mode, pDevDesc dd);
                     ^
./devGeneric.h:53:22: note: overridden virtual function is here
        virtual void dev_mode(int mode, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:97:22: warning: 'dev_metricInfo' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_metricInfo(int c, pGEcontext gc, double *ascent, double *descent, double *width, pDevDesc dd);
                     ^
./devGeneric.h:55:22: note: overridden virtual function is here
        virtual void dev_metricInfo(int c, pGEcontext gc, double *ascent, double *descent, double *width, pDevDesc dd);
                     ^
In file included from Httpgd.cpp:13:
./HttpgdDev.h:98:22: warning: 'dev_raster' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_raster(unsigned int *raster, int w, int h, double x, double y, double width, double height, double rot, Rboolean interpolate, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:59:22: note: overridden virtual function is here
        virtual void dev_raster(unsigned int *raster, int w, int h, double x, double y, double width, double height, double rot, Rboolean interpolate, pGEcontext gc, pDevDesc dd);
                     ^
17 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c HttpgdApiAsyncWatcher.cpp -o HttpgdApiAsyncWatcher.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c HttpgdDataStore.cpp -o HttpgdDataStore.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c HttpgdDev.cpp -o HttpgdDev.o
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:82:22: warning: 'dev_activate' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_activate(pDevDesc dd);
                     ^
./devGeneric.h:25:22: note: overridden virtual function is here
        virtual void dev_activate(pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:83:22: warning: 'dev_deactivate' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_deactivate(pDevDesc dd);
                     ^
./devGeneric.h:27:22: note: overridden virtual function is here
        virtual void dev_deactivate(pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:84:22: warning: 'dev_close' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_close(pDevDesc dd);
                     ^
./devGeneric.h:29:22: note: overridden virtual function is here
        virtual void dev_close(pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:85:22: warning: 'dev_clip' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_clip(double x0, double x1, double y0, double y1, pDevDesc dd);
                     ^
./devGeneric.h:31:22: note: overridden virtual function is here
        virtual void dev_clip(double x0, double x1, double y0, double y1, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:86:22: warning: 'dev_size' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_size(double *left, double *right, double *bottom, double *top, pDevDesc dd);
                     ^
./devGeneric.h:33:22: note: overridden virtual function is here
        virtual void dev_size(double *left, double *right, double *bottom, double *top, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:87:22: warning: 'dev_newPage' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_newPage(pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:35:22: note: overridden virtual function is here
        virtual void dev_newPage(pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:88:22: warning: 'dev_line' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_line(double x1, double y1, double x2, double y2, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:37:22: note: overridden virtual function is here
        virtual void dev_line(double x1, double y1, double x2, double y2, pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:89:22: warning: 'dev_text' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_text(double x, double y, const char *str, double rot, double hadj, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:39:22: note: overridden virtual function is here
        virtual void dev_text(double x, double y, const char *str, double rot, double hadj, pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:90:24: warning: 'dev_strWidth' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual double dev_strWidth(const char *str, pGEcontext gc, pDevDesc dd);
                       ^
./devGeneric.h:41:24: note: overridden virtual function is here
        virtual double dev_strWidth(const char *str, pGEcontext gc, pDevDesc dd);
                       ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:91:22: warning: 'dev_rect' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_rect(double x0, double y0, double x1, double y1, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:43:22: note: overridden virtual function is here
        virtual void dev_rect(double x0, double y0, double x1, double y1, pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:92:22: warning: 'dev_circle' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_circle(double x, double y, double r, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:45:22: note: overridden virtual function is here
        virtual void dev_circle(double x, double y, double r, pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:93:22: warning: 'dev_polygon' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_polygon(int n, double *x, double *y, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:47:22: note: overridden virtual function is here
        virtual void dev_polygon(int n, double *x, double *y, pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:94:22: warning: 'dev_polyline' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_polyline(int n, double *x, double *y, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:49:22: note: overridden virtual function is here
        virtual void dev_polyline(int n, double *x, double *y, pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:95:22: warning: 'dev_path' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_path(double *x, double *y, int npoly, int *nper, Rboolean winding, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:51:22: note: overridden virtual function is here
        virtual void dev_path(double *x, double *y, int npoly, int *nper, Rboolean winding, pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:96:22: warning: 'dev_mode' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_mode(int mode, pDevDesc dd);
                     ^
./devGeneric.h:53:22: note: overridden virtual function is here
        virtual void dev_mode(int mode, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:97:22: warning: 'dev_metricInfo' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_metricInfo(int c, pGEcontext gc, double *ascent, double *descent, double *width, pDevDesc dd);
                     ^
./devGeneric.h:55:22: note: overridden virtual function is here
        virtual void dev_metricInfo(int c, pGEcontext gc, double *ascent, double *descent, double *width, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:4:
./HttpgdDev.h:98:22: warning: 'dev_raster' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void dev_raster(unsigned int *raster, int w, int h, double x, double y, double width, double height, double rot, Rboolean interpolate, pGEcontext gc, pDevDesc dd);
                     ^
./devGeneric.h:59:22: note: overridden virtual function is here
        virtual void dev_raster(unsigned int *raster, int w, int h, double x, double y, double width, double height, double rot, Rboolean interpolate, pGEcontext gc, pDevDesc dd);
                     ^
In file included from HttpgdDev.cpp:2:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/RcppCommon.h:29:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:153:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:407:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:15:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3709:5: warning: destructor called on non-final 'httpgd::HttpgdApiAsyncWatcher' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
    __data_.second().~_Tp();
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3670:9: note: in instantiation of member function 'std::__1::__shared_ptr_emplace<httpgd::HttpgdApiAsyncWatcher, std::__1::allocator<httpgd::HttpgdApiAsyncWatcher> >::__on_zero_shared' requested here
        __shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4330:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<httpgd::HttpgdApiAsyncWatcher, std::__1::allocator<httpgd::HttpgdApiAsyncWatcher> >::__shared_ptr_emplace<httpgd::HttpgdDev *, std::__1::shared_ptr<httpgd::HttpgdServerConfig> &, std::__1::shared_ptr<httpgd::HttpgdDataStore> &>' requested here
    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4709:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<httpgd::HttpgdApiAsyncWatcher>::make_shared<httpgd::HttpgdDev *, std::__1::shared_ptr<httpgd::HttpgdServerConfig> &, std::__1::shared_ptr<httpgd::HttpgdDataStore> &>' requested here
    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
                            ^
HttpgdDev.cpp:44:36: note: in instantiation of function template specialization 'std::__1::make_shared<httpgd::HttpgdApiAsyncWatcher, httpgd::HttpgdDev *, std::__1::shared_ptr<httpgd::HttpgdServerConfig> &, std::__1::shared_ptr<httpgd::HttpgdDataStore> &>' requested here
        m_api_async_watcher = std::make_shared<HttpgdApiAsyncWatcher>(this, m_svr_config, m_data_store);
                                   ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3709:23: note: qualify call to silence this warning
    __data_.second().~_Tp();
                      ^
18 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c HttpgdHttpConnection.cpp -o HttpgdHttpConnection.o
HttpgdHttpConnection.cpp:139:24: warning: unused variable 'server_error' [-Wunused-variable]
            auto const server_error =
                       ^
HttpgdHttpConnection.cpp:499:17: note: in instantiation of function template specialization 'httpgd::http::handle_request<boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<char>, httpgd::http::session::send_lambda &>' requested here
                handle_request(m_watcher, std::move(req_), lambda_);
                ^
1 warning generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c HttpgdHttpTask.cpp -o HttpgdHttpTask.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c PlotHistory.cpp -o PlotHistory.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RSync.cpp -o RSync.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c TargetURI.cpp -o TargetURI.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c devGeneric.cpp -o devGeneric.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c dummygd.cpp -o dummygd.o
dummygd.cpp:45:22: warning: 'httpgd::devDummy::dev_line' hides overloaded virtual function [-Woverloaded-virtual]
        virtual void dev_line(double x1, double y1, double x2, double y2, pGEcontext gc)
                     ^
./devGeneric.h:37:22: note: hidden overloaded virtual function 'httpgd::devGeneric::dev_line' declared here: different number of parameters (6 vs 5)
        virtual void dev_line(double x1, double y1, double x2, double y2, pGEcontext gc, pDevDesc dd);
                     ^
dummygd.cpp:50:22: warning: 'httpgd::devDummy::dev_text' hides overloaded virtual function [-Woverloaded-virtual]
        virtual void dev_text(double x, double y, const char *str, double rot, double hadj, pGEcontext gc)
                     ^
./devGeneric.h:39:22: note: hidden overloaded virtual function 'httpgd::devGeneric::dev_text' declared here: different number of parameters (7 vs 6)
        virtual void dev_text(double x, double y, const char *str, double rot, double hadj, pGEcontext gc, pDevDesc dd);
                     ^
2 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o httpgd.so DrawData.o Httpgd.o HttpgdApiAsyncWatcher.o HttpgdDataStore.o HttpgdDev.o HttpgdHttpConnection.o HttpgdHttpTask.o PlotHistory.o RSync.o RcppExports.o TargetURI.o devGeneric.o dummygd.o -lpng -lz -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-httpgd/00new/httpgd/libs
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (httpgd)

Plot history gallery view

Add a thumbnail gallery view to the client for visually navigating the plot history.
Maybe implement searching/filtering.

Image formats

I have been thinking about how to implement server side rendering / export of image formats other than SVG.
I came up with a number of different approaches:

  1. Implement custom renderers for each format directly in httpgd.
    • Pro: Fast and optimized output.
    • Cons: A lot of work. Increased complexity and package size.
  2. Modularize rendering. (C++ rendering API for httpgd "plugins")
    • Pro: Fast and optimized output. Small package size. Third party plugins.
    • Cons: Increased complexity of the dependency graph. Difficult to keep API stable and safe.
  3. Include conversion library (i.e. imagemagick) as a optional dependency to convert from SVG.
    • Pro: Very large number of formats supported without additional implementation cost.
    • Cons: Slower and unoptimized output.

I think 3. is the most realistic approach. This would also allow for renderers of specific formats to be implemented directly at a later date and use the library as a fallback if no custom renderer is available.
A library candidate would be https://github.com/ropensci/magick . Which unfortunately does not seem to implement C++ bindings yet, if we decide on going that way we should ask there or if necessary implement a custom API with Magick++.

This issue is meant as an open discussion, I am open to all opinions and ideas.

missing members in global namespace

I'm getting errors when try to install the package. I have all the dependecies installed. Is there a way to fix this?

  • installing source package โ€˜httpgdโ€™ ...
    ** using staged installation
    ** libs
    clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -fPIC -Wall -g -O2 -c DrawData.cpp -o DrawData.o
    In file included from DrawData.cpp:6:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:27:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/RcppCommon.h:29:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:318:9: error: no member named
    'signbit' in the global namespace
    using ::signbit;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:319:9: error: no member named
    'fpclassify' in the global namespace
    using ::fpclassify;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:320:9: error: no member named
    'isfinite' in the global namespace; did you mean 'finite'?
    using ::isfinite;
    ~~^
    /usr/local/include/math.h:749:12: note: 'finite' declared here
    extern int finite(double)
    ^
    In file included from DrawData.cpp:6:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:27:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/RcppCommon.h:29:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:321:9: error: no member named 'isinf'
    in the global namespace
    using ::isinf;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:322:9: error: no member named 'isnan'
    in the global namespace
    using ::isnan;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:323:9: error: no member named
    'isnormal' in the global namespace
    using ::isnormal;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:324:7: error: no member named
    'isgreater' in the global namespace; did you mean '::std::greater'?
    using ::isgreater;
    ^~
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:728:29: note: '::std::greater'
    declared here
    struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
    ^
    In file included from DrawData.cpp:6:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:27:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/RcppCommon.h:29:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:325:7: error: no member named
    'isgreaterequal' in the global namespace; did you mean '::std::greater_equal'?
    using ::isgreaterequal;
    ^~
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:757:29: note:
    '::std::greater_equal' declared here
    struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
    ^
    In file included from DrawData.cpp:6:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:27:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/RcppCommon.h:29:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:326:9: error: no member named 'isless'
    in the global namespace
    using ::isless;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:327:9: error: no member named
    'islessequal' in the global namespace
    using ::islessequal;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:328:9: error: no member named
    'islessgreater' in the global namespace
    using ::islessgreater;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:329:9: error: no member named
    'isunordered' in the global namespace
    using ::isunordered;
    ~~^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:330:9: error: no member named
    'isunordered' in the global namespace
    using ::isunordered;
    ~~^
    DrawData.cpp:151:21: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    if (std::abs(dc->m_lmitre - 10.0) > 1e-3)
    ^
    DrawData.cpp:151:21: note: use function 'std::abs' instead
    if (std::abs(dc->m_lmitre - 10.0) > 1e-3)
    ^~~~~~~~
    std::abs
    DrawData.cpp:151:21: note: include the header or explicitly provide a declaration for 'std::abs'
    DrawData.cpp:294:37: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    svg_field(buf, "width", std::abs(m_x0 - m_x1));
    ^
    DrawData.cpp:294:37: note: use function 'std::abs' instead
    svg_field(buf, "width", std::abs(m_x0 - m_x1));
    ^~~~~~~~
    std::abs
    DrawData.cpp:294:37: note: include the header or explicitly provide a declaration for 'std::abs'
    DrawData.cpp:295:38: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    svg_field(buf, "height", std::abs(m_y0 - m_y1));
    ^
    DrawData.cpp:295:38: note: use function 'std::abs' instead
    svg_field(buf, "height", std::abs(m_y0 - m_y1));
    ^~~~~~~~
    std::abs
    DrawData.cpp:295:38: note: include the header or explicitly provide a declaration for 'std::abs'
    DrawData.cpp:461:20: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    return std::abs(x0 - m_x0) < CLIP_EPSILON &&
    ^
    DrawData.cpp:461:20: note: use function 'std::abs' instead
    return std::abs(x0 - m_x0) < CLIP_EPSILON &&
    ^~~~~~~~
    std::abs
    DrawData.cpp:461:20: note: include the header or explicitly provide a declaration for 'std::abs'
    DrawData.cpp:462:20: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    std::abs(x1 - m_x1) < CLIP_EPSILON &&
    ^
    DrawData.cpp:462:20: note: use function 'std::abs' instead
    std::abs(x1 - m_x1) < CLIP_EPSILON &&
    ^~~~~~~~
    std::abs
    DrawData.cpp:462:20: note: include the header or explicitly provide a declaration for 'std::abs'
    DrawData.cpp:463:20: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    std::abs(y0 - m_y0) < CLIP_EPSILON &&
    ^
    DrawData.cpp:463:20: note: use function 'std::abs' instead
    std::abs(y0 - m_y0) < CLIP_EPSILON &&
    ^~~~~~~~
    std::abs
    DrawData.cpp:463:20: note: include the header or explicitly provide a declaration for 'std::abs'
    DrawData.cpp:464:20: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    std::abs(y1 - m_y1) < CLIP_EPSILON;
    ^
    DrawData.cpp:464:20: note: use function 'std::abs' instead
    std::abs(y1 - m_y1) < CLIP_EPSILON;
    ^~~~~~~~
    std::abs
    DrawData.cpp:464:20: note: include the header or explicitly provide a declaration for 'std::abs'
    DrawData.cpp:471:62: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    buf->append("" width="").append(std::to_string(std::abs(m_x1 - m_x0)));
    ^
    DrawData.cpp:471:62: note: use function 'std::abs' instead
    buf->append("" width="").append(std::to_string(std::abs(m_x1 - m_x0)));
    ^~~~~~~~
    std::abs
    DrawData.cpp:471:62: note: include the header or explicitly provide a declaration for 'std::abs'
    DrawData.cpp:472:63: warning: using integer absolute value function 'abs' when argument is of floating
    point type [-Wabsolute-value]
    buf->append("" height="").append(std::to_string(std::abs(m_y1 - m_y0)));
    ^
    DrawData.cpp:472:63: note: use function 'std::abs' instead
    buf->append("" height="").append(std::to_string(std::abs(m_y1 - m_y0)));
    ^~~~~~~~
    std::abs
    DrawData.cpp:472:63: note: include the header or explicitly provide a declaration for 'std::abs'
    In file included from DrawData.cpp:11:
    ./DrawData.h:66:37: warning: private field 'm_hadj' is not used [-Wunused-private-field]
    double m_x, m_y, m_rot, m_hadj;
    ^
    10 warnings and 13 errors generated.
    make: *** [DrawData.o] Error 1
    ERROR: compilation failed for package โ€˜httpgdโ€™
    removing โ€˜/Library/Frameworks/R.framework/Versions/4.0/Resources/library/httpgdโ€™

Static unique plot IDs

When single plots are deleted from the history, the plot index of subsequent plots changes.
Each plot should have a unique static ID by which it can be accessed regardless of changes to other plots.

This is an API addition that should make single plot access stateless and simplifies certain implementations on the client side.

Font colour won't change

Hi there!

Text colour don't seem to change:

bug

Other elements like axis ticks, axis lines and annotation arrows (geom_curve) works just fine.

EDIT: (reprex code)

plot(mpg ~ cyl, data = mtcars,
       col.lab = "red", col = "blue",
       main = "I won't change colors", col.main = "green")

Client export image dialog

The client should have a "export image" dialog, that allows to enter precise dimensions, zoom level, file format (#58) and show a preview pane.

Preview:

3btB6TevTr.mp4

Zoom to a large number

First, create a simple plot:

plot(rnorm(100))

Then keep pressing the zoom-in key, the number could become very large:

image

Sometimes it could also cause the following error:

> Error: invalid graphics state                                                                                                                                                                    
later: exception occurred while executing callback: 

and the graphics no longer responds to any changes.

Missing axes when par(mfrow) is specified

Sometimes, the axes in a plot could be missing.

par(mfrow = c(2, 2))
m <- lm(mpg ~ cyl, data = mtcars)
plot(m)

for (i in 1:8) {
  plot(rnorm(100), main = sprintf("plot %d", i))
  abline(h = rnorm(1), col = "red")
  points(rnorm(100), col = "blue")
}

In the last plot, the bottom-left scatter plot does not show the axes as it should.

image

I could only reproduce this on macOS with both master and boost-beast branches but not on Ubuntu. Not sure if it occurs on Windows.

Is R 4.0 necessary?

It DESCRIPTION it says

Depends:
    R (>= 4.0.0)

I checked the dependencies, none of the packages we depend on requires R >= 4.0.

I wonder which part of the package requires R 4.0? It would be nice if we could also support R 3.6 perhaps?

installation error: Debian/ Crostini/ pixelbook

Downloading GitHub repo nx10/httpgd@master
sh: 1: /bin/gtar: not found
sh: 1: /bin/gtar: not found
Error: Failed to install 'httpgd' from GitHub:
  error in running command
In addition: Warning messages:
1: In system(cmd) : error in running command
2: In utils::untar(tarfile, ...) :
  โ€˜/bin/gtar -xf '/tmp/Rtmpea0Odf/filef83433ab298.tar.gz' -C '/tmp/Rtmpea0Odf/remotesf831c64be30'โ€™ returned error code 127

Reset par on clear

Does it make sense to reset par on clear (RStudio behavior)?

For, example, the following code uses par() before plot.

httpgd::httpgd()
utils::browseURL(httpgd::httpgdURL())
par(mfrow = c(2, 2))
m <- lm(mpg ~ cyl, data = mtcars)
plot(m)

Then if users clicks Clear button, then the plot is gone.

The difference appears when user then creates a new simple plot:

plot(rnorm(100))

In RStudio, when the plot is all cleared, the par is reset too so that a new plot will revert to par(mfrow = c(1, 1)). In httpgd at the moment, it is not reverted to default par.

I'm wondering which makes more sense?

Compilation warning on Ubuntu and error on macOS

Compiling the latest master on Ubuntu produces the following warnings:

Updating httpgd documentation
Loading httpgd
Re-compiling httpgd
โ”€  installing *source* package โ€˜httpgdโ€™ ...
   ** using staged installation
   ** libs
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c DrawData.cpp -o DrawData.o
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c FontAnalyzer.cpp -o FontAnalyzer.o
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c Httpgd.cpp -o Httpgd.o
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c HttpgdDataStore.cpp -o HttpgdDataStore.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstac   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c HttpgdDev.cpp -o HttpgdDev.o
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c HttpgdServerTask.cpp -o HttpgdServerTask.o
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c PlotHistory.cpp -o PlotHistory.o
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c RSync.cpp -o RSync.o
   In file included from HttpgdServerTask.h:7,
                    from HttpgdServerTask.cpp:1:
   BackgroundTask.h:4:11: warning: nested namespace definitions only available with โ€˜-std=c++17โ€™ or โ€˜-std=gnu++17โ€™ [-Wpedantic]
       4 | namespace httpgd::rsync
         |           ^~~~~~
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c RcppExports.cpp -o RcppExports.o
   In file included from HttpgdServerTask.h:7,
                    from HttpgdDev.h:13,
                    from Httpgd.cpp:10:
   BackgroundTask.h:4:11: warning: nested namespace definitions only available with โ€˜-std=c++17โ€™ or โ€˜-std=gnu++17โ€™ [-Wpedantic]
       4 | namespace httpgd::rsync
         |           ^~~~~~
   In file included from HttpgdServerTask.h:7,
                    from HttpgdDev.h:13,
                    from HttpgdDev.cpp:4:
   BackgroundTask.h:4:11: warning: nested namespace definitions only available with โ€˜-std=c++17โ€™ or โ€˜-std=gnu++17โ€™ [-Wpedantic]
       4 | namespace httpgd::rsync
         |           ^~~~~~
   g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/renkun/R/x86_64-pc-linux-gnu-library/4.0/gdtools/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c dummygd.cpp -o dummygd.o
   g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o httpgd.so DrawData.o FontAnalyzer.o Httpgd.o HttpgdDataStore.o HttpgdDev.o HttpgdServerTask.o PlotHistory.o RSync.o RcppExports.o dummygd.o -L/usr/lib/R/lib -lR
   installing to /tmp/Rtmp5sjVS3/devtools_install_bf0e5453209e6/00LOCK-httpgd/00new/httpgd/libs
   ** checking absolute paths in shared objects and dynamic libraries
โ”€  DONE (httpgd)

On macOS, it does not compile:

Updating httpgd documentation
Loading httpgd
Re-compiling httpgd
โ”€  installing *source* package โ€˜httpgdโ€™ ...
   ** using staged installation
   ** libs
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c DrawData.cpp -o DrawData.o
   In file included from DrawData.cpp:11:
   ./DrawData.h:66:37: warning: private field 'm_hadj' is not used [-Wunused-private-field]
               double m_x, m_y, m_rot, m_hadj;
                                       ^
   1 warning generated.
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c FontAnalyzer.cpp -o FontAnalyzer.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c Httpgd.cpp -o Httpgd.o
   In file included from Httpgd.cpp:10:
   In file included from ./HttpgdDev.h:13:
   In file included from ./HttpgdServerTask.h:7:
   ./BackgroundTask.h:4:17: warning: nested namespace definition is a C++17 extension; define each namespace separately [-Wc++17-extensions]
   namespace httpgd::rsync
                   ^~~~~~~
                    { namespace rsync
   1 warning generated.
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c HttpgdDataStore.cpp -o HttpgdDataStore.o
   HttpgdDataStore.cpp:204:13: error: call to 'abs' is ambiguous
           if (std::abs(width - old_width) > 0.1 ||
               ^~~~~~~~
   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:132:6: note: candidate function
   int      abs(int) __pure2;
            ^
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:110:44: note: candidate function
   inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
                                              ^
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:112:44: note: candidate function
   inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
                                              ^
   HttpgdDataStore.cpp:205:13: error: call to 'abs' is ambiguous
               std::abs(height - old_height) > 0.1)
               ^~~~~~~~
   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:132:6: note: candidate function
   int      abs(int) __pure2;
            ^
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:110:44: note: candidate function
   inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
                                              ^
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:112:44: note: candidate function
   inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
                                              ^
   2 errors generated.
   make: *** [HttpgdDataStore.o] Error 1
   ERROR: compilation failed for package โ€˜httpgdโ€™
โ”€  removing โ€˜/private/var/folders/8n/fdyp8ztd42gd2s61p6nzqrgh0000gn/T/RtmpnajSum/devtools_install_15ad17166457a/httpgdโ€™

Error: System command 'R' failed, exit status: 1, stdout + stderr:
E> * installing *source* package โ€˜httpgdโ€™ ...
E> ** using staged installation
E> ** libs
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c DrawData.cpp -o DrawData.o
E> In file included from DrawData.cpp:11:
E> ./DrawData.h:66:37: warning: private field 'm_hadj' is not used [-Wunused-private-field]
E>             double m_x, m_y, m_rot, m_hadj;
E>                                     ^
E> 1 warning generated.
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c FontAnalyzer.cpp -o FontAnalyzer.o
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c Httpgd.cpp -o Httpgd.o
E> In file included from Httpgd.cpp:10:
E> In file included from ./HttpgdDev.h:13:
E> In file included from ./HttpgdServerTask.h:7:
E> ./BackgroundTask.h:4:17: warning: nested namespace definition is a C++17 extension; define each namespace separately [-Wc++17-extensions]
E> namespace httpgd::rsync
E>                 ^~~~~~~
E>                  { namespace rsync
E> 1 warning generated.
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c HttpgdDataStore.cpp -o HttpgdDataStore.o
E> HttpgdDataStore.cpp:204:13: error: call to 'abs' is ambiguous
E>         if (std::abs(width - old_width) > 0.1 ||
E>             ^~~~~~~~
E> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:132:6: note: candidate function
E> int      abs(int) __pure2;
E>          ^
E> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:110:44: note: candidate function
E> inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
E>                                            ^
E> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:112:44: note: candidate function
E> inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
E>                                            ^
E> HttpgdDataStore.cpp:205:13: error: call to 'abs' is ambiguous
E>             std::abs(height - old_height) > 0.1)
E>             ^~~~~~~~
E> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:132:6: note: candidate function
E> int      abs(int) __pure2;
E>          ^
E> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:110:44: note: candidate function
E> inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
E>                                            ^
E> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:112:44: note: candidate function
E> inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
E>                                            ^
E> 2 errors generated.
E> make: *** [HttpgdDataStore.o] Error 1
E> ERROR: compilation failed for package โ€˜httpgdโ€™
E> * removing โ€˜/private/var/folders/8n/fdyp8ztd42gd2s61p6nzqrgh0000gn/T/RtmpnajSum/devtools_install_15ad17166457a/httpgdโ€™

 Stack trace:

 1. devtools::document()
 2. withr::with_envvar(r_env_vars(), roxygen2::roxygenise(pkg$path,  ...
 3. base:::force(code)
 4. roxygen2::roxygenise(pkg$path, roclets, load_code = load_code)
 5. roxygen2:::load_code(base_path)
 6. pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
 7. pkgbuild::compile_dll(path, quiet = quiet)
 8. withr::with_makevars(compiler_flags(TRUE), assignment = "+=",  ...
 9. withr:::with_envvar(c(R_MAKEVARS_USER = makevars_file), { ...
 10. base:::force(code)
 11. base:::force(code)
 12. pkgbuild:::install_min(path, dest = install_dir, components = "libs",  ...
 13. pkgbuild:::rcmd_build_tools("INSTALL", c(path, paste("--library=",  ...
 14. pkgbuild:::with_build_tools(callr::rcmd_safe(..., env = env,  ...
 15. callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE,  ...
 16. callr:::run_r(options)
 17. base:::with(options, with_envvar(env, do.call(processx::run,  ...
 18. base:::with.default(options, with_envvar(env, do.call(processx::run,  ...
 19. base:::eval(substitute(expr), data, enclos = parent.frame())
 20. base:::eval(substitute(expr), data, enclos = parent.frame())
 21. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmd ...
 22. base:::force(code)
 23. base:::do.call(processx::run, c(list(bin, args = real_cmdargs,  ...
 24. (function (command = NULL, args = character(), error_on_status = TRUE,  ...
 25. throw(new_process_error(res, call = sys.call(), echo = echo,  ...

 x System command 'R' failed, exit status: 1, stdout + stderr:
E> * installing *source* package โ€˜httpgdโ€™ ...
E> ** using staged installation
E> ** libs
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c DrawData.cpp -o DrawData.o
E> In file included from DrawData.cpp:11:
E> ./DrawData.h:66:37: warning: private field 'm_hadj' is not used [-Wunused-private-field]
E>             double m_x, m_y, m_rot, m_hadj;
E>                                     ^
E> 1 warning generated.
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c FontAnalyzer.cpp -o FontAnalyzer.o
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c Httpgd.cpp -o Httpgd.o
E> In file included from Httpgd.cpp:10:
E> In file included from ./HttpgdDev.h:13:
E> In file included from ./HttpgdServerTask.h:7:
E> ./BackgroundTask.h:4:17: warning: nested namespace definition is a C++17 extension; define each namespace separately [-Wc++17-extensions]
E> namespace httpgd::rsync
E>                 ^~~~~~~
E>                  { namespace rsync
E> 1 warning generated.
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gdtools/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c HttpgdDataStore.cpp -o HttpgdDataStore.o
E> HttpgdDataStore.cpp:204:13: error: call to 'abs' is ambiguous
E>         if (std::abs(width - old_width) > 0.1 ||
E>             ^~~~~~~~
E> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:132:6: note: candidate function
E> int      abs(int) __pure2;
E>          ^
E> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:110:44: note: candidate function
E> inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
E>                                            ^
E> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:112:44: note: candidate function
E> inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
E>                                            ^
E> HttpgdDataStore.cpp:205:13: error: call to 'abs' is ambiguous
E>             std::abs(height - old_height) > 0.1)
E>             ^~~~~~~~
E> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:132:6: note: candidate function
E> int      abs(int) __pure2;
E>          ^
E> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:110:44: note: candidate function
E> inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
E>                                            ^
E> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:112:44: note: candidate function
E> inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
E>                                            ^
E> 2 errors generated.
E> make: *** [HttpgdDataStore.o] Error 1
E> ERROR: compilation failed for package โ€˜httpgdโ€™
E> * removing โ€˜/private/var/folders/8n/fdyp8ztd42gd2s61p6nzqrgh0000gn/T/RtmpnajSum/devtools_install_15ad17166457a/httpgdโ€™ 

Backtrace:
1: stop(cond)
2: throw(new_process_error(res, call = sys.call(), echo = echo, 
3: (function (command = NULL, args = character(), error_on_status = TRUE, 
4: do.call(processx::run, c(list(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), 
5: force(code)
6: with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmdargs, 
7: eval(substitute(expr), data, enclos = parent.frame())
8: eval(substitute(expr), data, enclos = parent.frame())
9: with.default(options, with_envvar(env, do.call(processx::run, 
10: with(options, with_envvar(env, do.call(processx::run, c(list(bin, 
11: run_r(options)
12: callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE, 
13: with_build_tools(callr::rcmd_safe(..., env = env, spinner = FALSE, 
14: rcmd_build_tools("INSTALL", c(path, paste("--library=", dest, 
15: install_min(path, dest = install_dir, components = "libs", args = if (needs_clean(path)) "--preclean", 
16: force(code)
17: force(code)
18: with_envvar(c(R_MAKEVARS_USER = makevars_file), {
19: withr::with_makevars(compiler_flags(TRUE), assignment = "+=", 
20: pkgbuild::compile_dll(path, quiet = quiet)
21: pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
22: load_code(base_path)
23: roxygen2::roxygenise(pkg$path, roclets, load_code = load_code)
24: force(code)
25: withr::with_envvar(r_env_vars(), roxygen2::roxygenise(pkg$path, 
26: devtools::document()
Exiting on error

Keyboard shortcuts for toolbar buttons

The toolbar works nicely in web browser. I'm wondering if it is possible to add some keyboard shortcuts to those toolbar buttons, e.g.

left, right, +, -, ctrl+s, del

Multiple viewers in different sizes trigger resize on all viewer

If the web page is open on multiple places (e.g. one in web browser, the other in VSCode WebView), the resize of one viewer might cause all viewers to resize, or sometimes the viewer falls into resizing to different sizes endlessly.

I'm curious if there's a good way to handle multiple viewer while apparently the R session could only replay the plot (I'm not 100% sure if the resizing is implemented by replay?) for one certain size.

Toolbar not working in VSCode webview

In VSCode with vscode-R and session watcher enabled, I use the following code to view the graphics presented by httpgd:

httpgd::httpgd()
getOption("browser")("http://localhost:8288/live")

plot(rnorm(100), main = "title")
abline(h = 0, col = "red")

The grahpics looks nice but the toolbar does not seem to work. Whenever I click any button the toolbar disappears and nothing happens.

image

ggplot2 issue when deleting plots

If the last plot is removed and the second to last plot is a ggplot2 plot it will not be re-rendered correctly after resizing (that plot will be blank).

Plot not updated under remote development

I'm on the latest commit (3c8507d) and find that the plot is not updated on adding elements under Remote Development environment.

For example,

httpgd::httpgd(port = 13588)
utils::browseURL(httpgd::httpgdURL())

plot(rnorm(100), main = "title")
abline(h = 0, col = "red")
points(rnorm(100), col = "blue")

Running plot() works well. But subsequent abline() and points() mostly do not update the plot as I run the code line by line. Resizing the page does not make the plot correct either. However, if I select the three lines and run them together, the plot is correct.

I tested with older version (7e3d8c3) and there's no such problem.

Kapture 2020-05-31 at 13 11 01

HGD bg option

Hi there,

I've been trying to use the bg option for hgd(), but it doesn't seem to be affecting the colour of the viewer from what I can tell.

E.g.
httpgd::hgd(bg = "blue", silent = TRUE)
.vsc.browser(httpgd::hgd_url(), "R Plots", viewer = "Beside")

^ here, the viewer still uses a white background

Am I using this correctly? Thanks!

Unable to Download Plot

First of all, thank you for making this package! An interactive plot viewer is what held me back from migrating to VSCode from RStudio and you made this possible!

So, I am running the VSCode in WSL2 (Ubuntu 20.04). The plots were displayed just fine. All the toolbars work. However, when I tried to download the plot, nothing was saved.

What information should I add to help you troubleshoot this? Thanks in advance.

Best regards,
Mikhael

save as png?

I know it's not necessarily an easy thing, have you considered adding a "save as png" option? I know I can do a screenshot, but that suggests either imperfect borders (e.g., in windows, ctrl-shift-s screen snip, drag across the rectangle of screen to save); or including browser tabs/components in the image (printscreen, either full or just single-app alt-prtscrn), which often requires post-shot editing.

Suggested options:

  1. In R, just open a png(), replay the plot, and save and export to the browser. (I expect this would be on-demand, but in a pinch you could always produce both svg and png for quick export.)
  2. In javascript, where a hasty search presents some approaches: https://www.npmjs.com/package/save-svg-as-png and https://stackoverflow.com/q/3975499 (several, though most out-dated).

Thanks again!

dev.off() should show something in client

If we do:

> dev.off()
Server closing... Closed.
httpgd
     2

The client just dies. It would be nice if the html/js client would somehow get a notification that the device has been closed (and stop polling ๐Ÿ˜„ )

Build error on macOS

I'm not able to build the latest master on macOS 11.2. Following is the error message:

โœ”  checking for file โ€˜/Users/ken/Workspaces/github/httpgd/DESCRIPTIONโ€™ ...
โ”€  preparing โ€˜httpgdโ€™: (665ms)
โœ”  checking DESCRIPTION meta-information ...
โ”€  cleaning src
โ”€  checking for LF line-endings in source and make files and shell scripts
โ”€  checking for empty or unneeded directories
   Removed empty directory โ€˜httpgd/inst/www/typingsโ€™
โ”€  building โ€˜httpgd_1.0.1.tar.gzโ€™
   
Running /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL \
  /var/folders/8n/fdyp8ztd42gd2s61p6nzqrgh0000gn/T//Rtmp8lsXTS/httpgd_1.0.1.tar.gz \
  --install-tests 
* installing to library โ€˜/Library/Frameworks/R.framework/Versions/4.0/Resources/libraryโ€™
* installing *source* package โ€˜httpgdโ€™ ...
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cpp11/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c AsyncLater.cpp -o AsyncLater.o
clang++ -mmacosx-version-min=10.13 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilib -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cpp11/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/later/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c DrawData.cpp -o DrawData.o
In file included from DrawData.cpp:11:
./lib/svglite_utils.h:169:13: error: use of undeclared identifier 'get_font_family'
        if (get_font_family(font.file, font.index, family_name, MAX_FONT_FAMILY_LEN))
            ^
1 error generated.
make: *** [DrawData.o] Error 1
ERROR: compilation failed for package โ€˜httpgdโ€™
* removing โ€˜/Library/Frameworks/R.framework/Versions/4.0/Resources/library/httpgdโ€™
* restoring previous โ€˜/Library/Frameworks/R.framework/Versions/4.0/Resources/library/httpgdโ€™

Error: System command 'R' failed, exit status: 1, stdout & stderr were printed

 Stack trace:

 1. devtools::install(upgrade = "never")
 2. pkgbuild::with_build_tools(required = FALSE, callr::rcmd("INSTALL",  ...
 3. callr::rcmd("INSTALL", c(install_path, opts), echo = !quiet,  ...
 4. callr:::run_r(options)
 5. base:::with(options, with_envvar(env, do.call(processx::run,  ...
 6. base:::with.default(options, with_envvar(env, do.call(processx::run,  ...
 7. base:::eval(substitute(expr), data, enclos = parent.frame())
 8. base:::eval(substitute(expr), data, enclos = parent.frame())
 9. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmd ...
 10. base:::force(code)
 11. base:::do.call(processx::run, c(list(bin, args = real_cmdargs,  ...
 12. (function (command = NULL, args = character(), error_on_status = TRUE,  ...
 13. throw(new_process_error(res, call = sys.call(), echo = echo,  ...

 x System command 'R' failed, exit status: 1, stdout & stderr were printed 

Backtrace:
1: stop(cond)
2: throw(new_process_error(res, call = sys.call(), echo = echo, 
3: (function (command = NULL, args = character(), error_on_status = TRUE, 
4: do.call(processx::run, c(list(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), 
5: force(code)
6: with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmdargs, 
7: eval(substitute(expr), data, enclos = parent.frame())
8: eval(substitute(expr), data, enclos = parent.frame())
9: with.default(options, with_envvar(env, do.call(processx::run, 
10: with(options, with_envvar(env, do.call(processx::run, c(list(bin, 
11: run_r(options)
12: callr::rcmd("INSTALL", c(install_path, opts), echo = !quiet, 
13: pkgbuild::with_build_tools(required = FALSE, callr::rcmd("INSTALL", 
14: devtools::install(upgrade = "never")
Exiting on error

Bug Report Device is not of type httpgd

httpgd::httpgd()
#> httpgd live server running at:
#>   http://127.0.0.1:64029/live?token=iyrJrYxw

Created on 2020-06-24 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                                              
#>  version  R version 3.6.0 (2019-04-26)                       
#>  os       Windows 7 x64 SP 1                                 
#>  system   x86_64, mingw32                                    
#>  ui       RTerm                                              
#>  language (EN)                                               
#>  collate  Chinese (Simplified)_People's Republic of China.936
#>  ctype    Chinese (Simplified)_People's Republic of China.936
#>  tz       Asia/Taipei                                        
#>  date     2020-06-24                                         
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version    date       lib source                        
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.2)                
#>  backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.1)                
#>  callr         3.2.0      2019-03-15 [1] CRAN (R 3.6.0)                
#>  cli           2.0.1      2020-01-08 [1] CRAN (R 3.6.2)                
#>  crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                
#>  desc          1.2.0      2018-05-01 [1] CRAN (R 3.6.0)                
#>  devtools      2.1.0      2019-07-06 [1] CRAN (R 3.6.1)                
#>  digest        0.6.19     2019-05-20 [1] CRAN (R 3.6.0)                
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                
#>  fansi         0.4.0      2018-10-05 [1] CRAN (R 3.6.0)                
#>  fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.0)                
#>  glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.6.0)                
#>  htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.1)                
#>  httpgd        0.4.0      2020-06-24 [1] local                         
#>  knitr         1.27       2020-01-16 [1] CRAN (R 3.6.2)                
#>  later         1.0.0      2019-10-04 [1] CRAN (R 3.6.1)                
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.1)                
#>  memoise       1.1.0      2017-04-21 [1] CRAN (R 3.6.1)                
#>  pkgbuild      1.0.3      2019-03-20 [1] CRAN (R 3.6.1)                
#>  pkgload       1.0.2      2018-10-29 [1] CRAN (R 3.6.1)                
#>  prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.6.0)                
#>  processx      3.3.1      2019-05-08 [1] CRAN (R 3.6.0)                
#>  ps            1.3.0      2018-12-21 [1] CRAN (R 3.6.0)                
#>  R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.2)                
#>  Rcpp          1.0.4.6    2020-04-09 [1] CRAN (R 3.6.3)                
#>  remotes       2.1.0      2019-06-24 [1] CRAN (R 3.6.1)                
#>  rlang         0.4.4      2020-01-28 [1] CRAN (R 3.6.0)                
#>  rmarkdown     2.1        2020-01-20 [1] CRAN (R 3.6.2)                
#>  rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)                
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                
#>  stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                
#>  systemfonts   0.2.3      2020-06-09 [1] CRAN (R 3.6.3)                
#>  testthat      2.3.2      2020-03-02 [1] CRAN (R 3.6.3)                
#>  usethis       1.5.1.9000 2020-02-04 [1] Github (r-lib/usethis@e7c1f17)
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                
#>  xfun          0.8        2019-06-25 [1] CRAN (R 3.6.1)                
#>  yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                
#> 
#> [1] C:/Program Files/R/R-3.6.0/library

When I run httpgd::httpgdBrowse() to open the URL, I get this error.

Error in httpgdState(which) : Device is not of type httpgd
5.
stop("Device is not of type httpgd")
4.
httpgdState(which)
3.
httpgdURL(endpoint, which)
2.
browseURL(httpgdURL(endpoint, which))
1.
httpgd::httpgdBrowse()

Delete a single plot

Currently, the plot history could be all cleared at once. I'm wondering if it is possible to add a Remove button and shortcut to remove the current plot, just like in RStudio?

Also, it might make more sense to use del as the shortcut for this Remove rather than Clear (which is much more destructive).

Persistent startup port and options

[...]
For users who would really prefer to not type in ports and/or tokens each time, you might consider adding options, where the defaults are sane (allowing them to set personal prefs in ~/.Rprofile):

httpgd <-
  function(host = getOption("httpgd.host", "127.0.0.1"),
           port = getOption("httpgd.port", 0L),
           width = 720,
           height = 576,
           bg = "white",
           pointsize = 12,
           system_fonts = list(),
           user_fonts = list(),
           recording = TRUE,
           cors = FALSE,
           token = getOption("httpgd.token", TRUE)) {

In related packages, I've found it useful when the "random port" remains constant for the current R session. It's not hard to do: generate a random port and token in .onLoad and/or you can use a local({ ... function(...) {... } }) trick for a function (likely httpgd::httpgd).

[...]

Originally posted by @r2evans in #5 (comment)

[Question] How to recall/reopen plot window in Rmarkdown

Hi, thanks for this super work. Plotting in R is splendid now.
(Un)fortunately I need to work with some RMarkdown files.

Plotting works in RMarkdown for me, but when I close the plot window -
I am having difficulty getting it back. I have tried to edit the keyboard shortcut as below to include 'rmd'

    {
        "key": "shift+alt+p",
        "command": "r.runCommand",
        "when": "editorTextFocus && editorLangId == 'r' || 'rmd'",
        "args": ".vsc.browser(httpgd::hgd_url(), viewer = \"Beside\")"
    }

Am I missing something in the when: bit of the keybindings.json?

Nb. manually running .vsc.browser(httpgd::hgd_url(), viewer = "Beside") in R Interactive terminal works.
I think its just the way my keyboard shortcut is setup wrong? Thanks, David.

winOS install problem

I am trying to install on winOS and am getting this error even though systemfonts is installed

session info
- Session info -------------------------------------------------------------------------------------
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/New_York            
 date     2020-12-18                  

- Packages -----------------------------------------------------------------------------------------
 ! package     * version   date       lib source                       
 P assertthat    0.2.1     2019-03-21 [?] CRAN (R 4.0.2)               
   backports     1.2.0     2020-11-02 [1] CRAN (R 4.0.3)               
 P callr         3.4.3     2020-03-28 [?] CRAN (R 4.0.2)               
   cli           2.2.0     2020-11-20 [1] CRAN (R 4.0.3)               
 P clipr         0.7.0     2019-07-23 [?] CRAN (R 4.0.2)               
 P crayon        1.3.4     2017-09-16 [?] CRAN (R 4.0.2)               
 P curl          4.3       2019-12-02 [?] CRAN (R 4.0.2)               
 P desc          1.2.0     2018-05-01 [?] CRAN (R 4.0.2)               
 P details       0.2.1     2020-09-08 [?] local                        
 P fansi         0.4.1     2020-01-08 [?] CRAN (R 4.0.2)               
 P glue          1.4.2     2020-08-27 [?] CRAN (R 4.0.2)               
 P httr          1.4.2     2020-07-20 [?] CRAN (R 4.0.2)               
 P knitr         1.30      2020-09-22 [?] CRAN (R 4.0.3)               
   magrittr      2.0.1     2020-11-17 [1] CRAN (R 4.0.3)               
 P pkgbuild      1.1.0     2020-07-13 [?] CRAN (R 4.0.2)               
 P png           0.1-7     2013-12-03 [?] CRAN (R 4.0.0)               
 P prettyunits   1.1.1     2020-01-24 [?] CRAN (R 4.0.2)               
 P processx      3.4.3     2020-07-05 [?] CRAN (R 4.0.2)               
   ps            1.5.0     2020-12-05 [1] CRAN (R 4.0.3)               
   R6            2.5.0     2020-10-28 [1] CRAN (R 4.0.3)               
   remotes       2.2.0     2020-07-21 [1] standard (@2.2.0)            
 P renv          0.12.2-13 2020-11-13 [?] Github (rstudio/renv@d022cac)
 P rprojroot     1.3-2     2018-01-03 [?] CRAN (R 4.0.2)               
 P rstudioapi    0.11      2020-02-07 [?] CRAN (R 4.0.2)               
 P sessioninfo   1.1.1     2018-11-05 [?] CRAN (R 4.0.2)               
 P systemfonts * 0.3.2     2020-09-29 [?] CRAN (R 4.0.2)               
   withr         2.3.0     2020-09-22 [1] CRAN (R 4.0.2)               
 P xfun          0.18      2020-09-29 [?] CRAN (R 4.0.3)               
 P xml2          1.3.2     2020-04-23 [?] CRAN (R 4.0.2)               

[1] C:/Users/jonathan.sidi/AppData/Local/Temp/RtmpUnUva6/renv-system-library

 P -- Loaded and on-disk path mismatch.

> install.packages('systemfonts')
Installing systemfonts [0.3.2] ...
	OK [linked cache]
> remotes::install_github('nx10/httpgd')
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo nx10/httpgd@HEAD
โˆš  checking for file 'C:\Users\jonathan.sidi\AppData\Local\Temp\RtmpUnUva6\remotes70e433714c3a\nx10-httpgd-2ca04f6/DESCRIPTION' (3.3s)
-  preparing 'httpgd': (16.4s)
โˆš  checking DESCRIPTION meta-information ... 
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts (3.9s)
-  checking for empty or unneeded directories (10.5s)
-  building 'httpgd_1.0.0.tar.gz' (959ms)
   
Installing package into โ€˜C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32โ€™
(as โ€˜libโ€™ is unspecified)
* installing *source* package 'httpgd' ...
** using staged installation
** libs

*** arch - i386
rm -f AsyncLater.o DrawData.o Httpgd.o HttpgdApiAsync.o HttpgdDataStore.o HttpgdDev.o HttpgdWebServer.o PlotHistory.o RcppExports.o devGeneric.o
"C:/PROGRA~1/R/R-40~1.2/bin/i386/Rscript.exe" "../tools/winlibs.R" 
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c AsyncLater.cpp -o AsyncLater.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c DrawData.cpp -o DrawData.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c Httpgd.cpp -o Httpgd.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c HttpgdApiAsync.cpp -o HttpgdApiAsync.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c HttpgdDataStore.cpp -o HttpgdDataStore.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c HttpgdDev.cpp -o HttpgdDev.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c HttpgdWebServer.cpp -o HttpgdWebServer.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c PlotHistory.cpp -o PlotHistory.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
"C:/rtools40/mingw32/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c devGeneric.cpp -o devGeneric.o
C:/rtools40/mingw32/bin/g++ -shared -s -static-libgcc -o httpgd.dll tmp.def AsyncLater.o DrawData.o Httpgd.o HttpgdApiAsync.o HttpgdDataStore.o HttpgdDev.o HttpgdWebServer.o PlotHistory.o RcppExports.o devGeneric.o -L../windows/baselibs-3.5.0/lib/i386 -lpng -lz -lWs2_32 -lwsock32 -LC:/PROGRA~1/R/R-40~1.2/bin/i386 -lR
installing to C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/00LOCK-httpgd/00new/httpgd/libs/i386

*** arch - x64
rm -f AsyncLater.o DrawData.o Httpgd.o HttpgdApiAsync.o HttpgdDataStore.o HttpgdDev.o HttpgdWebServer.o PlotHistory.o RcppExports.o devGeneric.o
"C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript.exe" "../tools/winlibs.R" 
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c AsyncLater.cpp -o AsyncLater.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c DrawData.cpp -o DrawData.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c Httpgd.cpp -o Httpgd.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c HttpgdApiAsync.cpp -o HttpgdApiAsync.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c HttpgdDataStore.cpp -o HttpgdDataStore.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c HttpgdDev.cpp -o HttpgdDev.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c HttpgdWebServer.cpp -o HttpgdWebServer.o
In file included from lib/boost/beast/http/detail/basic_parser.hpp:14,
                 from lib/boost/beast/http/basic_parser.hpp:18,
                 from lib/boost/beast/http.hpp:17,
                 from lib/belle.h:84,
                 from HttpgdWebServer.h:5,
                 from HttpgdWebServer.cpp:2:
In member function 'bool boost::beast::detail::char_buffer<N>::try_append(const char*, const char*) [with long long unsigned int N = 4096]',
    inlined from 'void boost::beast::http::basic_parser<isRequest>::parse_fields(const char*&, const char*, boost::beast::error_code&) [with bool isRequest = true]' at lib/boost/beast/http/detail/basic_parser.ipp:655:32:
lib/boost/beast/core/detail/char_buffer.hpp:39:21: warning: 'void* memmove(void*, const void*, size_t)' forming offset [-9223372036854771705, 4105] is out of the bounds [0, 4104] of object 'buf' with type 'boost::beast::detail::char_buffer<4096>' [-Warray-bounds]
         std::memmove(&buf_[size_], first, n);
         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from lib/boost/beast/http/basic_parser.hpp:689,
                 from lib/boost/beast/http.hpp:17,
                 from lib/belle.h:84,
                 from HttpgdWebServer.h:5,
                 from HttpgdWebServer.cpp:2:
lib/boost/beast/http/impl/basic_parser.ipp: In member function 'void boost::beast::http::basic_parser<isRequest>::parse_fields(const char*&, const char*, boost::beast::error_code&) [with bool isRequest = true]':
lib/boost/beast/http/impl/basic_parser.ipp:408:46: note: 'buf' declared here
     beast::detail::char_buffer<max_obs_fold> buf;
                                              ^~~
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c PlotHistory.cpp -o PlotHistory.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++17 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -Ilib -I../windows/baselibs-3.5.0/include -DSTRICT_R_HEADERS -DBOOST_NO_AUTO_PTR -DFMT_HEADER_ONLY -DRCPP_USE_UNWIND_PROTECT -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/Rcpp/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/BH/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/later/include' -I'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/systemfonts/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c devGeneric.cpp -o devGeneric.o
C:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o httpgd.dll tmp.def AsyncLater.o DrawData.o Httpgd.o HttpgdApiAsync.o HttpgdDataStore.o HttpgdDev.o HttpgdWebServer.o PlotHistory.o RcppExports.o devGeneric.o -L../windows/baselibs-3.5.0/lib/x64 -lpng -lz -lWs2_32 -lwsock32 -LC:/PROGRA~1/R/R-40~1.2/bin/x64 -lR
installing to C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/00LOCK-httpgd/00new/httpgd/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'httpgd'
    finding HTML links ... done
    hgd                                     html  
    hgd_browse                              html  
    hgd_clear                               html  
    hgd_close                               html  
    hgd_generate_token                      html  
    hgd_remove                              html  
    hgd_state                               html  
    hgd_svg                                 html  
    hgd_url                                 html  
    httpgd-package                          html  
    hyperrefstyle                           html  
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'httpgd' in library.dynam(lib, package, package.lib):
 DLL 'systemfonts' not found: maybe not installed for this architecture?
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/trials/217-MDD-303/renv/library/R-4.0/x86_64-w64-mingw32/httpgd'
Error: Failed to install 'httpgd' from GitHub:
  (converted from warning) installation of package โ€˜C:/Users/JONATH~1.SID/AppData/Local/Temp/RtmpUnUva6/file70e47a1b7ce4/httpgd_1.0.0.tar.gzโ€™ had non-zero exit status
In addition: Warning messages:
1: In untar2(tarfile, files, list, exdir, restore_times) :
  skipping pax global extended headers
2: In untar2(tarfile, files, list, exdir, restore_times) :
  skipping pax global extended headers

Font handling is strange?

I originally reported this as an issue with the {sftheme}
amirmasoudabdol/sfthemes#3
This is occurring with
When using this theme that uses the Inter family of fonts, everything works well, except for a strange issue where ggplot legend title doesn't respect the font settings.
The wrong face is used for the bold legend title in VS Code WebView or in Chrome, as well as when saved to png. (Incidentally, in Mac OS Safari I don't get any of the text elements in Inter...)
plot
Here's the output from ggsave():
test

I have the whole Inter family installed, MacOS Big Sur, M1, using {systemfonts} and {extrafont} if that helps.

Switch to BH/Beast

Boost Beast will be included in BH after the Boost 1.75 release in December 2020.
After that all Boost headers can be removed from the httpgd code base.

See: eddelbuettel/bh#74

API documentation vignette

With the static IDs implemented, the httpgd core APIs (R+HTTP/WebSockets) should be stable.
The markdown documentation should be updated and compiled into a single easy to understand vignette that contains everything needed to use the httpgd API for application and package developers.

live share compatibility or other possibility for remote view of a plot?

I am not sure if this is possible, but is there a way to expose the http server to live share participants? This way plots would be visible for other participants to see, which currently does not seem to be possible without azure

alternatively accessing the http server from outside the network does not seem to work? I have set up the server with a port that is accessable from outside the home network, but the server will refuse outside connections.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.