GithubHelp home page GithubHelp logo

Comments (7)

reed avatar reed commented on July 18, 2024

Can you show me what your code looks like without turbolinks?

from turbolinks-compatibility.

findchris avatar findchris commented on July 18, 2024

Sure. Thanks!

<head>
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    <%= javascript_include_tag 'https://www.google.com/jsapi' %>
    <script type="text/javascript" charset="utf-8">
      google.load('visualization', '1', {'packages': ['geochart']});
    </script>
</head>
<!-- partial -->
<script type="text/javascript" charset="utf-8">
  google.setOnLoadCallback(function() {...}
</script>

from turbolinks-compatibility.

reed avatar reed commented on July 18, 2024

My initial thought would be to try something like this:

<script type="text/javascript" charset="utf-8">
  function initChart(){
    ...
  }

  google.setOnLoadCallback(initChart);
  $(document.body).on('page:load', initChart);
</script>

from turbolinks-compatibility.

reed avatar reed commented on July 18, 2024

Closing due to inactivity.

from turbolinks-compatibility.

obromios avatar obromios commented on July 18, 2024

I find that Google Charts works fine with Turbolinks in my application, but I am making a simple use of it. I initialise an instance variable, @barchart in my controller, with code like

@barchart=Gchart.bar(some_hash)

and then in my view file, I use

   <% require 'gchart' %>
   <%= image_tag(@barchart, :alt => "Scores Chart") %>

from turbolinks-compatibility.

robguilfoyle avatar robguilfoyle commented on July 18, 2024

Still have issues with this, @obromios is using the images not the javascript library so it appears

from turbolinks-compatibility.

stephsunwr avatar stephsunwr commented on July 18, 2024

@findchris , @robguilfoyle - not ideal, but if you use target blank for the links the charts will pull up

from turbolinks-compatibility.

Related Issues (20)

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.