Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Support the latest API using js_facade_gen
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Oct 14, 2016
1 parent 2b3e06b commit 841e60a
Show file tree
Hide file tree
Showing 6 changed files with 1,199 additions and 495 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
## 0.3.0

* Updated to Chart.js 2.3.0
* Generated using [dart_js_facade_gen](https://github.com/dart-lang/js_facade_gen).

## 0.2.0+1

* Fixes for Dart 1.16 JS interop requirements.
Expand Down
5 changes: 3 additions & 2 deletions README.md
@@ -1,5 +1,6 @@
An example Dart API for [Chart.js](http://www.chartjs.org/)
using [pkg/js](https://pub.dartlang.org/packages/js).
A generated Dart API for [Chart.js](http://www.chartjs.org/)
using [pkg/js](https://pub.dartlang.org/packages/js) and
[dart_js_facade_gen](https://github.com/dart-lang/js_facade_gen).

This project will be *lightly* maintained by the original author.
Contributions are welcome.
Expand Down
31 changes: 9 additions & 22 deletions example/example.dart
Expand Up @@ -4,42 +4,29 @@

library chartjs.example;

// Based off the Javascript example
// https://github.com/nnnick/Chart.js/blob/b8691c9581bff0eeecb34f98e678dc045a18f33e/samples/line.html
// On 2015-10-15

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

import 'package:chartjs/chartjs.dart';

void main() {
Chart.defaults.global.responsive = true;

var ctx = (querySelector('#canvas') as CanvasElement).context2D;
var rnd = new math.Random();
var months = <String>["January", "February", "March", "April", "May", "June"];

var data = new LinearChartData(labels: months, datasets: <ChartDataSet>[
new ChartDataSet(
var data = new LinearChartData(labels: months, datasets: <ChartDataSets>[
new ChartDataSets(
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
backgroundColor: "rgba(220,220,220,0.2)",
data: months.map((_) => rnd.nextInt(100)).toList()),
new ChartDataSet(
new ChartDataSets(
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
backgroundColor: "rgba(151,187,205,0.2)",
data: months.map((_) => rnd.nextInt(100)).toList())
]);

new Chart(ctx).Line(data, new LineChartOptions(pointDotRadius: 10));
var config = new ChartConfiguration(
type: 'line', data: data, options: new ChartOptions(responsive: true));

new Chart(ctx, config);
}
2 changes: 1 addition & 1 deletion example/index.html
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>Chart.js and Dart interop example</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.min.js"></script>
<script type="application/dart" src="example.dart"></script>
<script src="packages/browser/dart.js"></script>
<style type="text/css">
Expand Down

0 comments on commit 841e60a

Please sign in to comment.