O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using JavaScript libraries

In this recipe, we use the js package as an interface from our Dart script to the Google Chart JavaScript API. This gives us many rich and highly customizable ways to graphically represent data in our Dart web apps and, because it is built with HTML5/SVG, it works cross-browser (even for older IE versions) and cross-platform (also for iOS and Android).

How to do it...

Take a look at the project googlechart:

  1. In the <body> tag of the HTML file, place the following:
    <div id="chart" style="width: 900px; height: 500px;"></div>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="application/dart" src="googlechart.dart"></script>

    The <div> tag with the ID chart is where the chart will be drawn; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required