-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChartProperties.js
149 lines (114 loc) · 3.78 KB
/
ChartProperties.js
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
Dave_js.ChartProperties = function ChartProperties(){
//canvas id based on the user specified name
this.dataCanvasId = Math.random() + "-dataCanvas";
this.decorCanvasId = Math.random() + "-decorCanvas";
//default canvas size
this.sizes = {
lineWidth : 3,
pointSize : 6,
halfPointSize : 3
};
this.height = 0;
this.width = 0;
//indicates pixels from edge of canvas
this.plotRegion = {
top: 0,
bottom: 0,
left: 0,
right: 0
};
//default x and y origins for the canvas coordinate system
this.origin = { x : 60, y : 20};
this.totalOffsetX = 0;
this.totalOffsetY = 0;
//the id attribute for an image tag on the
//page which contains the desired background
this.bgImg = undefined;
//settings for chart text
this.cssFont = '14px "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace';
this.labels = {
title : "",
indep : "",
dep : ""
};
//Default number of y tics to skip
this.skipTics = {dep : 1, indep : 1 };
//number of pixels per point in each dimension
this.pntSpacing = {dep : 1, indep : 1};
//variables that will be used to labels the tic marks on each axis
this.axisVars = {};
//min and max values for dependent variables
this.limits = {xmin : 0, xmax : 0, ymin : 0, ymax : 0};
//default settings for plot scale
this.scale = {"type" : "lin", "value" : 1};
//histogram bar width plus margin
this.histBarTotal = undefined;
this.histBarWidth = undefined;
this.histBarMargin = undefined;
//default 90% histogram bar width
this.histBarRatio = 0.9;
//direction of increasing angles in polar plots
// -1 = anticlockwise; 1 = clockwise
this.polarRot = -1;
//where 0 degrees is located on the polar plot
this.zeroAngle = 0;
//define plot range
this.range = {
"start" : Number.NEGATIVE_INFINITY,
"stop" : Number.POSITIVE_INFINITY,
"numOfPts" : 0
};
//holds the different colors used for in the plot
this.colors = {
// default colors
activePoint : "#00FF00",
text : "black",
grid : "gray",
data : ['Red','Blue','Green', 'Yellow'],
borderColor : '#000000',
bgColor : '#CCCCCC'
};
this.flags = {
//indicated that a value to pixel conversion has been calculated
hasRange : false,
autoRange: true,
//set true if the data has been plotted once.
//Prevents scaling data multiple times
replot : false,
//set this to indicate a polar
polar : false,
//draw a bar from zero up to the point value
hist : false,
//rectangular box for an xy plot
xy : false,
//setting this true indicates we are drawing on top of an existing plot.
//Frame, background, axis labels, tics, and limits are all skipped.
subPlot : false,
//setting this true will add an event listener to the plot
//so we can display exact mouseover plot values
showCoords : true,
//values will be connected with a line
lines : false,
//values will be represented by a point
points : false,
//the user sets a fixed point width
fixedPtSize : false,
//convert angular/radial values to longitude/lattitude
map : false,
//scale the data before plotting
scaled : false,
//false for fitting the y axis to the data,
//true to use pre defined axis limits
limits : false,
//draw a background grid (only for polar plots right now)
grid : false,
axis : false,
title : false,
//on xy plots this lists variable names in their color along the top,
//in polar plots, this draws a line from a colored variable name to
//the last drawn point
legend : false,
//makes plot zoomable by clicking and dragging over the desired area
zoomable : true
};
};