ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 80 00 00 00 80 08 06 00 00 00 c3 3e 61 | .PNG........IHDR..............>a |
0020 | cb 00 00 00 01 73 52 47 42 00 ae ce 1c e9 00 00 00 04 67 41 4d 41 00 00 b1 8f 0b fc 61 05 00 00 | .....sRGB.........gAMA......a... |
0040 | 00 09 70 48 59 73 00 00 0e c3 00 00 0e c3 01 c7 6f a8 64 00 00 07 4d 49 44 41 54 78 5e ed 5d 69 | ..pHYs..........o.d...MIDATx^.]i |
0060 | a8 a6 63 18 1e fb be 53 f6 39 8d 25 ca 72 ca 98 1f f8 71 2c 51 c8 2e 7b 73 42 d4 14 21 64 89 a1 | ..c....S.9.%.r....q,Q..{sB..!d.. |
0080 | 84 94 08 d9 c2 30 59 c2 3f 83 c2 d4 8c 25 fb 92 3d d9 26 3b 83 39 96 ec e2 ba ea 7b f3 75 7c e7 | .....0Y.?....%..=.&;.9.....{.u|. |
00a0 | 9c ef 7d bf 67 b9 ef e7 bd ee ba 3b 4b ef fb 3c f7 7d dd d7 b3 bc cf 3a 6d 9a 44 08 08 01 21 20 | ..}.g......;K..<.}.....:m.D...!. |
00c0 | 04 84 80 10 10 02 42 40 08 08 01 21 20 04 84 80 10 10 02 42 40 08 08 01 21 20 04 84 80 10 10 02 | ......B@...!.......B@...!....... |
00e0 | 42 40 08 08 01 21 20 04 84 80 10 10 02 42 40 08 18 44 60 53 d8 34 07 3a 1f ba 10 fa 20 f4 42 e8 | B@...!.......B@..D`S.4.:......B. |
0100 | b6 06 6d 95 49 81 11 38 1d e9 2d 85 fe d3 43 7f c1 ff 2e 0d 9c 9f 92 33 82 c0 d6 b0 e3 d1 09 02 | ..m.I..8..-...C........3........ |
0120 | 3f 9e 0c d7 19 b1 59 66 04 42 e0 24 a4 f3 7d 9f c1 af c8 70 54 a0 bc 95 4c 46 04 36 43 de 0f d4 | ?.....Yf.B.$..}....pT...LF.6C... |
0140 | 0c 7c 45 80 d7 f1 de 0a 19 6d 57 d6 03 22 70 34 de ff a2 61 f0 2b 12 cc 1c d0 06 bd 9e 01 81 0d | .|E......mW.."p4...a.+.......... |
0160 | 90 e7 bc 01 03 5f 11 80 24 92 38 42 e0 40 d8 fa 61 a0 e0 93 04 a3 8e 7c 6f b5 a9 6b c2 fb 1b 02 | ....._..$.8B.@..a......|o..k.... |
0180 | 06 be aa 01 66 b7 1a 55 27 ce 8f c0 ce b7 22 04 9f 24 10 01 0c 93 60 65 d8 76 65 a4 c0 ab 06 30 | ....f..U'....."..$....`e.ve....0 |
01a0 | 1c 78 9a 36 0b fa 52 e4 e0 ab 06 // ******************************************
// Trend line for reporting
// based on scenario_history.txt
// where data looks like
// date,scenario,installer,detail,score
// 2016-09-22 13:12,os-nosdn-fdio-noha,apex,4/12,33.0
// 2016-09-22 13:13,os-odl_l2-fdio-noha,apex,12/15,80.0
// 2016-09-22 13:13,os-odl_l2-sfc-noha,apex,18/24,75.0
// .....
// ******************************************
// Set the dimensions of the canvas / graph
var trend_margin = {top: 20, right: 30, bottom: 50, left: 40},
trend_width = 300 - trend_margin.left - trend_margin.right,
trend_height = 130 - trend_margin.top - trend_margin.bottom;
// Parse the date / time
var parseDate = d3.time.format("%Y-%m-%d %H:%M").parse;
// Set the ranges
var trend_x = d3.time.scale().range([0, trend_width]);
var trend_y = d3.scale.linear().range([trend_height, 0]);
// Define the axes
var trend_xAxis = d3.svg.axis().scale(trend_x)
.orient("bottom").ticks(2).tickFormat(d3.time.format("%m-%d"));
var trend_yAxis = d3.svg.axis().scale(trend_y)
.orient("left").ticks(2);
// Define the line
var valueline = d3.svg.line()
.x(function(d) { return trend_x(d.date); })
.y(function(d) { return trend_y(d.score); });
var trend = function(container, trend_data) {
var trend_svg = d3.select(container)
.append("svg")
.attr("width", trend_width + trend_margin.left + trend_margin.right)
.attr("height", trend_height + trend_margin.top + trend_margin.bottom)
.append("g")
.attr("transform",
"translate(" + trend_margin.left + "," + trend_margin.top + ")");
// Scale the range of the data
trend_x.domain(d3.extent(trend_data, function(d) { return d.date; }));
trend_y.domain([0, d3.max(trend_data, function(d) { return d.score; })]);
// Add the X Axis
trend_svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + trend_height + ")")
.call(trend_xAxis);
// Add the Y Axis
trend_svg.append("g")
.attr("class", "y axis")
.call(trend_yAxis);
// Add the valueline path.
trend_svg.append("path")
.attr("class", "line")
.attr("d", valueline(trend_data))
.attr("stroke", "steelblue")
.attr("fill", "none");
trend_svg.selectAll(".dot")
.data(trend_data)
.enter().append("circle")
.attr("r", 2.5)
.attr("cx", function(d) { return trend_x(d.date); })
.attr("cy", function(d) { return trend_y(d.score); });
return trend;
}
|