plot_window 0.1.0 plot_window: ^0.1.0 copied to clipboard
A library to use a canvas element to plot data
// Copyright (c) 2015, <your name>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
//import 'package:plot_window/plot_window.dart' as pl;
import '../lib/plot_window.dart' as pl;
import 'dart:html';
import 'dart:math' as math;
main() {
pl.Init();
var plotWindow = new pl.LinePlotWindow(querySelector('#mycanvas'));
var line1 = new pl.Line("line1", new pl.PointList([new Point(1,2), new Point(2,5), new Point(3,-3), new Point(4, 2)])); //, color:new pl.Color(255,0,0));
var line2 = new pl.Line("line2", new pl.PointList([new Point(-3,3), new Point(-2,2), new Point(-1,3), new Point(0,2), new Point(1,1)])); //, color:new pl.Color(0,0,255));
line2.showLinearRegression= true;
plotWindow..addLine(line1)
..addLine(line2);
plotWindow.plot();
/*
var rand = new math.Random();
var data = new List<List<num>>();
for (int i=0; i<20; i++) {
data.add(new List<num>());
for (int j=0; j<100; j++) {
data[i].add(j+i + rand.nextInt(20));
}
}
var plotWindow = new pl.HeatmapPlotWindow(querySelector('#mycanvas'));
var heatmap = new pl.Heatmap("my heatmap", 20, 20, data);
plotWindow.heatmap = heatmap;
plotWindow.plot();
*/
}