</div>
</div>
- <p style="clear:both">In order to keep this example self-contained, the second parameter is raw CSV data. The dygraphs library parses this data (including column headers), resizes the its container to a reasonable default, calculates appropriate axis ranges and tick marks and draws the graph.</p>
+ <p style="clear:both">In order to keep this example self-contained, the second parameter is raw CSV data. The dygraphs library parses this data (including column headers), resizes its container to a reasonable default, calculates appropriate axis ranges and tick marks and draws the graph.</p>
<p>In most applications, it makes more sense to include a CSV file instead. If the second parameter to the constructor doesn't contain a newline, it will be interpreted as the path to a CSV file. The Dygraph will perform an XMLHttpRequest to retrieve this file and display the data when it becomes available. Make sure your CSV file is readable and serving from a place that understands XMLHttpRequest's! In particular, you cannot specify a CSV file using <code>"file:///"</code>. Here's an example: (data from <a href="http://www.wunderground.com/history/airport/KNUQ/2007/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2007&req_city=NA&req_state=NA&req_statename=NA">Weather Underground</a>)</p>
for (var j = 0; j < dataset.length; j++) {
var item = dataset[j];
var point = {
+ // TODO(danvk): here
x: ((parseFloat(item[0]) - this.minxval) * this.xscale),
y: 1.0 - ((parseFloat(item[1]) - this.minyval) * this.yscale),
xval: parseFloat(item[0]),
}
var setCount = setNames.length;
- //Update Points
+ // Update Points
+ // TODO(danvk): here
for (var i = 0; i < this.layout.points.length; i++) {
var point = this.layout.points[i];
point.canvasx = this.area.w * point.x + this.area.x;
prevX = -1;
continue;
}
+ // TODO(danvk): here
var newYs = [ point.y - point.errorPlus * yscale,
point.y + point.errorMinus * yscale ];
newYs[0] = this.area.h * newYs[0] + this.area.y;
ctx.fill();
}
} else if (fillGraph) {
+ // TODO(danvk): merge this code with the logic above; they're very similar.
for (var i = 0; i < setCount; i++) {
var setName = setNames[i];
var setNameLast;
delimiter: ',',
+ logScale: false,
sigma: 2.0,
errorBars: false,
fractions: false,
// Try labels every 1, 2, 5, 10, 20, 50, 100, etc.
// Calculate the resulting tick spacing (i.e. this.height_ / nTicks).
// The first spacing greater than pixelsPerYLabel is what we use.
+ // TODO(danvk): version that works on a log scale.
if (self.attr_("labelsKMG2")) {
var mults = [1, 2, 4, 8];
} else {