SciRuby/gnuplotrb

View on GitHub
examples/plot_to_image_file/real_result.html

Summary

Maintainability
Test Coverage
<!DOCTYPE HTML>
<html>
<head>
<title>Gnuplot Canvas Graph</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--[if IE]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
<script src="C:\Program Files\gnuplot\share/js/canvastext.js"></script>
<script src="C:\Program Files\gnuplot\share/js/gnuplot_common.js"></script>
<script src="C:\Program Files\gnuplot\share/js/gnuplot_dashedlines.js"></script>
<script type="text/javascript">gnuplot.init = function() {};</script>
<script type="text/javascript">
var canvas, ctx;
gnuplot.grid_lines = true;
gnuplot.zoomed = false;
gnuplot.active_plot_name = "gnuplot_canvas";

function gnuplot_canvas() {
canvas = document.getElementById("gnuplot_canvas");
ctx = canvas.getContext("2d");
// Gnuplot version 5.0.0
// short forms of commands provided by gnuplot_common.js
function DT  (dt)  {gnuplot.dashtype(dt);};
function DS  (x,y) {gnuplot.dashstart(x,y);};
function DL  (x,y) {gnuplot.dashstep(x,y);};
function M   (x,y) {if (gnuplot.pattern.length > 0) DS(x,y); else gnuplot.M(x,y);};
function L   (x,y) {if (gnuplot.pattern.length > 0) DL(x,y); else gnuplot.L(x,y);};
function Dot (x,y) {gnuplot.Dot(x/10.,y/10.);};
function Pt  (N,x,y,w) {gnuplot.Pt(N,x/10.,y/10.,w/10.);};
function R   (x,y,w,h) {gnuplot.R(x,y,w,h);};
function T   (x,y,fontsize,justify,string) {gnuplot.T(x,y,fontsize,justify,string);};
function TR  (x,y,angle,fontsize,justify,string) {gnuplot.TR(x,y,angle,fontsize,justify,string);};
function bp  (x,y) {gnuplot.bp(x,y);};
function cfp () {gnuplot.cfp();};
function cfsp() {gnuplot.cfsp();};

gnuplot.hypertext_list = [];
gnuplot.on_hypertext = -1;
function Hypertext(x,y,w,text) {
    newtext = {x:x, y:y, w:w, text:text};
    gnuplot.hypertext_list.push(newtext);
}
gnuplot.dashlength = 400;
ctx.lineCap = "round"; ctx.lineJoin = "round";
CanvasTextFunctions.enable(ctx);
ctx.strokeStyle = "rgb(215,215,215)";
ctx.lineWidth = 1;

ctx.lineWidth = 1;
ctx.strokeStyle = "rgb(000,000,000)";
ctx.beginPath();
M(520,5800);
L(620,5800);
M(5759,5800);
L(5659,5800);
ctx.stroke();
ctx.closePath();
ctx.fillStyle = "rgb(000,000,000)";
T(440,5850,10.0,"Right"," 0");
ctx.beginPath();
M(520,5250);
L(620,5250);
M(5759,5250);
L(5659,5250);
ctx.stroke();
ctx.closePath();
T(440,5300,10.0,"Right"," 0.1");
ctx.beginPath();
M(520,4700);
L(620,4700);
M(5759,4700);
L(5659,4700);
ctx.stroke();
ctx.closePath();
T(440,4750,10.0,"Right"," 0.2");
ctx.beginPath();
M(520,4150);
L(620,4150);
M(5759,4150);
L(5659,4150);
ctx.stroke();
ctx.closePath();
T(440,4200,10.0,"Right"," 0.3");
ctx.beginPath();
M(520,3600);
L(620,3600);
M(5759,3600);
L(5659,3600);
ctx.stroke();
ctx.closePath();
T(440,3650,10.0,"Right"," 0.4");
ctx.beginPath();
M(520,3050);
L(620,3050);
M(5759,3050);
L(5659,3050);
ctx.stroke();
ctx.closePath();
T(440,3100,10.0,"Right"," 0.5");
ctx.beginPath();
M(520,2501);
L(620,2501);
M(5759,2501);
L(5659,2501);
ctx.stroke();
ctx.closePath();
T(440,2551,10.0,"Right"," 0.6");
ctx.beginPath();
M(520,1951);
L(620,1951);
M(5759,1951);
L(5659,1951);
ctx.stroke();
ctx.closePath();
T(440,2001,10.0,"Right"," 0.7");
ctx.beginPath();
M(520,1401);
L(620,1401);
M(5759,1401);
L(5659,1401);
ctx.stroke();
ctx.closePath();
T(440,1451,10.0,"Right"," 0.8");
ctx.beginPath();
M(520,851);
L(620,851);
M(5759,851);
L(5659,851);
ctx.stroke();
ctx.closePath();
T(440,901,10.0,"Right"," 0.9");
ctx.beginPath();
M(520,301);
L(620,301);
M(5759,301);
L(5659,301);
ctx.stroke();
ctx.closePath();
T(440,351,10.0,"Right"," 1");
ctx.beginPath();
M(520,5800);
L(520,5700);
M(520,301);
L(520,401);
ctx.stroke();
ctx.closePath();
T(520,5950,10.0,"Center"," 0");
ctx.beginPath();
M(1568,5800);
L(1568,5700);
M(1568,301);
L(1568,401);
ctx.stroke();
ctx.closePath();
T(1568,5950,10.0,"Center"," 2");
ctx.beginPath();
M(2616,5800);
L(2616,5700);
M(2616,301);
L(2616,401);
ctx.stroke();
ctx.closePath();
T(2616,5950,10.0,"Center"," 4");
ctx.beginPath();
M(3663,5800);
L(3663,5700);
M(3663,301);
L(3663,401);
ctx.stroke();
ctx.closePath();
T(3663,5950,10.0,"Center"," 6");
ctx.beginPath();
M(4711,5800);
L(4711,5700);
M(4711,301);
L(4711,401);
ctx.stroke();
ctx.closePath();
T(4711,5950,10.0,"Center"," 8");
ctx.beginPath();
M(5759,5800);
L(5759,5700);
M(5759,301);
L(5759,401);
ctx.stroke();
ctx.closePath();
T(5759,5950,10.0,"Center"," 10");
ctx.beginPath();
M(520,301);
L(520,5800);
L(5759,5800);
L(5759,301);
L(520,301);
ctx.closePath();
ctx.stroke();
T(3139,201,10.0,"Center","Plotting to png");
if (typeof(gnuplot.hide_gp_plot_1) == "undefined"|| !gnuplot.hide_gp_plot_1) {
ctx.strokeStyle = "rgb(148,000,211)";
ctx.strokeStyle = "rgb(000,000,000)";
T(5099,514,10.0,"Right","Points from file");
ctx.strokeStyle = "rgb(148,000,211)";
ctx.beginPath();
M(5179,464);
L(5599,464);
M(520,301);
L(572,824);
L(625,1298);
L(677,1726);
L(730,2114);
L(782,2465);
L(834,2782);
L(887,3069);
L(939,3329);
L(992,3564);
L(1044,3777);
L(1096,3970);
L(1149,4144);
L(1201,4301);
L(1253,4444);
L(1306,4573);
L(1358,4690);
L(1411,4795);
L(1463,4891);
L(1515,4978);
L(1568,5056);
L(1620,5127);
L(1673,5191);
L(1725,5249);
L(1777,5301);
L(1830,5349);
L(1882,5392);
L(1935,5430);
L(1987,5466);
L(2039,5497);
L(2092,5526);
L(2144,5552);
L(2196,5576);
L(2249,5597);
L(2301,5616);
L(2354,5634);
L(2406,5650);
L(2458,5664);
L(2511,5677);
L(2563,5689);
L(2616,5699);
L(2668,5709);
L(2720,5718);
L(2773,5725);
L(2825,5732);
L(2878,5739);
L(2930,5745);
L(2982,5750);
L(3035,5755);
L(3087,5759);
L(3140,5763);
L(3192,5766);
L(3244,5770);
L(3297,5773);
L(3349,5775);
L(3401,5778);
L(3454,5780);
L(3506,5782);
L(3559,5783);
L(3611,5785);
L(3663,5786);
L(3716,5788);
L(3768,5789);
L(3821,5790);
L(3873,5791);
L(3925,5792);
L(3978,5793);
L(4030,5793);
L(4083,5794);
L(4135,5794);
L(4187,5795);
L(4240,5795);
L(4292,5796);
L(4344,5796);
L(4397,5797);
L(4449,5797);
L(4502,5797);
L(4554,5798);
L(4606,5798);
L(4659,5798);
L(4711,5798);
L(4764,5798);
L(4816,5798);
L(4868,5799);
L(4921,5799);
L(4973,5799);
L(5026,5799);
L(5078,5799);
L(5130,5799);
L(5183,5799);
L(5235,5799);
L(5287,5799);
L(5340,5799);
L(5392,5799);
L(5445,5800);
L(5497,5800);
L(5549,5800);
L(5602,5800);
L(5654,5800);
L(5707,5800);
L(5759,5800);
ctx.stroke();
ctx.closePath();
} // End gp_plot_1 
ctx.lineWidth = 2;
ctx.strokeStyle = "rgb(000,000,000)";
DT(gnuplot.solid);
ctx.lineWidth = 1;
ctx.beginPath();
M(520,301);
L(520,5800);
L(5759,5800);
L(5759,301);
L(520,301);
ctx.closePath();
ctx.stroke();

// plot boundaries and axis scaling information for mousing 
gnuplot.plot_term_xmax = 600;
gnuplot.plot_term_ymax = 600;
gnuplot.plot_xmin = 52.0;
gnuplot.plot_xmax = 575.9;
gnuplot.plot_ybot = 580.0;
gnuplot.plot_ytop = 30.1;
gnuplot.plot_width = 523.9;
gnuplot.plot_height = 549.9;
gnuplot.plot_axis_xmin = 0;
gnuplot.plot_axis_xmax = 10;
gnuplot.plot_axis_ymin = 0;
gnuplot.plot_axis_ymax = 1;
gnuplot.plot_axis_x2min = "none"
gnuplot.plot_axis_y2min = "none"
gnuplot.plot_logaxis_x = 0;
gnuplot.plot_logaxis_y = 0;
gnuplot.plot_axis_width = gnuplot.plot_axis_xmax - gnuplot.plot_axis_xmin;
gnuplot.plot_axis_height = gnuplot.plot_axis_ymax - gnuplot.plot_axis_ymin;
gnuplot.plot_timeaxis_x = "";
gnuplot.plot_timeaxis_y = "";
}
</script>
<link type="text/css" href="C:\Program Files\gnuplot\share/js/gnuplot_mouse.css" rel="stylesheet">
</head>
<body onload="gnuplot_canvas(); gnuplot.init();" oncontextmenu="return false;">

<div class="gnuplot">
<canvas id="Tile" width="32" height="32" hidden></canvas>
<table class="plot">
<tr><td>
    <canvas id="gnuplot_canvas" width="600" height="600" tabindex="0">
    Sorry, your browser seems not to support the HTML 5 canvas element
    </canvas>
</td></tr>
</table>
</div>

</body>
</html>