Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
10f4dac
Support renderValue within iframe
Dec 12, 2018
0a909c8
Use react instead of newPlot as it is more efficient
Dec 12, 2018
256ed20
Revert "Use react instead of newPlot as it is more efficient"
Jul 4, 2019
8a10cdf
Add yaml for auto-P.R./fork updating; RS-2202
Nov 21, 2019
32dde41
[pull] master from ropensci:master (#2)
pull[bot] Mar 12, 2020
8200dbe
Merge branch 'master' of https://github.com/ropensci/plotly into rope…
chschan Jun 1, 2020
3989267
Update svgs from ropensci-master
chschan Jun 1, 2020
ecaa8ac
Merge branch 'ropensci-master'
chschan Jun 1, 2020
657a7bb
Fix previous commit
chschan Jun 1, 2020
8324fae
[pull] master from ropensci:master (#4)
pull[bot] Jun 22, 2020
2349a7d
Merge branch 'master' of https://github.com/ropensci/plotly
chschan Jun 24, 2020
607e377
[pull] master from ropensci:master (#6)
pull[bot] Jun 26, 2020
f41218c
Merge branch 'master' of https://github.com/ropensci/plotly into rope…
chschan Jul 31, 2020
02f8da5
Merge branch 'ropensci-master7'
chschan Jul 31, 2020
d0cf5f4
RS-7135: updated plotly version
alexhartstone Dec 9, 2020
ca92af8
RS-7135: Updated the plotly minified js
alexhartstone Dec 15, 2020
894f509
Merge pull request #9 from Displayr/RS-7135-version-1.58
alexhartstone Dec 15, 2020
94011cb
Resolve conflicts
chschan Dec 26, 2020
b6cb77b
Merge pull #8
chschan Dec 26, 2020
3d3c779
Fix merge from ropensci #8
chschan Dec 26, 2020
3c88590
RS-7135: re-setting plotly-latest to 1.58
alexhartstone Jan 15, 2021
9a1ad5b
Merge pull request #11 from Displayr/RS-7135-version-1.58-2
alexhartstone Jan 15, 2021
af6140d
untracked: updated plotly.js to 1.58 once more
alexhartstone Feb 25, 2021
d971809
plotly.js autoMargin minWidth and Height patched to 1
alexhartstone Feb 26, 2021
be2dfc1
Merge pull request #12 from Displayr/plotly-1-58-round2
alexhartstone Feb 26, 2021
593be3c
Merge PR from ropensci to update to version 4.9.3
chschan May 27, 2021
69d6149
Add back missing layout attribute
chschan May 27, 2021
1b3d485
Merge branch 'ropensci-master'
chschan May 27, 2021
306050e
Require widget to be attached to dom when calling resize
JustinCCYap Sep 7, 2021
cccc65e
Pass element instead of ID
JustinCCYap Sep 7, 2021
b25bc4b
Remove condition
JustinCCYap Sep 7, 2021
0e4abf9
Merge pull request #14 from Displayr/VIS-992
JustinCCYap Sep 7, 2021
645731f
VIS-992: add test, use rhtmlBuildUtils (#15)
JustinCCYap Sep 9, 2021
c78900c
Bump version
JustinCCYap Sep 9, 2021
f861966
Merge branch 'master' of https://github.com/Displayr/plotly
JustinCCYap Sep 9, 2021
af79008
VIS-933: add rhtmlwidget-status attribute (#16)
JustinCCYap Oct 6, 2021
9aa9d83
RS-8842: Use plotly.js with hovertext fix
chschan Nov 24, 2021
1a1539e
RS-8842: bump version
chschan Nov 26, 2021
ea39644
RS-8842: update bundle with more hovertext fixes
chschan Dec 4, 2021
73df246
RS-8842: fix scaling factor in alignHoverText
chschan Dec 9, 2021
fc2db03
VIS-1026: Update bundle to redraw annotations after resize
chschan Dec 16, 2021
ff9bb78
VIS-1064: fix PPT exporting issue (#17)
JustinCCYap Mar 24, 2022
99fc3fc
VIS-1060: Add check for type before applying hovertemplateString
chschan May 24, 2022
55f49ee
Plotly june2022 (#18)
chschan Jul 4, 2022
e74b2cf
DS-4804 Remove the QTable class from plotly input data elements (#19)
jrwishart Jun 27, 2023
6ef95b7
DS-4804 Fixup and add unit test
jrwishart Jul 14, 2023
9603940
DS-4804 Use CircleCI instead of actions
jrwishart Jul 14, 2023
135887d
DS-4804 Prod CCI
jrwishart Jul 14, 2023
c3259d3
DS-4804 Try viz CCI config
jrwishart Jul 14, 2023
c14b8b2
DS-4804 don't split job
jrwishart Jul 14, 2023
8088bdc
DS-4804 Remove CCI for now
jrwishart Jul 14, 2023
39337c2
DS-4804 Real fix this time
jrwishart Jul 14, 2023
b95fd2f
DS-4804 Allow test to work on earlier R versions
jrwishart Jul 14, 2023
f8a9ec6
Merge pull request #20 from Displayr/DS-4804-2
mwmclean Jul 14, 2023
4c7f410
DS-4923 Only check QTable class (#21)
jrwishart Aug 4, 2023
e339280
FS2-2955: Update to use plotly 2.35.2 (#22)
chschan Nov 28, 2024
cfaeb51
DPI-2832 Pack plotly in nix
brucetan-displayr Mar 4, 2025
8ff12e2
update format
brucetan-displayr Mar 4, 2025
6b7111f
Merge pull request #23 from Displayr/DPI-2832
brucetan-displayr Mar 5, 2025
7879804
Support renderValue within iframe
Dec 12, 2018
7c75af8
Add yaml for auto-P.R./fork updating; RS-2202
Nov 21, 2019
8eae641
Add back missing layout attribute
chschan May 27, 2021
d06ecb9
Require widget to be attached to dom when calling resize
JustinCCYap Sep 7, 2021
c1826e2
Pass element instead of ID
JustinCCYap Sep 7, 2021
ce19f9d
Remove condition
JustinCCYap Sep 7, 2021
ad82656
VIS-992: add test, use rhtmlBuildUtils (#15)
JustinCCYap Sep 9, 2021
1375ad4
VIS-933: add rhtmlwidget-status attribute (#16)
JustinCCYap Oct 6, 2021
74af4f1
VIS-1064: fix PPT exporting issue (#17)
JustinCCYap Mar 24, 2022
8bbd968
DS-4804 Remove the QTable class from plotly input data elements (#19)
jrwishart Jun 27, 2023
f1aa244
DS-4804 Fixup and add unit test
jrwishart Jul 14, 2023
d4a9a61
DS-4804 Use CircleCI instead of actions
jrwishart Jul 14, 2023
746c595
DS-4804 Prod CCI
jrwishart Jul 14, 2023
32ffd8d
DS-4804 Try viz CCI config
jrwishart Jul 14, 2023
3870cde
DS-4804 don't split job
jrwishart Jul 14, 2023
58ba959
DS-4804 Remove CCI for now
jrwishart Jul 14, 2023
aee4d91
DS-4804 Real fix this time
jrwishart Jul 14, 2023
86ff33f
DS-4804 Allow test to work on earlier R versions
jrwishart Jul 14, 2023
d6c36ce
DS-4923 Only check QTable class (#21)
jrwishart Aug 4, 2023
41093a1
FS2-2955: Update to use plotly 2.35.2 (#22)
chschan Nov 28, 2024
78a2a20
DPI-2832 Pack plotly in nix
brucetan-displayr Mar 4, 2025
dfd650e
update format
brucetan-displayr Mar 4, 2025
aec90fb
Call Plotly.newPlot instead of Plotly.plot
chschan Sep 28, 2025
c93d0b2
Fix QTable test
chschan Sep 28, 2025
e920751
Merge branch 'master' into cc-rebase-plotly4.11
chschan Sep 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ README.Rmd
abbvie.R
^\.httr-oauth$
^\.github$
^\.circleci$
42 changes: 42 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: 2.1
jobs:
test:
docker:
- image: cimg/base:stable
steps:
# - checkout
# Replace this with a real test runner invocation
- run:
name: Run tests
command: echo 'replace me with real tests!' && true
build:
docker:
- image: cimg/base:stable
steps:
- checkout
# Replace this with steps to build a package, or executable
- run:
name: Build an artifact
command: touch example.txt
- store_artifacts:
path: example.txt
deploy:
# This is an example deploy job, not actually used by the workflow
docker:
- image: cimg/base:stable
steps:
# Replace this with steps to deploy to users
- run:
name: deploy
command: '#e.g. ./deploy.sh'
workflows:
example:
jobs:
- test
#- build:
# requires:
# - test
- deploy:
requires:
- test

9 changes: 9 additions & 0 deletions .github/pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "1"
rules:
- base: master
upstream: ropensci:master # change `wei` to the owner of upstream repo
mergeMethod: none
assignees:
- chschan
reviewers:
- chschan
109 changes: 0 additions & 109 deletions .github/workflows/R-CMD-check.yaml

This file was deleted.

10 changes: 8 additions & 2 deletions R/plotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ plot_ly <- function(data = data.frame(), ..., type = NULL, name,
if (!is.data.frame(data) && !crosstalk::is.SharedData(data)) {
stop("First argument, `data`, must be a data frame or shared data.", call. = FALSE)
}


if (is.data.frame(data) && nrow(data) > 0L) {
qtables <- vapply(data, inherits, logical(1L), "QTable")
if (any(qtables))
data[qtables] <- lapply(data[qtables], as.vector)
}

# "native" plotly arguments
attrs <- list(...)

Expand Down Expand Up @@ -479,7 +485,7 @@ typedArrayPolyfill <- function() {
plotlyMainBundle <- function() {
htmltools::htmlDependency(
name = "plotly-main",
version = "2.11.1",
version = "2.35.2",
package = "plotly",
src = dependency_dir("plotlyjs"),
script = "plotly-latest.min.js",
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ verify_attr_names <- function(p) {
# some layout attributes (e.g., [x-y]axis can have trailing numbers)
attrs_name_check(
sub("[0-9]+$", "", names(p$x$layout)),
c(names(Schema$layout$layoutAttributes), c("boxmode", "barmode", "bargap", "mapType")),
c(names(Schema$layout$layoutAttributes), c("boxmode", "barmode", "bargap", "bargroupgap", "barcornerradius", "mapType")),
"layout"
)
attrs_name_check(
Expand Down
119 changes: 6 additions & 113 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,115 +1,8 @@
This is a fork of the plotly/plotly.R HtmlWidget for use in Displayr. The repository has been modified to be an node package and use the rhtmlBuildUtils framework. This was done in order to run unit tests on the widget js code, which has been modified by Displayr. The integration with rhtmlBuildUtils is incomplete, and only the building and unit testing of widget js code is supported. Features from rhtmlBuildUtils such as visual regression testing, linting and the internal web server are absent.

<!-- README.md is generated from README.Rmd. Please edit that file -->
This fork diverges from the plotly/plotly.R in that
* Uses a later version of the js bundle (2.35.2) compared to the upstream fork (2.11.1). In particular this allows us to use bar corner radius
* Add support for handling the QTable class
* Some changes that so that plotly runs tests and exports in the Displayr environment

<img src="man/figures/plotly.png" width="200" />

<!-- badges: start -->
[![R-CMD-check](https://github.com/ropensci/plotly/workflows/R-CMD-check/badge.svg)](https://github.com/plotly/plotly.R/actions)
[![CRAN Status](https://www.r-pkg.org/badges/version/plotly)](https://cran.r-project.org/package=plotly)
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/plotly)](https://cranlogs.r-pkg.org/badges/grand-total/plotly)
[![monthly](https://cranlogs.r-pkg.org/badges/plotly)](https://cranlogs.r-pkg.org/badges/plotly)
<!-- badges: end -->

An R package for creating interactive web graphics via the open source
JavaScript graphing library
[plotly.js](https://github.com/plotly/plotly.js).

<div align="center">
<a href="https://dash.plotly.com/project-maintenance">
<img src="https://dash.plotly.com/assets/images/maintained-by-community.png" width="400px" alt="Maintained by the Plotly Community">
</a>
</div>

## Installation

Install from CRAN:

``` r
install.packages("plotly")
```

Or install the latest development version (on GitHub) via `{remotes}`:

``` r
remotes::install_github("plotly/plotly")
```

## Getting started

### Web-based ggplot2 graphics

If you use [ggplot2](https://github.com/tidyverse/ggplot2), `ggplotly()`
converts your static plots to an interactive web-based version\!

``` r
library(plotly)
g <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
stat_density_2d(aes(fill = ..level..), geom = "polygon") +
xlim(1, 6) + ylim(40, 100)
ggplotly(g)
```

![<https://i.imgur.com/G1rSArP.gifv>](https://i.imgur.com/G1rSArP.gif)

By default, `ggplotly()` tries to replicate the static ggplot2 version
exactly (before any interaction occurs), but sometimes you need greater
control over the interactive behavior. The `ggplotly()` function itself
has some convenient “high-level” arguments, such as `dynamicTicks`,
which tells plotly.js to dynamically recompute axes, when appropriate.
The `style()` function also comes in handy for *modifying* the
underlying trace
attributes (e.g. [hoveron](https://plotly.com/r/reference/#scatter-hoveron)) used to generate the plot:

``` r
gg <- ggplotly(g, dynamicTicks = "y")
style(gg, hoveron = "points", hoverinfo = "x+y+text", hoverlabel = list(bgcolor = "white"))
```

![<https://i.imgur.com/qRvLgea.gifv>](https://imgur.com/qRvLgea.gif)

Moreover, since `ggplotly()` returns a plotly object, you can apply
essentially any function from the R package on that object. Some useful
ones include `layout()` (for [customizing the
layout](https://plotly-r.com/improving-ggplotly.html#modifying-layout)),
`add_traces()` (and its higher-level `add_*()` siblings, for example
`add_polygons()`, for [adding new
traces/data](https://plotly-r.com/improving-ggplotly.html#leveraging-statistical-output)),
`subplot()` (for [combining multiple plotly
objects](https://plotly-r.com/arranging-views.html#arranging-plotly-objects)),
and `plotly_json()` (for inspecting the underlying JSON sent to
plotly.js).

The `ggplotly()` function will also respect some “unofficial”
**ggplot2** aesthetics, namely `text` (for [customizing the
tooltip](https://plotly-r.com/controlling-tooltips.html#tooltip-text-ggplotly)),
`frame` (for [creating
animations](https://plotly-r.com/animating-views.html)),
and `ids` (for ensuring sensible smooth transitions).

### Using plotly without ggplot2

The `plot_ly()` function provides a more direct interface to plotly.js
so you can leverage more specialized chart types (e.g., [parallel
coordinates](https://plotly.com/r/parallel-coordinates-plot/) or
[maps](https://plotly.com/r/maps/)) or even some visualization that the
ggplot2 API won’t ever support (e.g., surface,
[mesh](https://plotly.com/r/3d-mesh/),
[trisurf](https://plotly.com/r/trisurf/), etc).

``` r
plot_ly(z = ~volcano, type = "surface")
```

![<https://plotly.com/~brnvg/1134>](https://plotly.com/~brnvg/1134.png)

## Learn more

To learn more about special features that the plotly R package provides (e.g., [client-side linking](https://plotly-r.com/client-side-linking.html), [**shiny** integration](https://plotly-r.com/linking-views-with-shiny.html), [editing and generating static images](https://plotly-r.com/publish.html), [custom events in JavaScript](https://plotly-r.com/javascript.html), and more), see <https://plotly-r.com>. You may already be familiar with existing plotly documentation (e.g., <https://plotly.com/r/>), which is essentially a language-agnostic how-to guide for learning plotly.js, whereas <https://plotly-r.com> is meant to be more wholistic tutorial written by and for the R user. The package itself ships with a number of demos (list them by running `demo(package = "plotly")`) and shiny/rmarkdown examples (list them by running `plotly_example("shiny")` or `plotly_example("rmd")`). [Carson](https://cpsievert.me) also keeps numerous [slide decks](https://talks.cpsievert.me) with useful examples and concepts.

## Contributing

Please read through our [contributing
guidelines](https://github.com/plotly/plotly.R/blob/master/CONTRIBUTING.md).
Included are directions for opening issues, asking questions,
contributing changes to plotly, and our code of
conduct.
This fork is also missing some of the more recent fixes for ggplotly. The latest version of ggplot2 is 3.5.1 but as of version 3.5.0 (released Feb 2024), there have been a number of breaking changes. the Displayr R server still uses 3.4.4.
11 changes: 11 additions & 0 deletions build/config/widget.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const cliArgs = require('yargs').argv
const _ = require('lodash')

const config = {
widgetEntryPoint: 'theSrc/scripts/plotly.js',
widgetFactory: 'theSrc/scripts/plotly.factory.js',
widgetName: 'plotly',
}

const commandLineOverides = _.omit(cliArgs, ['_', '$0'])
module.exports = _.merge(config, commandLineOverides)
8 changes: 8 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const gulp = require('gulp')
const rhtmlBuildUtils = require('rhtmlBuildUtils')

const dontRegisterTheseTasks = []
rhtmlBuildUtils.registerGulpTasks({
gulp: gulp,
exclusions: dontRegisterTheseTasks
})
69 changes: 4 additions & 65 deletions inst/htmlwidgets/lib/plotlyjs/plotly-latest.min.js

Large diffs are not rendered by default.

Loading