[]
        
(Showing Draft Content)

GC.Spread.Sheets.Slicers.TimelineStyle

类: TimelineStyle

Sheets.Slicers.TimelineStyle

Table of contents

构造方法

方法

构造方法

constructor

new TimelineStyle()

代表时间线样式设置。

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8")],
    ["4", "NewYork", new Date("1972/7/3")],
    ["4", "NewYork", new Date("1964/3/2")]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.wholeSlicerStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));
style.headerStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo(undefined, 'green', '14pt Calibri'));
style.timeLevelStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('yellow'));

timeline.style(style);

方法

fromJSON

fromJSON(data): void

从指定的 JSON 字符串加载对象状态。

代码示例

//This example uses the fromJSON method.
const light1 = GC.Spread.Sheets.Slicers.TimelineStyles.light1();
//export
const jsonStr = JSON.stringify(light1.toJSON());
//import
const newTheme = new GC.Spread.Sheets.Slicers.TimelineStyle();
newTheme.fromJSON(JSON.parse(jsonStr));
newTheme.name('custom1');
alert(jsonStr);

参数

属性名 类型 说明
data Object 来自反序列化的时间线切片器主题数据。

返回值

void


headerStyle

headerStyle(value?): any

获取或设置切片器头部的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.wholeSlicerStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));
style.headerStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo(undefined, 'green', '14pt Calibri'));
style.timeLevelStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('yellow'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置任何值,则返回切片器头部的样式;否则,返回切片器样式


name

name(value?): any

获取或设置样式的名称

参数

属性名 类型
value? string

返回值

any

如果未设置任何值,则返回样式的名称;否则,返回切片器样式


periodLabel1Style

periodLabel1Style(value?): any

获取或设置时间线周期标签1的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.periodLabel1Style(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置值,则返回时间线周期标签1样式;否则,返回切片器样式


periodLabel2Style

periodLabel2Style(value?): any

获取或设置时间线周期标签2的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.periodLabel2Style(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置值,则返回时间线周期标签2样式;否则,返回切片器样式


selectedTimeBlockSpaceStyle

selectedTimeBlockSpaceStyle(value?): any

获取或设置所选时间线块空间的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.selectedTimeBlockSpaceStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置值,则返回时间线块空间的样式;否则,返回切片器样式


selectedTimeBlockStyle

selectedTimeBlockStyle(value?): any

获取或设置选定时间块的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.periodLabel2Style(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置值,则返回时间线块的样式;否则,返回切片器样式


selectionLabelStyle

selectionLabelStyle(value?): any

获取或设置时间线选择标签的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.selectionLabelStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置值,则返回时间线选择标签的样式;否则,返回切片器样式


timeLevelStyle

timeLevelStyle(value?): any

获取或设置时间级别的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.timeLevelStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置值,则返回时间级别的样式;否则,返回切片器样式

toJSON

toJSON(): Object

Saves the object state to a JSON string.

代码示例

//This example uses the toJSON method.
const light1 = GC.Spread.Sheets.Slicers.TimelineStyles.light1();
//export
const jsonStr = JSON.stringify(light1.toJSON());
//import
const newTheme = new GC.Spread.Sheets.Slicers.TimelineStyle();
newTheme.fromJSON(JSON.parse(jsonStr));
newTheme.name('custom1');
alert(jsonStr);

返回值

Object

The timeline slicer theme data.


unselectedTimeBlockStyle

unselectedTimeBlockStyle(value?): any

获取或设置未选时间块的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.unselectedTimeBlockStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置值,则返回未选时间块的样式;否则,返回切片器样式


wholeSlicerStyle

wholeSlicerStyle(value?): any

获取或设置整个切片器的样式

代码示例

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
var activeSheet = spread.getActiveSheet();
var datas = [
    ["1", "NewYork", new Date("1968/6/8"), "80", "180"],
    ["4", "NewYork", new Date("1972/7/3"), "72", "168"],
    ["4", "NewYork", new Date("1964/3/2"), "71", "179"],
    ["5", "Washington", new Date("1972/8/8"),"80", "171"],
    ["6", "Washington", new Date("1986/2/2"), "89", "161"],
    ["7", "Washington", new Date("2012/2/15"), "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
var dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var pivotTable = sheet.pivotTables.add('pivotTable1', table.name(), 11, 1);
var timeline = sheet.slicers.add('timeline1', 'pivotTable1', 'Birthday', GC.Spread.Sheets.Slicers.TimelineStyles.dark1(), GC.Spread.Sheets.Slicers.SlicerType.pivotTimeline);

var style = new GC.Spread.Sheets.Slicers.TimelineStyle()
style.wholeSlicerStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('red', 'blue', '12pt Calibri'));
style.headerStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo(undefined, 'green', '14pt Calibri'));
style.timeLevelStyle(new GC.Spread.Sheets.Slicers.SlicerStyleInfo('yellow'));

timeline.style(style);

参数

属性名 类型
value? SlicerStyleInfo

返回值

any

如果未设置任何值,则返回整个切片器的样式;否则,返回切片器样式