Scatter

Scatter sparklines can be used to compare numeric values, such as scientific, statistical, and engineering data.

<p>You can create a scatter sparkline using the ScatterSparkline function in a formula: <strong>=SCATTERSPARKLINE(points1, points2?, minX?, maxX?, minY?, maxY?, hLine?, vLine?, xMinZone?, xMaxZone?, yMinZone?, yMaxZone?, tags?, drawSymbol?, drawLines?, color1?, color2?, dash?)</strong>.</p> <p>The function has the following parameters:</p> <p><strong>points1</strong>: The first series of <em>x</em>,<em>y</em> data. It is a range, such as "H1:I3". If the row count is greater than or equal to the column count, get data from the first two columns; the first column contains <em>x</em> values, and the second column contains <em>y</em> values. Otherwise, get data from the first two rows; the first row contains <em>x</em> values, and the second row contains <em>y</em> values.</p> <p><strong>points2</strong>: (optional) The second series of <em>x</em>,<em>y</em> data. It is a range, such as "H4:I6". If the row count is greater than or equal to the column count, get data from the first two columns; the first column contains <em>x</em> values, and the second column contains <em>y</em> values. Otherwise, get data from the first two rows; the first row contains <em>x</em> values, and the second row contains <em>y</em> values.</p> <p><strong>minX</strong>: (optional) <em>x</em> minimum limit of both series; each series has its own value if it is omitted.</p> <p><strong>maxX</strong>: (optional) <em>x</em> maximum limit of both series; each series has its own value if it is omitted.</p> <p><strong>minY</strong>: (optional) <em>y</em> minimum limit of both series; each series has its own value if it is omitted.</p> <p><strong>maxY</strong>: (optional) <em>y</em> maximum limit of both series; each series has its own value if it is omitted.</p> <p><strong>hLine</strong>: (optional) The position of the horizontal axis; there is no line if it is omitted.</p> <p><strong>vLine</strong>: (optional) The position of the vertical axis; there is no line if it is omitted.</p> <p><strong>xMinZone</strong>: (optional) <em>x</em> minimum value of the gray zone; there is no gray zone if any of these four zone params are omitted.</p> <p><strong>xMaxZone</strong>: (optional) <em>x</em> maximum value of the gray zone; there is no gray zone if any of these four zone params are omitted.</p> <p><strong>yMinZone</strong>: (optional) <em>y</em> minimum value of the gray zone; there is no gray zone if any of these four zone params are omitted.</p> <p><strong>yMaxZone</strong>: (optional) <em>y</em> maximum value of the gray zone; there is no gray zone if any of these four zone params are omitted.</p> <p><strong>tags</strong>: (optional) If it is true, mark the point where the <em>y</em> value is the maximum of the first series as "#0000FF", and mark the point where the <em>y</em> value is the minimum of the first series as "#CB0000". The default value is false.</p> <p><strong>drawSymbol</strong>: (optional) If it is true, draw each point as a symbol. The symbol of the first series is a circle, and the symbol of the second series is a square. The default value is true.</p> <p><strong>drawLines</strong>: (optional) If it is true, connect each point with a line by sequence in each series. The default value is false.</p> <p><strong>color1</strong>: (optional) Color string of the first series of points; the default value is "#969696".</p> <p><strong>color2</strong>: (optional) Color string of the second series of points; the default value is "#CB0000".</p> <p><strong>dash</strong>: (optional) If it is true, the line is a dashed line; otherwise, the line is a full line. The default value is false.</p>
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss")); initSpread(spread); }; function initSpread(spread) { var spreadNS = GC.Spread.Sheets; var sheet = spread.sheets[0]; sheet.suspendPaint(); sheet.addSpan(0, 0, 1, 5); sheet.getCell(0, 0).value("Particulate Levels in Rainfall").font("20px Arial").hAlign(spreadNS.HorizontalAlign.center).vAlign(spreadNS.VerticalAlign.center); var table1 = sheet.tables.add("table1", 1, 0, 10, 5, spreadNS.Tables.TableThemes.medium4); table1.rowFilter().filterButtonVisible(false); sheet.setArray(1, 0, [ ["Daily rainfall", "Particulate level", "Daily rainfall1", "Temperature", "Diagram"], [2.0, 100, 2.0, 15], [2.5, 130, 2.5, 12], [3.0, 120, 3.0, 11], [3.5, 140, 3.5, 9], [4.0, 120, 4.0, 10], [4.5, 110, 4.5, 10], [5.0, 110, 5.0, 9], [5.5, 105, 5.5, 9], [6.0, 100, 6.0, 8] ]); sheet.addSpan(2, 4, 9, 1); sheet.setFormula(2, 4, '=SCATTERSPARKLINE(A3:B11,C3:D11,,,,,AVERAGE(B3:B11),AVERAGE(A3:A11),,,,,TRUE,TRUE,TRUE,"green",,TRUE)'); sheet.setRowHeight(0, 50); for (var i = 1; i < 11; i++) { sheet.setRowHeight(i, 25); } sheet.setColumnWidth(0, 120); sheet.setColumnWidth(1, 120); sheet.setColumnWidth(2, 120); sheet.setColumnWidth(3, 120); sheet.setColumnWidth(4, 200); sheet.setColumnVisible(2, false); sheet.resumePaint(); };
<!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$/en/purejs/node_modules/@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/en/purejs/node_modules/@grapecity/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div class="sample-tutorial"> <div id="ss" style="width:100%;height:100%"></div> </div> </body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }