chartjs 0.5.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 81

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.

Disclaimer #

This is not an official Google product.

0.5.1 #

  • Add missing constructors of ChartLegendOptions, ChartLegendLabelOptions, and ChartHoverOptions for ChartOptions.

0.5.0 #

  • Regenerated API for Chart.js 2.6.0

  • Support Dart 2.

0.4.0+1 #

  • Allow the latest release of package:func.

0.4.0 #

  • Renamed Chart toBase64 -> toBase64Image.

  • Fixed strong-mode issues.

0.3.2 #

  • Regenerated API from an updated ts.d.

0.3.1 #

  • Updated to Chart.js 2.4.0

0.3.0 #

0.2.0+1 #

  • Fixes for Dart 1.16 JS interop requirements.

  • Experimented with adding defaults value.

0.2.0 #

  • BREAKING Includes complete chartjs API.

  • Requires Dart v1.13.1.

0.1.0+2 #

  • Updated for Dart 1.13 release.

0.1.0+1 #

  • Updated README.md and example.

0.1.0 #

  • Initial release

example/example.dart

// 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: months.map((_) => rnd.nextInt(100)).toList()),
    new ChartDataSets(
        label: 'My Second dataset',
        backgroundColor: 'rgba(151,187,205,0.2)',
        data: months.map((_) => 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:


dependencies:
  chartjs: ^0.5.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter 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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
80
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
56
Overall:
Weighted score of the above. [more]
81
Learn more about scoring.

We analyzed this package on May 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev

Health issues and suggestions

Document public APIs. (-0.76 points)

739 out of 745 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/chartjs.dart.

Run dartfmt to format lib/chartjs.dart.

Maintenance suggestions

Package is getting outdated. (-24.38 points)

The package was last published 64 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

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