Rev 15111 | Rev 15351 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 15111 | Rev 15313 | ||
---|---|---|---|
Line 1259... | Line 1259... | ||
1259 | var draw_numberline = function(canvas_type,use_axis_numbering,x0,x1,xmajor,xminor,y0,y1,linewidth,strokecolor,strokeopacity,fontfamily,fontcolor,precision){\ |
1259 | var draw_numberline = function(canvas_type,use_axis_numbering,x0,x1,xmajor,xminor,y0,y1,linewidth,strokecolor,strokeopacity,fontfamily,fontcolor,precision){\ |
1260 | var obj = create_canvas%d(canvas_type,xsize,ysize);\ |
1260 | var obj = create_canvas%d(canvas_type,xsize,ysize);\ |
1261 | var ctx = obj.getContext(\"2d\");\ |
1261 | var ctx = obj.getContext(\"2d\");\ |
1262 | ctx.lineWidth = linewidth || 1;\ |
1262 | ctx.lineWidth = linewidth || 1;\ |
1263 | ctx.strokeStyle = \"rgba(\"+strokecolor+\",\"+strokeopacity+\")\";\ |
1263 | ctx.strokeStyle = \"rgba(\"+strokecolor+\",\"+strokeopacity+\")\";\ |
1264 | ctx.font = fontfamily || |
1264 | ctx.font = fontfamily || 'Arial 12px';\ |
1265 | var fontsize = parseInt(ctx.font);\ |
1265 | var fontsize = parseInt(ctx.font);\ |
1266 | ctx.fillStyle = \"rgba(\"+fontcolor+\",\"+strokeopacity+\")\";\ |
1266 | ctx.fillStyle = \"rgba(\"+fontcolor+\",\"+strokeopacity+\")\";\ |
1267 | x1 = x2px(x1);\ |
1267 | x1 = x2px(x1);\ |
1268 | x0 = x2px(x0);\ |
1268 | x0 = x2px(x0);\ |
1269 | y0 = y2px(y0);\ |
1269 | y0 = y2px(y0);\ |
Line 1369... | Line 1369... | ||
1369 | ctx.moveTo(0,p);\ |
1369 | ctx.moveTo(0,p);\ |
1370 | ctx.lineTo(xsize,p);\ |
1370 | ctx.lineTo(xsize,p);\ |
1371 | };\ |
1371 | };\ |
1372 | if( typeof(xaxislabel) !== 'undefined' ){\ |
1372 | if( typeof(xaxislabel) !== 'undefined' ){\ |
1373 | ctx.save();\ |
1373 | ctx.save();\ |
1374 | ctx.font = \"italic \"+font_size+\"px |
1374 | ctx.font = \"italic \"+font_size+\"px Arial\";\ |
1375 | var corr = parseInt(1.1*ctx.measureText(xaxislabel).width);\ |
1375 | var corr = parseInt(1.1*ctx.measureText(xaxislabel).width);\ |
1376 | ctx.fillText(xaxislabel,xsize - corr,zero_y - tics_length - 0.4*font_size);\ |
1376 | ctx.fillText(xaxislabel,xsize - corr,zero_y - tics_length - 0.4*font_size);\ |
1377 | ctx.restore();\ |
1377 | ctx.restore();\ |
1378 | };\ |
1378 | };\ |
1379 | if( typeof(yaxislabel) !== 'undefined' ){\ |
1379 | if( typeof(yaxislabel) !== 'undefined' ){\ |
1380 | ctx.save();\ |
1380 | ctx.save();\ |
1381 | ctx.font = \"italic \"+font_size+\"px |
1381 | ctx.font = \"italic \"+font_size+\"px Arial\";\ |
1382 | var corr = parseInt(ctx.measureText(yaxislabel).width + font_size);\ |
1382 | var corr = parseInt(ctx.measureText(yaxislabel).width + font_size);\ |
1383 | ctx.translate(zero_x+tics_length + font_size,corr);\ |
1383 | ctx.translate(zero_x+tics_length + font_size,corr);\ |
1384 | ctx.rotate(-0.5*Math.PI);\ |
1384 | ctx.rotate(-0.5*Math.PI);\ |
1385 | ctx.fillText(yaxislabel,0,0);\ |
1385 | ctx.fillText(yaxislabel,0,0);\ |
1386 | ctx.restore();\ |
1386 | ctx.restore();\ |
Line 1588... | Line 1588... | ||
1588 | } |
1588 | } |
1589 | 1589 | ||
1590 | if( legend_cnt != -1 ){ |
1590 | if( legend_cnt != -1 ){ |
1591 | fprintf(js_include_file,"ctx.save();\ |
1591 | fprintf(js_include_file,"ctx.save();\ |
1592 | ctx.globalAlpha = 1.0;\ |
1592 | ctx.globalAlpha = 1.0;\ |
1593 | ctx.font = \"bold \"+font_size+\"px |
1593 | ctx.font = \"bold \"+font_size+\"px Arial\";\ |
1594 | var y_offset = 2*font_size;\ |
1594 | var y_offset = 2*font_size;\ |
1595 | var txt;var txt_size;\ |
1595 | var txt;var txt_size;\ |
1596 | var x_offset = xsize - 2*font_size;\ |
1596 | var x_offset = xsize - 2*font_size;\ |
1597 | var l_length = legend0.length;\ |
1597 | var l_length = legend0.length;\ |
1598 | if( typeof(legendcolors0) !== 'undefined' ){\ |
1598 | if( typeof(legendcolors0) !== 'undefined' ){\ |
Line 1952... | Line 1952... | ||
1952 | if( font_family != 'null' ){\ |
1952 | if( font_family != 'null' ){\ |
1953 | ctx.font = font_family;\ |
1953 | ctx.font = font_family;\ |
1954 | }\ |
1954 | }\ |
1955 | else\ |
1955 | else\ |
1956 | {\ |
1956 | {\ |
1957 | ctx.font = font_size+'px |
1957 | ctx.font = font_size+'px Arial';\ |
1958 | };\ |
1958 | };\ |
1959 | if( use_offset == 3 ){if(angle2 < 0 ){ y = y + 0.8*font_size; x = x + (Math.cos(angle2))*font_size; }else{y = y - 0.8*font_size; x = x + (Math.sin(angle2))*font_size;};};\ |
1959 | if( use_offset == 3 ){if(angle2 < 0 ){ y = y + 0.8*font_size; x = x + (Math.cos(angle2))*font_size; }else{y = y - 0.8*font_size; x = x + (Math.sin(angle2))*font_size;};};\ |
1960 | if(angle2 == 0 && angle != 0){\ |
1960 | if(angle2 == 0 && angle != 0){\ |
1961 | ctx.save();\ |
1961 | ctx.save();\ |
1962 | if(use_rotate == 1 ){\ |
1962 | if(use_rotate == 1 ){\ |
Line 2219... | Line 2219... | ||
2219 | ctx.fill();\ |
2219 | ctx.fill();\ |
2220 | ctx.restore();\ |
2220 | ctx.restore();\ |
2221 | }else{xmarge = 0;ymarge = 0;};\ |
2221 | }else{xmarge = 0;ymarge = 0;};\ |
2222 | if( typeof(xaxislabel) !== 'undefined' ){\ |
2222 | if( typeof(xaxislabel) !== 'undefined' ){\ |
2223 | ctx.save();\ |
2223 | ctx.save();\ |
2224 | ctx.font = \"italic \"+font_size+\"px |
2224 | ctx.font = \"italic \"+font_size+\"px Arial\";\ |
2225 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2225 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2226 | corr = ctx.measureText(xaxislabel).width;\ |
2226 | corr = ctx.measureText(xaxislabel).width;\ |
2227 | ctx.fillText(xaxislabel,xsize - 1.5*corr,ysize - 2*font_size);\ |
2227 | ctx.fillText(xaxislabel,xsize - 1.5*corr,ysize - 2*font_size);\ |
2228 | ctx.restore();\ |
2228 | ctx.restore();\ |
2229 | };\ |
2229 | };\ |
2230 | if( typeof(yaxislabel) !== 'undefined' ){\ |
2230 | if( typeof(yaxislabel) !== 'undefined' ){\ |
2231 | ctx.save();\ |
2231 | ctx.save();\ |
2232 | ctx.font = \"italic \"+font_size+\"px |
2232 | ctx.font = \"italic \"+font_size+\"px Arial\";\ |
2233 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2233 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2234 | corr = ctx.measureText(yaxislabel).width;\ |
2234 | corr = ctx.measureText(yaxislabel).width;\ |
2235 | ctx.translate(xmarge+font_size,corr+font_size);\ |
2235 | ctx.translate(xmarge+font_size,corr+font_size);\ |
2236 | ctx.rotate(-0.5*Math.PI);\ |
2236 | ctx.rotate(-0.5*Math.PI);\ |
2237 | ctx.fillText(yaxislabel,0,0);\ |
2237 | ctx.fillText(yaxislabel,0,0);\ |
Line 2320... | Line 2320... | ||
2320 | ctx.fill();\ |
2320 | ctx.fill();\ |
2321 | ctx.restore();\ |
2321 | ctx.restore();\ |
2322 | }else{xmarge = 0;ymarge = 0;};\ |
2322 | }else{xmarge = 0;ymarge = 0;};\ |
2323 | if( typeof(xaxislabel) !== 'undefined' ){\ |
2323 | if( typeof(xaxislabel) !== 'undefined' ){\ |
2324 | ctx.save();\ |
2324 | ctx.save();\ |
2325 | ctx.font = \"italic \"+font_size+\"px |
2325 | ctx.font = \"italic \"+font_size+\"px Arial\";\ |
2326 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2326 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2327 | corr = ctx.measureText(xaxislabel).width;\ |
2327 | corr = ctx.measureText(xaxislabel).width;\ |
2328 | ctx.fillText(xaxislabel,xsize - 1.5*corr,ysize - 2*font_size);\ |
2328 | ctx.fillText(xaxislabel,xsize - 1.5*corr,ysize - 2*font_size);\ |
2329 | ctx.restore();\ |
2329 | ctx.restore();\ |
2330 | };\ |
2330 | };\ |
2331 | if( typeof(yaxislabel) !== 'undefined' ){\ |
2331 | if( typeof(yaxislabel) !== 'undefined' ){\ |
2332 | ctx.save();\ |
2332 | ctx.save();\ |
2333 | ctx.font = \"italic \"+font_size+\"px |
2333 | ctx.font = \"italic \"+font_size+\"px Arial\";\ |
2334 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2334 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2335 | corr = ctx.measureText(yaxislabel).width;\ |
2335 | corr = ctx.measureText(yaxislabel).width;\ |
2336 | ctx.translate(xmarge+font_size,corr+font_size);\ |
2336 | ctx.translate(xmarge+font_size,corr+font_size);\ |
2337 | ctx.rotate(-0.5*Math.PI);\ |
2337 | ctx.rotate(-0.5*Math.PI);\ |
2338 | ctx.fillText(yaxislabel,0,0);\ |
2338 | ctx.fillText(yaxislabel,0,0);\ |
Line 2422... | Line 2422... | ||
2422 | ctx.fill();\ |
2422 | ctx.fill();\ |
2423 | ctx.restore();\ |
2423 | ctx.restore();\ |
2424 | }else{xmarge = 0;ymarge = 0;};\ |
2424 | }else{xmarge = 0;ymarge = 0;};\ |
2425 | if( typeof(xaxislabel) !== 'undefined' ){\ |
2425 | if( typeof(xaxislabel) !== 'undefined' ){\ |
2426 | ctx.save();\ |
2426 | ctx.save();\ |
2427 | ctx.font = \"italic \"+font_size+\"px |
2427 | ctx.font = \"italic \"+font_size+\"px Arial\";\ |
2428 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2428 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2429 | corr = ctx.measureText(xaxislabel).width;\ |
2429 | corr = ctx.measureText(xaxislabel).width;\ |
2430 | ctx.fillText(xaxislabel,xsize - 1.5*corr,ysize - 2*font_size);\ |
2430 | ctx.fillText(xaxislabel,xsize - 1.5*corr,ysize - 2*font_size);\ |
2431 | ctx.restore();\ |
2431 | ctx.restore();\ |
2432 | };\ |
2432 | };\ |
2433 | if( typeof(yaxislabel) !== 'undefined' ){\ |
2433 | if( typeof(yaxislabel) !== 'undefined' ){\ |
2434 | ctx.save();\ |
2434 | ctx.save();\ |
2435 | ctx.font = \"italic \"+font_size+\"px |
2435 | ctx.font = \"italic \"+font_size+\"px Arial\";\ |
2436 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2436 | ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\ |
2437 | corr = ctx.measureText(yaxislabel).width;\ |
2437 | corr = ctx.measureText(yaxislabel).width;\ |
2438 | ctx.translate(xmarge+font_size,corr+font_size);\ |
2438 | ctx.translate(xmarge+font_size,corr+font_size);\ |
2439 | ctx.rotate(-0.5*Math.PI);\ |
2439 | ctx.rotate(-0.5*Math.PI);\ |
2440 | ctx.fillText(yaxislabel,0,0);\ |
2440 | ctx.fillText(yaxislabel,0,0);\ |