Giter Club home page Giter Club logo

pageflow-chart's Introduction

Pageflow Chart

Gem Version Build Status

Page type showing scraped svg diagramms from Datawrapper.

Installation

Add this line to your application's Gemfile:

# Gemfile
gem 'pageflow-chart'

Mount the engine:

# config/routes.rb
mount Pageflow::Chart::Engine, at: '/chart'

Register the plugin:

# config/initializers/pageflow.rb
config.plugin(Pageflow::Chart.plugin)

Include javascript/stylesheets:

# app/assets/javascripts/pageflow/application.js
//= require "pageflow/chart"

# app/assets/javascripts/pageflow/editor.js
//= require pageflow/chart/editor

# app/assets/stylesheets/pageflow/application.scss;
@import "pageflow/chart";


# app/assets/stylesheets/pageflow/editor.scss;
@import "pageflow/chart/editor";

# Adding basic style to your theme
# app/assets/stylesheets/pageflow/themes/default.scss
@import "pageflow/chart/themes/default";

Execute bundle install. Then Install and run migrations:

rake pageflow_chart:install:migrations
rake db:migrate SCOPE=pageflow_chart

Create Proxy

Create a proxy (via Apache, Nginx, ...) from your domain to your configured S3_HOST_ALIAS to circumvent the same-domain policy. Configure this in your Pageflow Chart initializer config/initializers/pageflow_chart.rb.

Example conf snippet for Nginx. Add this location block inside every server that's being used by Ruby/Rails.

location /datawrapper/ {
  proxy_pass http://bucketname.s3-website-eu-west-1.amazonaws.com/;
  proxy_redirect http://bucketname.s3-website-eu-west-1.amazonaws.com/ $scheme://$host/datawrapper/;
}

Normally you will do in two servers: the one that has listen 80 in it and the other one which has `listen 443' in it (for https). This is needed so the charts can be servered from the same origin a the entry.

Configuration

Configure Pageflow Chart by creating an initializer in your app config/initializers/pageflow_chart.rb.

Example:

Pageflow::Chart.configure do |config|
  config.scraped_sites_root_url = '/datawrapper'

  # Allow scraping charts from custom account URLs
  config.supported_hosts << 'http://mycustom.datawrapper.de'

  # Uncomment to inject custom css into iframe.
  # config.use_custom_theme = true
end

Also see lib/pageflow/chart/configuration.rb for the additional options.

Troubleshooting

If you run into problems while installing the page type, please also refer to the Troubleshooting wiki page in the Pageflow repository. If that doesn't help, consider filing an issue.

Contributing Locales

Edit the translations directly on the pageflow-chart locale project.

pageflow-chart's People

Contributors

aviav avatar danielkuhn avatar digitalkram avatar kioopi avatar tf avatar tilsammans avatar upsworld avatar

Watchers

 avatar  avatar

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.