|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 6 | + <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no"> |
| 7 | + <meta name="generator" content="made with love by dartdoc 0.32.1"> |
| 8 | + <meta name="description" content="dygraph API docs, for the Dart programming language."> |
| 9 | + <title>dygraph - Dart API docs</title> |
| 10 | + |
| 11 | + |
| 12 | + <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet"> |
| 13 | + <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> |
| 14 | + <link rel="stylesheet" href="static-assets/github.css"> |
| 15 | + <link rel="stylesheet" href="static-assets/styles.css"> |
| 16 | + <link rel="icon" href="static-assets/favicon.png"> |
| 17 | + |
| 18 | +</head> |
| 19 | + |
| 20 | +<body data-base-href="" |
| 21 | + data-using-base-href="false"> |
| 22 | + |
| 23 | +<div id="overlay-under-drawer"></div> |
| 24 | + |
| 25 | +<header id="title"> |
| 26 | + <button id="sidenav-left-toggle" type="button"> </button> |
| 27 | + <ol class="breadcrumbs gt-separated dark hidden-xs"> |
| 28 | + <li class="self-crumb">dygraph package</li> |
| 29 | + </ol> |
| 30 | + <div class="self-name">dygraph</div> |
| 31 | + <form class="search navbar-right" role="search"> |
| 32 | + <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search..."> |
| 33 | + </form> |
| 34 | +</header> |
| 35 | + |
| 36 | +<main> |
| 37 | + |
| 38 | + <div id="dartdoc-sidebar-left" class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left"> |
| 39 | + <header id="header-search-sidebar" class="hidden-l"> |
| 40 | + <form class="search-sidebar" role="search"> |
| 41 | + <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search..."> |
| 42 | + </form> |
| 43 | + </header> |
| 44 | + |
| 45 | + <ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav"> |
| 46 | + <li class="self-crumb">dygraph package</li> |
| 47 | + </ol> |
| 48 | + |
| 49 | + <h5 class="hidden-xs"><span class="package-name">dygraph</span> <span class="package-kind">package</span></h5> |
| 50 | + <ol> |
| 51 | + <li class="section-title">Libraries</li> |
| 52 | + <li><a href="dygraph/dygraph-library.html">dygraph</a></li> |
| 53 | + </ol> |
| 54 | + </div> |
| 55 | + |
| 56 | + <div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content"> |
| 57 | + <section class="desc markdown"> |
| 58 | + <h1 id="dygraph-dart">Dygraph (Dart)</h1> |
| 59 | +<p>Dart JS interop for <a href="https://github.com/danvk/dygraphs">Dygraph v2+</a> - fast, flexible open source JavaScript charting library.</p> |
| 60 | +<h2 id="usage">Usage</h2> |
| 61 | +<ol> |
| 62 | +<li> |
| 63 | +<p>Register the Dart package in your <code>pubspec.yaml</code>:</p> |
| 64 | +<pre class="language-yaml"><code class="language-yaml"> dependencies: |
| 65 | + dygraph: ^0.1.0 |
| 66 | +</code></pre> |
| 67 | +</li> |
| 68 | +<li> |
| 69 | +<p>Load the latest Dygraph source (js and css) in your html layout:</p> |
| 70 | +<pre class="language-html"><code class="language-html"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.css"> |
| 71 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.js"></script> |
| 72 | +</code></pre> |
| 73 | +</li> |
| 74 | +<li> |
| 75 | +<p>Create a <code>Dygraph</code> instance:</p> |
| 76 | +<pre class="language-dart"><code class="language-dart"> import 'dart:html'; |
| 77 | + |
| 78 | + import 'package:dygraph/dygraph.dart'; |
| 79 | + |
| 80 | + void main() { |
| 81 | + final el = document.getElementById('chart_container'); |
| 82 | + |
| 83 | + final options = DygraphOptions( |
| 84 | + labels: ['Index', 'X', 'Y'], |
| 85 | + colors: ['blue', 'red'], |
| 86 | + ); |
| 87 | + |
| 88 | + final data = [ |
| 89 | + [1, 10, 100], |
| 90 | + [2, 20, 80], |
| 91 | + [3, 50, 60], |
| 92 | + [4, 70, 80], |
| 93 | + ]; |
| 94 | + |
| 95 | + Dygraph(el, data, options); |
| 96 | + } |
| 97 | +</code></pre> |
| 98 | +</li> |
| 99 | +</ol> |
| 100 | +<blockquote> |
| 101 | +<p><strong>Note 1:</strong> Dart DateTime objects need to be converted to native js dates by using <code>dart:html_common</code> and <code>convertDartToNative_DateTime()</code>.</p> |
| 102 | +</blockquote> |
| 103 | +<blockquote> |
| 104 | +<p><strong>Note 2:</strong> When passing a Dart function as a callback, make sure to wrap it with <code>allowInterop()</code> or <code>allowInteropCaptureThis()</code>.</p> |
| 105 | +</blockquote> |
| 106 | +<p>Check the <a href="https://pub.dev/documentation/dygraph/latest/">API reference</a> for detailed documentation.</p> |
| 107 | +<p>To view the example, run <code>pub global run webdev serve example</code> from the root directory of this project.</p> |
| 108 | + </section> |
| 109 | + |
| 110 | + <section class="summary"> |
| 111 | + <h2>Libraries</h2> |
| 112 | + <dl> |
| 113 | + <dt id="dygraph"> |
| 114 | + <span class="name"><a href="dygraph/dygraph-library.html">dygraph</a></span> |
| 115 | + </dt> |
| 116 | + <dd> |
| 117 | + The JS interop library itself. |
| 118 | + </dd> |
| 119 | + </dl> |
| 120 | + </section> |
| 121 | + |
| 122 | + </div> <!-- /.main-content --> |
| 123 | + |
| 124 | + <div id="dartdoc-sidebar-right" class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right"> |
| 125 | + </div> |
| 126 | + |
| 127 | +</main> |
| 128 | + |
| 129 | +<footer> |
| 130 | + <span class="no-break"> |
| 131 | + dygraph |
| 132 | + 0.1.1 |
| 133 | + </span> |
| 134 | + |
| 135 | +</footer> |
| 136 | + |
| 137 | +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
| 138 | +<script src="static-assets/typeahead.bundle.min.js"></script> |
| 139 | +<script src="static-assets/highlight.pack.js"></script> |
| 140 | +<script src="static-assets/URI.js"></script> |
| 141 | +<script src="static-assets/script.js"></script> |
| 142 | + |
| 143 | + |
| 144 | +</body> |
| 145 | + |
| 146 | +</html> |
0 commit comments