1//////////////////////////////////////////////////////////// 2// æåæ°ã®æ£ã°ã©ããåºåãã颿° 3// Author: Yoichiro Hasebe 4//////////////////////////////////////////////////////////// 5 6function create_numchar_chart(numchar_data, language){ 7 var label_current; 8 var label_target; 9 if(language === "en"){ 10 label_current = "Current"; 11 label_target = "Target"; 12 } else { 13 label_current = "å ¥åæåæ°"; 14 label_target = "ç®æ¨æåæ°"; 15 } 16 17 // æ¢åã®ã¤ãã³ããã³ãã©ã¼ãã¯ãªã¼ã³ã¢ãã 18 $('#numchar_chart').unbind('jqplotPostDraw'); 19 $(window).off('resize.numchar_chart'); 20 21 $.jqplot.config.enablePlugins = true; 22 23 // å ã®2ãã¼æ§é ã«æ»ã 24 var plot = $.jqplot('numchar_chart', 25 [ 26 [[numchar_data["elements"], label_current], [numchar_data["target"], label_target]] 27 ], 28 { 29 seriesDefaults:{ 30 renderer:$.jqplot.BarRenderer, 31 pointLabels: { show: true, location: 'w', edgeTolerance: 5 }, 32 rendererOptions: { 33 barDirection: "horizontal", 34 varyBarColor: true, 35 barPadding: 8, 36 barMargin: 10, 37 barWidth: null, 38 shadowOffset: 0, 39 shadowDepth: 0, 40 shadowAlpha: 0, 41 shadow: false, 42 highlightMouseOver: false, 43 borderWidth: 0, 44 borderColor: null 45 } 46 }, 47 grid: { 48 background: '#ffffff', 49 gridLineColor: '#eeeeee', 50 borderColor: '#dddddd', 51 borderWidth: 1, 52 shadow: false 53 }, 54 axes: { 55 yaxis: { 56 renderer: $.jqplot.CategoryAxisRenderer, 57 tickOptions: { 58 fontSize: '10pt', 59 markSize: 0 60 } 61 } 62 }, 63 // ãã¼ã®è²ãæ·¡ããã¦æ°åãè¦ããã 64 seriesColors: ['rgba(52, 152, 219, 0.7)', 'rgba(243, 156, 18, 0.7)'] // éã¨ãªã¬ã³ã¸ï¼70%éæåº¦ï¼ 65 } 66 ); 67 68 // æç»å®äºå¾ã«èæ¯ãã¼ã追å 69 $('#numchar_chart').bind('jqplotPostDraw', function() { 70 addBackgroundBarOverlay(plot, numchar_data["target"]); 71 }); 72 73 // æåã®æç»å¾ãæåã§èæ¯ãã¼ã追å ï¼ã¤ãã³ããçºç«ããªãå ´åã®ãã©ã¼ã«ããã¯ï¼ 74 setTimeout(function() { 75 addBackgroundBarOverlay(plot, numchar_data["target"]); 76 }, 10); // é å»¶ãæå°å 77 78 // ã¦ã£ã³ãã¦ãªãµã¤ãºæã«ãã£ã¼ããåæç» 79 $(window).off('resize.numchar_chart').on('resize.numchar_chart', function() { 80 // ããã¦ã³ã¹å¦çï¼ãªãµã¤ãºå®äºå¾ã«å®è¡ï¼ 81 clearTimeout(window.numcharResizeTimer); 82 window.numcharResizeTimer = setTimeout(function() { 83 plot.replot({ resetAxes: true }); 84 }, 250); 85 }); 86} 87 88// jqPlotã®æ£ç¢ºãªåº§æ¨ã使ã£ã¦èæ¯ãã¼ã追å 89function addBackgroundBarOverlay(plot, targetValue) { 90 // æ¢åã®èæ¯ãã¼ãåé¤ï¼åæç»æï¼ 91 $('#numchar_chart .background-bar-overlay').remove(); 92 93 // ããããã®ã°ãªããæ å ±ãåå¾ 94 var plotDim = plot.grid._plotDimensions || {}; 95 var gridPad = { 96 top: plot.grid._top || plotDim.top || 10, 97 left: plot.grid._left || plotDim.left || 80, 98 right: plot.grid._right || plotDim.right || 40, 99 bottom: plot.grid._bottom || plotDim.bottom || 40 100 }; 101 var gridWidth = plot.grid._width || plotDim.width || 500; 102 var gridHeight = plot.grid._height || plotDim.height || 200; 103 104 // Xè»¸ã®æ å ±ãåå¾ 105 var xaxis = plot.axes.xaxis; 106 var xmin = xaxis.min; 107 var xmax = xaxis.max; 108 109 // å ¥åæåæ°ã®ãã¼ã®ä½ç½® 110 // jqPlotã§ã¯ä¸ããä¸ã«ã«ãã´ãªãé ç½®ããããããå ¥åæåæ°ã¯ä¸å´ï¼barIndex = 1ï¼ 111 var barIndex = 1; // å ¥åæåæ°ã¯2çªç®ï¼ä¸å´ï¼ã®ãã¼ 112 var numBars = 2; // ãã¼ã¯2㤠113 var barHeight = gridHeight / numBars * 0.6; // ãã¼ã®é«ãï¼ã°ãªããã®60%ï¼ 114 115 // ãã¼ã®Yä½ç½®ãè¨ç® 116 var barY = gridPad.top + (gridHeight / numBars) * barIndex + (gridHeight / numBars - barHeight) / 2; 117 118 // ç®æ¨æåæ°ã«å¯¾å¿ããXä½ç½®ãè¨ç® 119 var barWidth = ((targetValue - xmin) / (xmax - xmin)) * gridWidth; 120 121 // HTMLè¦ç´ ã¨ãã¦èæ¯ãã¼ã追å 122 var $backgroundBar = $('<div></div>') 123 .addClass('background-bar-overlay') 124 .css({ 125 position: 'absolute', 126 left: gridPad.left + 'px', 127 top: barY + 'px', 128 width: barWidth + 'px', 129 height: barHeight + 'px', 130 backgroundColor: 'rgba(52, 152, 219, 0.15)', 131 zIndex: 1, // jqPlotã®ãã£ã³ãã¹ããä¸ã«é ç½® 132 pointerEvents: 'none' // ã¯ãªãã¯ã¤ãã³ããéé 133 }); 134 135 // ãã£ã¼ãã³ã³ããã«è¿½å 136 var $container = $('#numchar_chart').css('position', 'relative'); 137 $container.append($backgroundBar); 138}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.