상자 그림

상자 그림 스파크라인은 사분위수를 사용하여 데이터를 표시하며 그래픽으로 데이터 집합을 검토하는 빠른 방법입니다.

설명
app.vue
index.html
styles.css

수식에서 다음과 같이 BoxPlotSparkline 함수를 사용하여 상자 그림 스파크라인을 만들 수 있습니다. =BOXPLOTSPARKLINE(points, boxPlotClass?, showAverage?, scaleStart?, scaleEnd?, acceptableStart?, acceptableEnd?, colorScheme?, style?, vertical?)

이 함수에는 다음과 같은 매개 변수가 있습니다.

points: 값이 포함된 셀 범위를 나타내는 참조입니다(예: "A1:A4").

boxPlotClass\: (선택 사항) boxPlot의 클래스입니다. 다음 중 하나입니다.

  • 5ns (기본값)
  • 7ns
  • tukey
  • bowley
  • sigma3

showAverage\: (선택 사항) 평균을 표시할지 여부를 나타내는 부울입니다. 기본값은 false입니다.

scaleStart\: (선택 사항) 스파크라인의 최소 경계를 나타내는 숫자 또는 참조입니다(예: 1 또는 "A6"). 기본값은 모든 값의 최소값입니다.

scaleEnd\: (선택 사항) 스파크라인의 최대 경계를 나타내는 숫자 또는 참조입니다(예: 8 또는 "A7"). 기본값은 모든 값의 최대값입니다.

acceptableStart\: (선택 사항) 허용되는 선의 시작을 나타내는 숫자 또는 참조입니다(예: 3 또는 "A8"). 기본값은 null입니다.

acceptableEnd\: (선택 사항) 허용되는 선의 끝을 나타내는 숫자 또는 참조입니다(예: 5 또는 "A9"). 기본값은 null입니다.

colorScheme\: (선택 사항) 스파크라인의 상자 색을 나타내는 문자열입니다. 기본값은 "#D2D2D2"입니다.

style\: (선택 사항) 상자 그림 스파크라인의 스타일을 나타내는 숫자 또는 참조입니다. 다음 중 하나입니다.

  • 0: (기본값) Classical 스타일 - 수염이 선이고 이상값이 원입니다.
  • 1: Neo 스타일 - 수염이 사각형이고 이상값이 선입니다.

vertical\: (선택 사항) 스파크라인을 세로로 표시할지 여부를 나타내는 부울입니다. 기본값은 false입니다.

