traces-graph
Customizable graphs for traces.
Example
var Graph = fs = ; // data would be from traces.get(cycle, fn)// in the "traces" modulevar graph = data; // graph.barWidth(1);// graph.barSpacing(.5);// graph.barTip(1);// graph.max(graph.mean() + 100);// graph.max(3000);graph;graph;graphlabel'Image Uploads';graphcolor'request' '#b1daec';graphcolor'resize' '#8fcdec';graphcolor'save' '#4cb4ec';graphcolor's3' '#1a9dec';graph; fs;console;
API
Graph()
Initialize a new graph with the given cycle
data.
Graph#max(ms:Number)
Clip the graph at a maximum of ms
. For example if a few traces
are 2000ms
, and most are around 100ms
you'll likely want to .max()
at around 150
or so to have a better view.
Graph#scale(x:Number, y:Number)
Scale the graph on the x
or y
axis. For example if you have several hundred
thousand traces, representing them each as a single pixel on the x-axis will be
too large, you may want to try .scale(.2, 1)
. Like-wise if the y-axis reaches
durations of several seconds, this equates to several thousands of pixels by default
unless a y-axis scale is applied such as .scale(1, .5)
.
Graph#label(str:String)
Add label str
.
Graph#barTip(n:Number)
Set bar "tip" to n
px.
Graph#barWidth(n:Number)
Set bar "width" to n
px.
Graph#barSpacing(n:Number)
Set bar "spacing" to n
px.
Graph#barAlpha(n:Number)
Set bar alpha to n
[0.7].
Graph#color(type:String, color:String)
Assign color
for probe type
.
Graph#draw()
Draw the graph.
License
(The MIT License)
Copyright (c) 2012 LearnBoost <tj@vision-media.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.