Skip to content

Adding a default chart

jwildfire edited this page Dec 4, 2019 · 2 revisions

Step-by-Step Process for contributing a new a default chart to safetyGraphics package

  1. Make a new branch of the safetyGraphics master repository.

  2. Create a new charting function using the guidelines in the Create new charts vignette, unless you're making an htmlwidget. Htmlwidgets are drawn using a custom process, and must follow the structure by the existing widgets. To add a widget , do the following:

  • add the js library to inst/htmlwidgets/lib
  • update inst/htmlwidgets/chartRenderer.yaml
  1. Drop the file containing the charting function in the inst/custom directory, under the subfolder that matches the chart type (static, plotly, or Shiny module).

  2. Update metadata

    • Update metadata files:
      • For all custom charts:
        • Add a row for the new chart to data-raw/chartsMetadata.csv
        • Add a column for the new chart to data-raw/settingsMetadataCharts.csv.
      • For charts that contain new settings:
        • Add rows for new settings to data-raw/settingsMetadata.csv
        • Add defaults for new settings in data-raw/generateSettingsMetadataDefaults.R and re-run the file.
        • Add rows for new settings in data-raw/settingsMetadataCharts.csv.
        • Add rows for new settings in the data standard mappings in data_raw/standardsMetaData.csv
    • Run data-raw/csv_to_rda.R to save the files to data/.
    • Add chart to documentation file for settingsMetadata: R/settingsMetadata.R. Append chart_ to the name of your chart function/file and add it as an item in the list.
  3. Update package dependencies. For example, if you've added a plotly chart:

    • Add plotly to DESCRIPTION file Imports
    • Add library(plotly) to top of global.R file under inst/safetyGraphics_app
  4. Update package documentation with devtools::document().

  5. Rebuild the R package, test out the Shiny app, and make a PR to the safetyGraphics repo.