chartjs 0.5.0

  • Example
  • Installing
  • Versions
  • 84

A generated Dart API for Chart.js using pkg/js and dart_js_facade_gen.

This project will be lightly maintained by the original author. Contributions are welcome.

To understand usage, see the example source code and the corresponding output.


This is not an official Google product.


  • Regenerated API for Chart.js 2.6.0

  • Support Dart 2.


  • Allow the latest release of package:func.


  • Renamed Chart toBase64 -> toBase64Image.

  • Fixed strong-mode issues.


  • Regenerated API from an updated ts.d.


  • Updated to Chart.js 2.4.0



  • Fixes for Dart 1.16 JS interop requirements.

  • Experimented with adding defaults value.


  • BREAKING Includes complete chartjs API.

  • Requires Dart v1.13.1.


  • Updated for Dart 1.13 release.


  • Updated and example.


  • Initial release


// Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

import 'dart:html';
import 'dart:math' as math;

import 'package:chartjs/chartjs.dart';

void main() {
  var rnd = new math.Random();
  var months = <String>['January', 'February', 'March', 'April', 'May', 'June'];

  var data = new LinearChartData(labels: months, datasets: <ChartDataSets>[
    new ChartDataSets(
        label: 'My First dataset',
        backgroundColor: 'rgba(220,220,220,0.2)',
        data: => rnd.nextInt(100)).toList()),
    new ChartDataSets(
        label: 'My Second dataset',
        backgroundColor: 'rgba(151,187,205,0.2)',
        data: => rnd.nextInt(100)).toList())

  var config = new ChartConfiguration(
      type: 'line', data: data, options: new ChartOptions(responsive: true));

  new Chart(querySelector('#canvas') as CanvasElement, config);

Use this package as a library

1. Depend on it

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

  chartjs: ^0.5.0

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:chartjs/chartjs.dart';
Version Uploaded Documentation Archive
0.5.0 Aug 6, 2018 Go to the documentation of chartjs 0.5.0 Download chartjs 0.5.0 archive
0.4.0+1 Oct 10, 2017 Go to the documentation of chartjs 0.4.0+1 Download chartjs 0.4.0+1 archive
0.4.0 Jun 8, 2017 Go to the documentation of chartjs 0.4.0 Download chartjs 0.4.0 archive
0.3.2 Mar 27, 2017 Go to the documentation of chartjs 0.3.2 Download chartjs 0.3.2 archive
0.3.1 Dec 20, 2016 Go to the documentation of chartjs 0.3.1 Download chartjs 0.3.1 archive
0.3.0 Oct 14, 2016 Go to the documentation of chartjs 0.3.0 Download chartjs 0.3.0 archive
0.2.0+1 Apr 25, 2016 Go to the documentation of chartjs 0.2.0+1 Download chartjs 0.2.0+1 archive
0.2.0 Dec 17, 2015 Go to the documentation of chartjs 0.2.0 Download chartjs 0.2.0 archive
0.1.0+2 Nov 18, 2015 Go to the documentation of chartjs 0.1.0+2 Download chartjs 0.1.0+2 archive
0.1.0+1 Nov 17, 2015 Go to the documentation of chartjs 0.1.0+1 Download chartjs 0.1.0+1 archive

All 11 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.7


Detected platforms: web

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

Health issues and suggestions

Document public APIs (-9.91 points)

695 out of 701 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Maintenance suggestions

The description is too short. (-20 points)

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


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.13.1 <3.0.0
js ^0.6.0 0.6.1+1
Dev dependencies
build_runner ^0.10.0
build_web_compilers ^0.4.0