[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
在线咨询 立即试用
(Showing Draft Content)

GC.Spread.Sheets.Sparklines.WinlossSparkline

Class: WinlossSparkline

Sheets.Sparklines.WinlossSparkline

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

• new WinlossSparkline()

表示盈亏迷你图的类。

Overrides

SparklineEx.constructor

Properties

typeName

• typeName: string

表示用于支持序列化的类型名称字符串。

Inherited from

SparklineEx.typeName

Methods

createFunction

▸ createFunction(): Function

创建一个自定义函数,用于为SparklineEx提供数据和设置。

Returns

Function

创建的自定义函数。

Inherited from

SparklineEx.createFunction


fromJSON

▸ fromJSON(settings): void

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

example

window.MySparklineEx = function(color) {
    GC.Spread.Sheets.Sparklines.SparklineEx.apply(this, arguments);
    this.typeName = 'MySparklineEx';
    this.color = color;
}
MySparklineEx.prototype = new GC.Spread.Sheets.Sparklines.SparklineEx();
MySparklineEx.prototype.createFunction = function () {
    var func = new GC.Spread.CalcEngine.Functions.Function('CIRCLE', 0, 0);
    func.evaluate = function (args) {
          return {};
    };
    return func;
 };
MySparklineEx.prototype.paint = function (context, value, x, y, width, height) {
     context.beginPath();
     context.arc(x + width / 2, y + height / 2, (Math.min(width, height) - 6) / 2, 0, Math.PI * 2);
     context.strokeStyle = this.color;
     context.stroke();
};
let sparkline = new MySparklineEx("green");
sparkline.fromJSON({ color: "red", typeName: "MySparklineEx" });
spread.addSparklineEx(sparkline);
sheet.setFormula(3,3,"=CIRCLE()");

Parameters

Name Type Description
settings Object 来自反序列化的sparklineEx数据。

Returns

void

Inherited from

SparklineEx.fromJSON


name

▸ name(): string

获取SparklineEx的名称。

example

window.MySparklineEx = function(color) {
    GC.Spread.Sheets.Sparklines.SparklineEx.apply(this, arguments);
    this.typeName = 'MySparklineEx';
    this.color = color;
}
MySparklineEx.prototype = new GC.Spread.Sheets.Sparklines.SparklineEx();
MySparklineEx.prototype.createFunction = function () {
    var func = new GC.Spread.CalcEngine.Functions.Function('CIRCLE', 0, 0);
    func.evaluate = function (args) {
          return {};
    };
    return func;
 };
MySparklineEx.prototype.paint = function (context, value, x, y, width, height) {
     context.beginPath();
     context.arc(x + width / 2, y + height / 2, (Math.min(width, height) - 6) / 2, 0, Math.PI * 2);
     context.strokeStyle = this.color;
     context.stroke();
};
let sparkline = new MySparklineEx('green');
console.log(sparkline.name());

Returns

string

SparklineEx的名称。

Inherited from

SparklineEx.name


paint

▸ paint(context, value, x, y, width, height): void

在画布上绘制SparklineEx。

example

window.MySparklineEx = function(color) {
    GC.Spread.Sheets.Sparklines.SparklineEx.apply(this, arguments);
    this.typeName = 'MySparklineEx';
    this.color = color;
}
MySparklineEx.prototype = new GC.Spread.Sheets.Sparklines.SparklineEx();
MySparklineEx.prototype.createFunction = function () {
    var func = new GC.Spread.CalcEngine.Functions.Function('CIRCLE', 0, 0);
    func.evaluate = function (args) {
          return {};
    };
    return func;
 };
MySparklineEx.prototype.paint = function (context, value, x, y, width, height) {
     context.beginPath();
     context.arc(x + width / 2, y + height / 2, (Math.min(width, height) - 6) / 2, 0, Math.PI * 2);
     context.strokeStyle = this.color;
     context.stroke();
};
let sparkline = new MySparklineEx('green');
spread.addSparklineEx(sparkline);
let sheet = spread.getActiveSheet();
sheet.setFormula(3,3,"=CIRCLE()");

Parameters

Name Type Description
context CanvasRenderingContext2D 画布的二维上下文。
value any 由自定义函数计算的值。
x number 相对于画布的x坐标。
y number 相对于画布的y坐标。
width number 单元格的宽度。
height number 单元格的高度。

Returns

void

Inherited from

SparklineEx.paint


toJSON

▸ toJSON(): Object

将对象状态保存为JSON字符串。

example

window.MySparklineEx = function(color) {
    GC.Spread.Sheets.Sparklines.SparklineEx.apply(this, arguments);
    this.typeName = 'MySparklineEx';
    this.color = color;
}
MySparklineEx.prototype = new GC.Spread.Sheets.Sparklines.SparklineEx();
MySparklineEx.prototype.createFunction = function () {
    var func = new GC.Spread.CalcEngine.Functions.Function('CIRCLE', 0, 0);
    func.evaluate = function (args) {
          return {};
    };
    return func;
 };
MySparklineEx.prototype.paint = function (context, value, x, y, width, height) {
     context.beginPath();
     context.arc(x + width / 2, y + height / 2, (Math.min(width, height) - 6) / 2, 0, Math.PI * 2);
     context.strokeStyle = this.color;
     context.stroke();
};
let sparkline = new MySparklineEx('green');
console.log(sparkline.toJSON()); // { color: "green", typeName: "MySparklineEx", _name: "CIRCLE" }

Returns

Object

sparklineEx数据。

Inherited from

SparklineEx.toJSON