Commit 18b2fc2d authored by Sergey Luzyanin's avatar Sergey Luzyanin

Merge branch 'feature/sparklines' of https://github.com/ONLYOFFICE/sdkjs into feature/sparklines

parents 42418b3f 89927348
...@@ -4466,29 +4466,29 @@ function sparklineGroup() { ...@@ -4466,29 +4466,29 @@ function sparklineGroup() {
this.colorLow = null; this.colorLow = null;
this.f = '??'; this.f = '??';
this.arrSparklines = []; this.arrSparklines = [];
this.arrCachedSparklines = []; this.arrCachedSparklines = [];
} }
sparklineGroup.prototype.clearCached = function() sparklineGroup.prototype.clearCached = function() {
{ this.arrCachedSparklines.length = 0;
this.arrCachedSparklines.length = 0;
}; };
sparklineGroup.prototype.addView = function(oSparklineView) sparklineGroup.prototype.addView = function(oSparklineView) {
{ this.arrCachedSparklines.push(oSparklineView);
this.arrCachedSparklines.push(oSparklineView);
}; };
sparklineGroup.prototype.draw = function(oDrawingContext) sparklineGroup.prototype.draw = function(oDrawingContext) {
{ var graphics = new CGraphics();
var graphics = new CGraphics(); graphics.init(oDrawingContext.ctx, oDrawingContext.getWidth(0), oDrawingContext.getHeight(0),
graphics.init(oDrawingContext.ctx, oDrawingContext.getWidth(0), oDrawingContext.getHeight(0), oDrawingContext.getWidth(3), oDrawingContext.getHeight(3)); oDrawingContext.getWidth(3), oDrawingContext.getHeight(3));
graphics.m_oFontManager = g_fontManager; graphics.m_oFontManager = g_fontManager;
for(var i = 0; i < this.arrCachedSparklines.length; ++i) for (var i = 0; i < this.arrCachedSparklines.length; ++i) {
{ this.arrCachedSparklines[i].draw(graphics);
this.arrCachedSparklines[i].draw(graphics); }
}
}; };
sparklineGroup.prototype.updateCache = function(wsView) sparklineGroup.prototype.updateCache = function(range) {
{ for (var i = 0; i < this.arrSparklines.length; ++i) {
wsView.objectRender.createSparklineViews(this); if (range.intersectionSimple(this.arrSparklines[i].f)) {
this.arrCachedSparklines[i] = null;
}
}
}; };
/** @constructor */ /** @constructor */
function sparkline() { function sparkline() {
......
...@@ -2458,7 +2458,7 @@ ...@@ -2458,7 +2458,7 @@
/** Рисует спарклайны */ /** Рисует спарклайны */
WorksheetView.prototype._drawSparklines = function(drawingCtx, range, offsetX, offsetY) { WorksheetView.prototype._drawSparklines = function(drawingCtx, range, offsetX, offsetY) {
this.objectRender.drawSparkLineGroup(this.model.sparklineGroups, drawingCtx); this.objectRender.drawSparkLineGroups(drawingCtx, this.model.sparklineGroups, range);
}; };
/** Рисует ячейки таблицы */ /** Рисует ячейки таблицы */
......
...@@ -2024,10 +2024,15 @@ function DrawingObjects() { ...@@ -2024,10 +2024,15 @@ function DrawingObjects() {
} }
}; };
_this.drawSparkLineGroup = function(oSparkLineGroup, oDrawingContext) _this.drawSparkLineGroups = function(oDrawingContext, oSparkLineGroups, range)
{ {
for(var i = 0; i < oSparkLineGroups.arrSparklineGroup.length; ++i) {
}, var oSparklineGroup = oSparkLineGroups.arrSparklineGroup[i];
oSparklineGroup.updateCache(range);
for(var j = 0; j < oSparklineGroup.arrSparklines.length; ++j) {
}
}
};
_this.rebuildChartGraphicObjects = function(data) _this.rebuildChartGraphicObjects = function(data)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment