google_charts 0.2.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 51

Google Charts API Wrapper

A library to make it easy to use Google's visualization api

This package was matched against the version released on April 30, 2015 (Version 42).

Usage

You can use the api almost as you would do in the javascript version.

  1. Include <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> in the head section of your HTML code.

  2. Use the load method of the Chart you want to use to load the required package(s) asynchronously. Afterwards you can go ahead and write your code.

      LineChart.load().then((_) {
     var chart = new LineChart(...);
     var data = new DataTable(...);
     chart.draw(data);
      });
    
  3. When using the API itself you can use Chart.load() to only load the API without any packages.

Implemented wrappers

  • All Charts are implemented, included the corecharts and all other charts.
  • Material charts (Line, Bar/Column, Scatter)
  • Query API
  • Formatters
  • Static methods like arrayToDataTable, drawChart and drawToolbar
  • Events

Examples

Pie Chart

HTML Code

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Simple Pie Chart Example</title>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  </head>
  <body>
    <div id="piechart" style="width: 900px; height: 500px;"></div>
    <script type="application/dart" src="piechart.dart"></script>
    <!-- for this next line to work, your pubspec.yaml file must have a dependency on 'browser' -->
    <script src="packages/browser/dart.js"></script>
  </body>
</html>

Dart Code

import 'dart:html';
import 'package:google_visualization_api/google_visualization_api.dart';

void main() {
  PieChart.load().then((_) {
    var data = arrayToDataTable([
      ['Task', 'Hours per Day'],
      ['Work', 11],
      ['Eat', 2],
      ['Commute', 2],
      ['Watch TV', 2],
      ['Sleep', 7]
    ]);

    var options = {'title': 'My Daily Activities'};

    var chart = new PieChart(document.getElementById('piechart'));

    chart.draw(data, options);
  });
}

Event Overview

Following Events are supported by the different chart types:

NameselectreadyanimationfinishclickerroronmouseoveronmouseoutregionClickcollapserangechangepagesortrollup
AnnotationChartxxx
AreaChart*xxxxxxx
BarChart*xxxxxxx
BubbleChart*xxxxxxx
Calendarxxxxx
CandleStickChart*xxxxxxx
ColumnChart*xxxxxxx
ComboChart*xxxxxxx
Gauge
GeoChartxxxx
Histogram*xxxxxxx
LineChart*xxxxxxx
Mapxx
OrgChartxxxxx
PieChart*xxxxxx
Sankeyxxxxx
ScatterChart*xxxxxxx
AreaChart*xxxxxxx
Tablexxxx
Timelinexxxxx
TreeMapxxxxx
WordTreexx

*) core chart

Changelog

0.2.1

  • Using new loader.js script for google charts
  • Fixes #11, #2 and #3

0.2.0

  • Fixes #12

0.1.3+2

  • Fixed title in readme

0.1.3+1

  • Readme fixed

0.1.3

  • Package renamed to google_charts
  • Added support for Material Charts of type Line, Bar and Scatter
  • Material Charts examples added
  • Fixed #6

0.1.2+1

  • Updated readme to show deprecated message! New Version 0.1.3 will be called google_charts.

0.1.2

  • #5: Diff charts implemented and examples added

0.1.1+1

  • README updated

0.1.1

  • Moved the Bar class to bar_chart.dart
  • Fixed a bug in bar_chart.dart where BarChart required the bar package instead of corechart.

0.1.0

  • Add: DataView class, formatters, static methods
  • Add: Examples for format class

0.0.2

  • Completely implemented the DataTable class
  • Started to work on option extraction from the official API reference
  • Events started

0.0.1

  • Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  google_charts: ^0.2.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:google_charts/google_charts.dart';
  
Version Uploaded Documentation Archive
0.2.1 May 18, 2016 Go to the documentation of google_charts 0.2.1 Download google_charts 0.2.1 archive
0.2.0 May 18, 2016 Go to the documentation of google_charts 0.2.0 Download google_charts 0.2.0 archive
0.1.4 Jul 27, 2015 Go to the documentation of google_charts 0.1.4 Download google_charts 0.1.4 archive
0.1.3+2 Jun 4, 2015 Go to the documentation of google_charts 0.1.3+2 Download google_charts 0.1.3+2 archive
0.1.3+1 Jun 4, 2015 Go to the documentation of google_charts 0.1.3+1 Download google_charts 0.1.3+1 archive
0.1.3 Jun 4, 2015 Go to the documentation of google_charts 0.1.3 Download google_charts 0.1.3 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
57
Health:
Code health derived from static analysis. [more]
75
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
51
Learn more about scoring.

We analyzed this package on Jul 20, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.69.0
  • pana: 0.11.7

Platforms

Detected platforms: web

Primary library: package:google_charts/google_charts.dart with components: html, js.

Issues and suggestions

Fix lib/src/visualization/annotation_chart.dart.

Analysis of lib/src/visualization/annotation_chart.dart failed with 1 error:

line 8 col 3: Invalid override. The type of 'AnnotationChart.draw' ('(dynamic, [Map<dynamic, dynamic>, dynamic]) → void') isn't a subtype of 'Chart.draw' ('(dynamic, [dynamic]) → void').

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Package is too old.

The package was released more than two years ago.

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.

Format lib/base.dart.

Run dartfmt to format lib/base.dart.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use google_charts.dart.

Fix additional 35 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/charts.dart (Run dartfmt to format lib/charts.dart.)
  • lib/events.dart (Run dartfmt to format lib/events.dart.)
  • lib/src/base/datatable.dart (Run dartfmt to format lib/src/base/datatable.dart.)
  • lib/src/base/dataview.dart (Run dartfmt to format lib/src/base/dataview.dart.)
  • lib/src/base/format/bar.dart (Run dartfmt to format lib/src/base/format/bar.dart.)
  • lib/src/base/format/number.dart (Run dartfmt to format lib/src/base/format/number.dart.)
  • lib/src/base/format/pattern.dart (Run dartfmt to format lib/src/base/format/pattern.dart.)
  • lib/src/charts/bar.dart (Run dartfmt to format lib/src/charts/bar.dart.)
  • lib/src/charts/line.dart (Run dartfmt to format lib/src/charts/line.dart.)
  • lib/src/charts/scatter.dart (Run dartfmt to format lib/src/charts/scatter.dart.)
  • lib/src/events/args.dart (Run dartfmt to format lib/src/events/args.dart.)
  • lib/src/events/wrapper.dart (Run dartfmt to format lib/src/events/wrapper.dart.)
  • lib/src/visualization/area_chart.dart (Run dartfmt to format lib/src/visualization/area_chart.dart.)
  • lib/src/visualization/bubble_chart.dart (Run dartfmt to format lib/src/visualization/bubble_chart.dart.)
  • lib/src/visualization/calendar.dart (Run dartfmt to format lib/src/visualization/calendar.dart.)
  • lib/src/visualization/candlestick_chart.dart (Run dartfmt to format lib/src/visualization/candlestick_chart.dart.)
  • lib/src/visualization/column_chart.dart (Run dartfmt to format lib/src/visualization/column_chart.dart.)
  • lib/src/visualization/combo_chart.dart (Run dartfmt to format lib/src/visualization/combo_chart.dart.)
  • lib/src/visualization/gauge.dart (Run dartfmt to format lib/src/visualization/gauge.dart.)
  • lib/src/visualization/geo_chart.dart (Run dartfmt to format lib/src/visualization/geo_chart.dart.)
  • lib/src/visualization/histogram.dart (Run dartfmt to format lib/src/visualization/histogram.dart.)
  • lib/src/visualization/line_chart.dart (Run dartfmt to format lib/src/visualization/line_chart.dart.)
  • lib/src/visualization/map.dart (Run dartfmt to format lib/src/visualization/map.dart.)
  • lib/src/visualization/org_chart.dart (Run dartfmt to format lib/src/visualization/org_chart.dart.)
  • lib/src/visualization/pie_chart.dart (Run dartfmt to format lib/src/visualization/pie_chart.dart.)
  • lib/src/visualization/sankey_diagram.dart (Run dartfmt to format lib/src/visualization/sankey_diagram.dart.)
  • lib/src/visualization/scatter_chart.dart (Run dartfmt to format lib/src/visualization/scatter_chart.dart.)
  • lib/src/visualization/stepped_area_chart.dart (Run dartfmt to format lib/src/visualization/stepped_area_chart.dart.)
  • lib/src/visualization/table.dart (Run dartfmt to format lib/src/visualization/table.dart.)
  • lib/src/visualization/timeline.dart (Run dartfmt to format lib/src/visualization/timeline.dart.)
  • lib/src/visualization/treemap.dart (Run dartfmt to format lib/src/visualization/treemap.dart.)
  • lib/src/visualization/wordtree.dart (Run dartfmt to format lib/src/visualization/wordtree.dart.)
  • lib/src/visualization/wrapper.dart (Run dartfmt to format lib/src/visualization/wrapper.dart.)
  • lib/static.dart (Run dartfmt to format lib/static.dart.)
  • lib/visualization.dart (Run dartfmt to format lib/visualization.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
browser ^0.10.0 0.10.0+3
polymer ^1.0.0-rc.17 1.0.0-rc.19
reflectable ^0.5.4 0.5.4 2.0.1
web_components ^0.12.0 0.12.5
Transitive dependencies
analyzer 0.27.6 0.32.3
args 0.13.7 1.4.4
async 2.0.8
barback 0.15.2+16
charcode 1.1.2
cli_util 0.0.1+2 0.1.3+2
code_transformers 0.4.2+3 0.5.1+5
collection 1.14.11
convert 2.0.2
crypto 2.0.6
csslib 0.14.4 0.14.4+1
dart_style 0.2.11+1 1.1.3
glob 1.1.7
initialize 0.6.2+7
isolate 0.2.3 2.0.2
logging 0.11.3+2
package_config 1.0.5
path 1.6.2
plugin 0.2.0+3
polymer_interop 1.0.0-rc.10
pool 1.3.5
source_maps 0.10.7
source_span 1.4.1
stack_trace 1.9.3
string_scanner 1.0.3
typed_data 1.1.6
utf 0.9.0+5
watcher 0.9.7+10
when 0.2.0
which 0.1.3
yaml 2.1.15
Dev dependencies
html any 0.13.3+2
http any