Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1322)

Unified Diff: src/site/samples/gauge/example/gauge.dart

Issue 1387723002: Updating the samples page to reflect the examples that have been retired. (Closed) Base URL: https://github.com/dart-lang/www.dartlang.org.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/site/samples/anagram/index.markdown ('k') | src/site/samples/gauge/example/gauge.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/site/samples/gauge/example/gauge.dart
diff --git a/src/site/samples/gauge/example/gauge.dart b/src/site/samples/gauge/example/gauge.dart
deleted file mode 100644
index 415b1a233004c5f89a92af9b8c306e25d64c2928..0000000000000000000000000000000000000000
--- a/src/site/samples/gauge/example/gauge.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. 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:async';
-import 'dart:js';
-
-class Gauge {
- var jsOptions;
- var jsTable;
- var jsChart;
-
- // Access to the value of the gauge.
- num _value;
- get value => _value;
- set value(num x) {
- _value = x;
- draw();
- }
-
- Gauge(Element element, String title, this._value, Map options) {
- final data = [['Label', 'Value'], [title, value]];
- final vis = context["google"]["visualization"];
- jsTable = vis.callMethod('arrayToDataTable', [new JsObject.jsify(data)]);
- jsChart = new JsObject(vis["Gauge"], [element]);
- jsOptions = new JsObject.jsify(options);
- draw();
- }
-
- void draw() {
- jsTable.callMethod('setValue', [0, 1, value]);
- jsChart.callMethod('draw', [jsTable, jsOptions]);
- }
-
- static Future load() {
- Completer c = new Completer();
- context["google"].callMethod('load',
- ['visualization', '1', new JsObject.jsify({
- 'packages': ['gauge'],
- 'callback': new JsFunction.withThis(c.complete)
- })]);
- return c.future;
- }
-}
-
-// Bindings to html elements.
-final DivElement visualization = querySelector('#gauge');
-final InputElement slider = querySelector("#slider");
-
-void main() {
- // Setup the gauge.
- Gauge.load().then((_) {
- int sliderValue() => int.parse(slider.value);
- // Create a Guage after the library has been loaded.
- Gauge gauge = new Gauge(visualization, "Slider", sliderValue(),
- { 'min': 0, 'max': 280,
- 'yellowFrom': 200, 'yellowTo': 250,
- 'redFrom': 250, 'redTo': 280,
- 'minorTicks': 5});
- // Connect slider value to gauge.
- slider.onChange.listen((_) => gauge.value = sliderValue());
- });
-}
« no previous file with comments | « src/site/samples/anagram/index.markdown ('k') | src/site/samples/gauge/example/gauge.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698