From 841e60a2ea585dfb92f0cd13dbf800a6eec9195d Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Fri, 14 Oct 2016 15:19:27 -0700 Subject: [PATCH] Support the latest API using js_facade_gen --- CHANGELOG.md | 5 + README.md | 5 +- example/example.dart | 31 +- example/index.html | 2 +- lib/chartjs.dart | 1649 ++++++++++++++++++++++++++++++------------ pubspec.yaml | 2 +- 6 files changed, 1199 insertions(+), 495 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5284315..a957e1d 100644 --- a/CHANGELOG.md +++ b/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. diff --git a/README.md b/README.md index f993f33..e25ee8a 100644 --- a/README.md +++ b/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. diff --git a/example/example.dart b/example/example.dart index 8caf7ec..a6ccb57 100644 --- a/example/example.dart +++ b/example/example.dart @@ -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 = ["January", "February", "March", "April", "May", "June"]; - var data = new LinearChartData(labels: months, datasets: [ - new ChartDataSet( + var data = new LinearChartData(labels: months, datasets: [ + 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); } diff --git a/example/index.html b/example/index.html index 336ade0..ed0e97f 100644 --- a/example/index.html +++ b/example/index.html @@ -2,7 +2,7 @@ Chart.js and Dart interop example - +