[]
열, 꺽은선, 승패 스파크라인 그래프에 마커 또는 포인트를 표시할 수 있습니다. 낮은 값 또는 음수, 높은 값, 첫 번째 포인트, 마지막 포인트에 대해 서로 다른 색상을 지정할 수 있습니다.
High point는 가장 큰 값을 나타내는 포인트입니다. Low point는 가장 작은 값을 나타내는 포인트입니다. Negative point는 음수 값을 나타냅니다. First point는 그래프에서 처음으로 그려지는 포인트이고, Last point는 마지막으로 그려지는 포인트입니다.
options.markersColor
속성은 메서드를 사용하여 스파크라인을 추가할 때 꺽은선 스파크라인 유형에만 적용됩니다. 열, 꺽은선, 승패 수식에서는 마커를 지정할 수 있는 옵션이 존재합니다.
다음 코드 샘플은 스파크라인을 추가하고 마커에 대한 색상을 지정하는 예시입니다.
Ask ChatGPT
activeSheet.setValue(0, 0, "Data Range is A2-A9");
activeSheet.setValue(1, 0, 1);
activeSheet.setValue(2, 0, -2);
activeSheet.setValue(3, 0, -1);
activeSheet.setValue(4, 0, 6);
activeSheet.setValue(5, 0, 4);
activeSheet.setValue(6, 0, -4);
activeSheet.setValue(7, 0, 3);
activeSheet.setValue(8, 0, 8);
activeSheet.setValue(0, 2, "Date axis range is C2-C9");
activeSheet.setValue(1, 2, '2011/1/5');
activeSheet.setValue(2, 2, '2011/1/1');
activeSheet.setValue(3, 2, '2011/2/11');
activeSheet.setValue(4, 2, '2011/3/1');
activeSheet.setValue(5, 2, '2011/2/1');
activeSheet.setValue(6, 2, '2011/2/3');
activeSheet.setValue(7, 2, '2011/3/6');
activeSheet.setValue(8, 2, '2011/2/19');
var data = new GC.Spread.Sheets.Range(1, 0, 8, 1);
var dateAxis = new GC.Spread.Sheets.Range(1, 2, 8, 1);
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
setting.options.lineWeight = 3;
setting.options.displayXAxis = true;
setting.options.showFirst = true;
setting.options.showLast = true;
setting.options.showLow = true;
setting.options.showHigh = true;
setting.options.showNegative = true;
setting.options.seriesColor = "Text 2 1";
setting.options.firstMarkerColor = "Text 2 3";
setting.options.negativeColor = "Accent 2 1";
setting.options.markersColor = "Accent 3 1";
setting.options.lowMarkerColor = "Accent 4 1";
setting.options.highMarkerColor = "Accent 6 1";
setting.options.lastMarkerColor = "Accent 6 6";
setting.options.axisColor = "Text 1 1";
activeSheet.addSpan(11, 0, 1, 3, null)
activeSheet.setText(11, 0, "Sparkline with dateAxis:", null);
activeSheet.setText(12, 0, "(1) Line", null);
activeSheet.setText(12, 3, "(2)Column", null);
activeSheet.setText(12, 6, "(3)Winloss", null);
//line
activeSheet.addSpan(14, 0, 4, 3, null);
activeSheet.setSparkline(14, 0, data
, GC.Spread.Sheets.Sparklines.DataOrientation.Vertical
, GC.Spread.Sheets.Sparklines.SparklineType.line
, setting
, dateAxis
, GC.Spread.Sheets.Sparklines.DataOrientation.Vertical
);
//column
activeSheet.addSpan(14, 3, 4, 3, null);
activeSheet.setSparkline(14, 3, data
, GC.Spread.Sheets.Sparklines.DataOrientation.Vertical
, GC.Spread.Sheets.Sparklines.SparklineType.column
, setting
, dateAxis
, GC.Spread.Sheets.Sparklines.DataOrientation.Vertical
);
//winloss
activeSheet.addSpan(14, 6, 4, 3, null);
activeSheet.setSparkline(14, 6, data
, GC.Spread.Sheets.Sparklines.DataOrientation.Vertical
, GC.Spread.Sheets.Sparklines.SparklineType.winloss
, setting
, dateAxis
, GC.Spread.Sheets.Sparklines.DataOrientation.Vertical
);