Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ganigeorgiev/dygraph.dart
Dart JS interop for Dygraph
https://github.com/ganigeorgiev/dygraph.dart
dart dygraphs interop
Last synced: about 1 month ago
JSON representation
Dart JS interop for Dygraph
- Host: GitHub
- URL: https://github.com/ganigeorgiev/dygraph.dart
- Owner: ganigeorgiev
- License: bsd-3-clause
- Created: 2020-07-26T08:03:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-09T09:38:08.000Z (about 3 years ago)
- Last Synced: 2024-10-25T03:10:12.235Z (3 months ago)
- Topics: dart, dygraphs, interop
- Language: Dart
- Homepage: https://pub.dev/packages/dygraph
- Size: 32.2 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
Dygraph (Dart)
================================================================================Dart JS interop for [Dygraph v2+](https://github.com/danvk/dygraphs) - fast, flexible open source JavaScript charting library.
## Usage
1. Register the Dart package in your `pubspec.yaml`:
```yaml
dependencies:
dygraph: ^1.0.0
```2. Load the latest Dygraph source (js and css) in your html layout:
```html
```3. Create a `Dygraph` instance:
```dart
import 'dart:html';import 'package:dygraph/dygraph.dart';
void main() {
final el = document.getElementById('chart_container');final options = DygraphOptions(
labels: ['Index', 'X', 'Y'],
colors: ['blue', 'red'],
);final data = [
[1, 10, 100],
[2, 20, 80],
[3, 50, 60],
[4, 70, 80],
];Dygraph(el, data, options);
}
```> **Note 1:** Dart DateTime objects need to be converted to native js dates by using `dart:html_common` and `convertDartToNative_DateTime()`.
> **Note 2:** When passing a Dart function as a callback, make sure to wrap it with `allowInterop()` or `allowInteropCaptureThis()`.
Check the [API reference](https://pub.dev/documentation/dygraph/latest/) for detailed documentation.
To view the example, run `pub global run webdev serve example` from the root directory of this project.