const spread = new GC.Spread.Sheets.Workbook(document.getElementById('spreadContainer'));
const sheet = spread.getActiveSheet();
spread.options.tabStripVisible = false;
// 월별 판매 데이터 (행 방향, 열 3~14에 저장)
const monthData = [42, 55, 38, 61, 49, 72, 58, 65, 44, 53, 69, 77];
const winLossData = [1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1];
// 헤더
['이름', 'Line', 'Column', 'WinLoss'].forEach((h, c) => {
sheet.setValue(0, c, h);
sheet.getCell(0, c).backColor('#37474F').foreColor('#fff').font('bold 12px sans-serif');
sheet.setColumnWidth(c, 90);
});
sheet.setRowHeight(0, 32);
// 판매량 데이터 (1행, 열 3~14)
sheet.setValue(1, 0, '월별 판매량');
monthData.forEach((v, i) => sheet.setValue(1, i + 3, v));
// 승패 데이터 (2행, 열 3~14)
sheet.setValue(2, 0, '목표 달성');
winLossData.forEach((v, i) => sheet.setValue(2, i + 3, v));
// SparklineSetting — Line용
const lineSetting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
lineSetting.options.showMarkers = true;
lineSetting.options.showHigh = true;
lineSetting.options.showLow = true;
lineSetting.options.lineWeight = 2.5;
lineSetting.options.seriesColor = '#1565C0';
lineSetting.options.highMarkerColor = '#4CAF50';
lineSetting.options.lowMarkerColor = '#F44336';
lineSetting.options.markersColor = '#90CAF9';
// SparklineSetting — Column용
const colSetting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
colSetting.options.seriesColor = '#42A5F5';
colSetting.options.negativeColor = '#EF5350';
// SparklineSetting — WinLoss용
const wlSetting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
wlSetting.options.seriesColor = '#66BB6A';
wlSetting.options.negativeColor = '#EF5350';
const ori = GC.Spread.Sheets.Sparklines.DataOrientation.horizontal;
const dataRange = new GC.Spread.Sheets.Range(1, 3, 1, 12);
const wlRange = new GC.Spread.Sheets.Range(2, 3, 1, 12);
// Line
sheet.setSparkline(1, 1, dataRange, ori,
GC.Spread.Sheets.Sparklines.SparklineType.line, lineSetting);
// Column
sheet.setSparkline(1, 2, dataRange, ori,
GC.Spread.Sheets.Sparklines.SparklineType.column, colSetting);
// WinLoss
sheet.setSparkline(2, 3, wlRange, ori,
GC.Spread.Sheets.Sparklines.SparklineType.winloss, wlSetting);
sheet.setRowHeight(1, 60);
sheet.setRowHeight(2, 60);