수식에서 다음과 같이 BoxPlotSparkline 함수를 사용하여 상자 그림 스파크라인을 만들 수 있습니다. =BOXPLOTSPARKLINE(points, boxPlotClass?, showAverage?, scaleStart?, scaleEnd?, acceptableStart?, acceptableEnd?, colorScheme?, style?, vertical?) 이 함수에는 다음과 같은 매개 변수가 있습니다. points: 값이 포함된 셀 범위를 나타내는 참조입니다(예: "A1:A4"). boxPlotClass\: (선택 사항) boxPlot의 클래스입니다. 다음 중 하나입니다. 5ns (기본값) 7ns tukey bowley sigma3 showAverage\: (선택 사항) 평균을 표시할지 여부를 나타내는 부울입니다. 기본값은 false입니다. scaleStart\: (선택 사항) 스파크라인의 최소 경계를 나타내는 숫자 또는 참조입니다(예: 1 또는 "A6"). 기본값은 모든 값의 최소값입니다. scaleEnd\: (선택 사항) 스파크라인의 최대 경계를 나타내는 숫자 또는 참조입니다(예: 8 또는 "A7"). 기본값은 모든 값의 최대값입니다. acceptableStart\: (선택 사항) 허용되는 선의 시작을 나타내는 숫자 또는 참조입니다(예: 3 또는 "A8"). 기본값은 null입니다. acceptableEnd\: (선택 사항) 허용되는 선의 끝을 나타내는 숫자 또는 참조입니다(예: 5 또는 "A9"). 기본값은 null입니다. colorScheme\: (선택 사항) 스파크라인의 상자 색을 나타내는 문자열입니다. 기본값은 "#D2D2D2"입니다. style\: (선택 사항) 상자 그림 스파크라인의 스타일을 나타내는 숫자 또는 참조입니다. 다음 중 하나입니다. 0: (기본값) Classical 스타일 - 수염이 선이고 이상값이 원입니다. 1: Neo 스타일 - 수염이 사각형이고 이상값이 선입니다. vertical\: (선택 사항) 스파크라인을 세로로 표시할지 여부를 나타내는 부울입니다. 기본값은 false입니다.
<template> <div class="sample-tutorial"> <gc-spread-sheets :newTabVisible=false class="sample-spreadsheets" @workbookInitialized="initSpread"> <gc-worksheet :allowCellOverflow=true> </gc-worksheet> <gc-worksheet></gc-worksheet> </gc-spread-sheets> <div class="options-container"> <div> <label><b>Settings:</b></label> </div> <hr> <div class="option-row"> <label for="scaleStart">Start scope of the sale:</label> <input type="text" style="margin: 0 20px 0 6px;" id="scaleStart" value="0" /> </div> <div class="option-row"> <label for="scaleEnd">End scope of the sale:</label> <input type="text" style="margin: 0 20px 0 6px;" id="scaleEnd" value="100" /> </div> <div class="option-row"> <label for="acceptableStart">Start scope of expected sale:</label> <input type="text" style="margin: 0 20px 0 6px;" id="acceptableStart" value="20" /> </div> <div class="option-row"> <label for="acceptableEnd">End scope of expected sale:</label> <input type="text" style="margin: 0 20px 0 6px;" id="acceptableEnd" value="80" /> </div> <div class="option-row"> <label for="colorScheme">Color Scheme:</label> <select id="colorScheme" style="margin: 0 20px 0 6px"> <option value="#DDDDDD" selected>LightGrey</option> <option value="#BBBBBB">Grey</option> <option value="#999999">DarkGrey</option> <option value="#82BC00">Green</option> <option value="#000000">Black</option> <option value="#F7A711">Orange</option> </select> </div> <hr> <div class="option-row"> <div class="option"> <button id='btnChangeSetting' @click="btnChangeSettingClicked($event)">Change Settings</button> </div> </div> </div> </div> </template> <script> import Vue from "vue"; import GC from '@mescius/spread-sheets'; import '@mescius/spread-sheets-resources-ko'; import '@mescius/spread-sheets-vue' GC.Spread.Common.CultureManager.culture("ko-kr"); import './styles.css'; let App = Vue.extend({ name: "app", data: function () { return { spread: null }; }, methods: { initHorizontalSparkline(sheet, name) { sheet.suspendPaint(); sheet.name(name); sheet.options.allowCellOverflow = true; sheet.addSpan(1, 1, 1, 14); sheet.getCell(1, 1).value("The Company Sales in 2014") .font("20px Arial").vAlign(GC.Spread.Sheets.VerticalAlign.center) .foreColor("white").backColor("#999999"); sheet.getRange(2, 1, 1, 14).vAlign(GC.Spread.Sheets.VerticalAlign.center) .font("bold 12px Arial") .backColor("#efefef"); sheet.setValue(2, 1, "Region"); sheet.setValue(2, 14, "Actual Sales (mn)"); for (var i = 2; i < 14; i++) { sheet.setValue(2, i, new Date(2014, i - 2, 1)); sheet.setColumnWidth(i, 40); sheet.setFormatter(2, i, "mmm"); } sheet.setArray(3, 1, [ ["Alabama", 68, 81, 21, 69, 39, 28, 63, 73, 80, 95, 46, 37], ["Alaska", 37, 57, 99, 47, 95, 86, 44, 82, 89, 61, 45, 75], ["Arizona", 61, 42, 97, 12, 95, 25, 29, 44, 64, 39, 59, 35], ["Idaho", 16, 51, 45, 82, 72, 51, 100, 98, 92, 89, 44, 68], ["Indiana", 26, 46, 74, 58, 40, 32, 58, 75, 39, 58, 97, 39], ["Ohio", 37, 68, 20, 35, 65, 87, 39, 25, 79, 15, 91, 42], ["Oklahoma", 36, 43, 31, 63, 95, 26, 19, 88, 25, 78, 98, 53], ["Oregon", 28, 71, 68, 48, 19, 56, 88, 54, 28, 25, 92, 75], ["Vermon", 85, 25, 31, 34, 75, 82, 50, 27, 76, 72, 25, 100] ]); for (var index = 3; index < 12; index++) { sheet.setFormula(index, 14, '=BOXPLOTSPARKLINE($C' + (index + 1) + ':$N' + (index + 1) + ',"5ns",true,0,100,20,80,"#D3D3D3",0,false)'); } for (let r = 1; r < 12; r++) { sheet.setRowHeight(r, 30); } sheet.setColumnWidth(14, 250); sheet.resumePaint(); }, initVerticalSparkline(sheet, name) { sheet.suspendPaint(); sheet.name(name); sheet.addSpan(1, 1, 1, 4); sheet.getCell(1, 1).value("Scores by Teaching Method").vAlign(GC.Spread.Sheets.VerticalAlign.center) .font("bold 14px Arial") .foreColor("white").backColor("#999999"); sheet.getRange(2, 1, 1, 4).vAlign(GC.Spread.Sheets.VerticalAlign.center) .font("bold 12px Arial") .backColor("#efefef"); sheet.setValue(2, 1, "Student ID"); sheet.setValue(2, 2, "Method 1"); sheet.setValue(2, 3, "Method 2"); sheet.setValue(2, 4, "Method 3"); sheet.getCell(23, 6).value("Method 1").font("bold 10px Arial"); sheet.getCell(23, 7).value("Method 2").font("bold 10px Arial"); sheet.getCell(23, 8).value("Method 3").font("bold 10px Arial"); let score = [{ id: 1, methodOne: 65, methodTwo: 60, methodThree: 98 }, { id: 2, methodOne: 91, methodTwo: 70, methodThree: 99 }, { id: 3, methodOne: 70, methodTwo: 86, methodThree: 92 }, { id: 4, methodOne: 62, methodTwo: 62, methodThree: 78 }, { id: 5, methodOne: 98, methodTwo: 79, methodThree: 71 }, { id: 6, methodOne: 89, methodTwo: 99, methodThree: 68 }, { id: 7, methodOne: 85, methodTwo: 100, methodThree: 88 }, { id: 8, methodOne: 65, methodTwo: 78, methodThree: 74 }, { id: 9, methodOne: 65, methodTwo: 66, methodThree: 85 }, { id: 10, methodOne: 65, methodTwo: 84, methodThree: 80 }, { id: 11, methodOne: 65, methodTwo: 98, methodThree: 79 }, { id: 12, methodOne: 65, methodTwo: 87, methodThree: 50 }, { id: 13, methodOne: 51, methodTwo: 68, methodThree: 64 }, { id: 14, methodOne: 45, methodTwo: 78, methodThree: 73 }, { id: 15, methodOne: 67, methodTwo: 81, methodThree: 88 }, { id: 16, methodOne: 87, methodTwo: 83, methodThree: 85 }, { id: 17, methodOne: 72, methodTwo: 84, methodThree: 84 }, { id: 18, methodOne: 74, methodTwo: 82, methodThree: 86 }, { id: 19, methodOne: 85, methodTwo: 45, methodThree: 92 }, { id: 20, methodOne: 65, methodTwo: 60, methodThree: 69 } ]; for (let i = 0, len = score.length; i < len; i++) { let student = score[i]; sheet.setValue(i + 3, 1, student.id); sheet.setValue(i + 3, 2, student.methodOne); sheet.setValue(i + 3, 3, student.methodTwo); sheet.setValue(i + 3, 4, student.methodThree); } for (let index = 0; index < 4; index++) { sheet.setColumnWidth(index + 1, 100); } //sparklines sheet.addSpan(3, 6, 20, 1); sheet.addSpan(3, 7, 20, 1); sheet.addSpan(3, 8, 20, 1); sheet.setFormula(3, 6, '=BOXPLOTSPARKLINE(C4:C23,"5ns",true,0,100,20,80,"#DDDDDD",0, true)'); sheet.setFormula(3, 7, '=BOXPLOTSPARKLINE(D4:D23,"5ns",true,0,100,20,80,"#DDDDDD",0, true)'); sheet.setFormula(3, 8, '=BOXPLOTSPARKLINE(E4:E23,"5ns",true,0,100,20,80,"#DDDDDD",0, true)'); sheet.resumePaint(); }, initSpread(spread) { this.spread = spread; spread.setSheetCount(2); spread.options.newTabVisible = false; this.initHorizontalSparkline(spread.sheets[0], "Horizontal"); this.initVerticalSparkline(spread.sheets[1], "Vertical"); }, btnChangeSettingClicked: function (e) { var sheet = this.spread.getActiveSheet(); if (this.spread.getActiveSheetIndex() == 0) { for (var index = 3; index < 12; index++) { sheet.setFormula(index, 14, '=BOXPLOTSPARKLINE($C' + (index + 1) + ':$N' + (index + 1) + ',"5ns",true,' + document.getElementById('scaleStart').value + ',' + document.getElementById('scaleEnd').value + ',' + document.getElementById('acceptableStart').value + ',' + document.getElementById('acceptableEnd').value + ',"' + document.getElementById('colorScheme').value + '",0,FALSE)'); } } else if (this.spread.getActiveSheetIndex() == 1) { sheet.setFormula(3, 6, '=BOXPLOTSPARKLINE(C4:C23,"5ns",true,' + document.getElementById('scaleStart').value + ',' + document.getElementById('scaleEnd').value + ',' + document.getElementById('acceptableStart').value + ',' + document.getElementById('acceptableEnd').value + ',"' + document.getElementById('colorScheme').value + '",0,TRUE)'); sheet.setFormula(3, 7, '=BOXPLOTSPARKLINE(D4:D23,"5ns",true,' + document.getElementById('scaleStart').value + ',' + document.getElementById('scaleEnd').value + ',' + document.getElementById('acceptableStart').value + ',' + document.getElementById('acceptableEnd').value + ',"' + document.getElementById('colorScheme').value + '",0,TRUE)'); sheet.setFormula(3, 8, '=BOXPLOTSPARKLINE(E4:E23,"5ns",true,' + document.getElementById('scaleStart').value + ',' + document.getElementById('scaleEnd').value + ',' + document.getElementById('acceptableStart').value + ',' + document.getElementById('acceptableEnd').value + ',"' + document.getElementById('colorScheme').value + '",0,TRUE)'); } } } }); new Vue({ render: h => h(App) }).$mount('#app'); </script>
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/ko/vue/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <!-- SystemJS --> <script src="$DEMOROOT$/ko/vue/node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); System.import('$DEMOROOT$/ko/lib/vue/license.js'); </script> </head> <body> <div id="app" style="height: 100%;"></div> </body> </html>
.sample { position: relative; height: 100%; overflow: auto; } .sample::after { display: block; content: ""; clear: both; } .sample-tutorial { position: relative; height: 100%; overflow: hidden; } .sample-spreadsheets { width: calc(100% - 280px); height: 100%; overflow: hidden; float: left; } .options-container { float: right; width: 280px; padding: 12px; height: 100%; box-sizing: border-box; background: #fbfbfb; overflow: auto; } .option-row { font-size: 14px; padding: 5px; margin-top: 10px; } .option-group { margin-bottom: 6px; } label { display: inline-block; min-width: 90px; margin-bottom: 6px; } select { padding: 4px 6px; box-sizing: border-box; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }
(function (global) { System.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true }, meta: { '*.css': { loader: 'css' }, '*.vue': { loader: 'vue-loader' } }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { '@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js', '@mescius/spread-sheets-resources-ko': 'npm:@mescius/spread-sheets-resources-ko/index.js', '@mescius/spread-sheets-vue': 'npm:@mescius/spread-sheets-vue/index.js', '@grapecity/jsob-test-dependency-package/react-components': 'npm:@grapecity/jsob-test-dependency-package/react-components/index.js', 'jszip': 'npm:jszip/dist/jszip.js', 'css': 'npm:systemjs-plugin-css/css.js', 'vue': 'npm:vue/dist/vue.min.js', 'vue-loader': 'npm:systemjs-vue-browser/index.js', 'tiny-emitter': 'npm:tiny-emitter/index.js', 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build':'npm:systemjs-plugin-babel/systemjs-babel-browser.js' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'js' }, rxjs: { defaultExtension: 'js' }, "node_modules": { defaultExtension: 'js' } } }); })(this);