-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparams.dart
More file actions
84 lines (72 loc) · 1.74 KB
/
params.dart
File metadata and controls
84 lines (72 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
class Palettes {
static const String rainbow = "33,13,10";
static const String rgb = "22,13,-31";
static const String ocean = "23,28,3";
static const String hot = "21,22,23";
static const String def = "7,5,15";
static const String grp = "3,11,6";
}
class Styles {
static const String lines = "lines";
static const String dots = "dots";
static const String points = "points";
static const String linespoints = "lp";
static const String impulses = "impulses";
static const String steps = "steps";
static const String boxes = "boxes";
static const String yerrorbars = "yerrorbars";
static const String xerrorbars = "xerrorbars";
static const String xyerrorbars = "xyerrorbars";
static const String vector = "vector";
}
class Labels {
var xlabel;
var ylabel;
var zlabel;
var title;
Labels({
this.xlabel = '',
this.ylabel = '',
this.zlabel = '',
this.title = ''
}) {}
static Labels defaultLabels() => new Labels();
}
class Plot {
var exp;
var labels;
var frm;
var to;
var nbPoints;
var style;
var showZeroX;
var showZeroY;
var showGrid;
var lineWidth;
var color;
Plot(
this.exp, {
this.labels=Labels.defaultLabels(),
this.frm=-10.0,
this.to=10.0,
this.nbPoints=100,
this.style=Styles.lines,
this.showZeroX=true,
this.showZeroY=true,
this.showGrid=false,
this.lineWidth=1,
this.color='blue'
}) {
exp = exp.replaceAll('^','**');
}
String toString() =>
"set samples $nbPoints;"+
"set isosamples $nbPoints;"+
(showZeroX?"set xzeroaxis;":"")+
(showZeroY?"set yzeroaxis;":"")+
(showGrid?"set grid;":"")+
"set xlabel \"${labels.xlabel}\";"+
"set ylabel \"${labels.ylabel}\";"+
"set title \" ${labels.title }\";"+
"plot [$frm:$to] $exp with $style lt rgb '$color' lw $lineWidth;";
}