Commit e9368818 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add draw sparklines to view

parent b36eab66
...@@ -3074,68 +3074,70 @@ function Woorksheet(wb, _index, sId){ ...@@ -3074,68 +3074,70 @@ function Woorksheet(wb, _index, sId){
this.oAllCol = null; this.oAllCol = null;
this.aComments = []; this.aComments = [];
this.aCommentsCoords = []; this.aCommentsCoords = [];
var oThis = this; var oThis = this;
this.mergeManager = new RangeDataManager(function(data, from, to){ this.mergeManager = new RangeDataManager(function(data, from, to) {
if(History.Is_On() && (null != from || null != to)) if (History.Is_On() && (null != from || null != to)) {
{ if (null != from) {
if(null != from) from = from.clone();
from = from.clone(); }
if(null != to) if (null != to)
to = to.clone(); to = to.clone();
var oHistoryRange = from; var oHistoryRange = from;
if(null == oHistoryRange) if (null == oHistoryRange)
oHistoryRange = to; oHistoryRange = to;
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeMerge, oThis.getId(), oHistoryRange, new UndoRedoData_FromTo(new UndoRedoData_BBox(from), new UndoRedoData_BBox(to))); History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeMerge, oThis.getId(), oHistoryRange,
} new UndoRedoData_FromTo(new UndoRedoData_BBox(from), new UndoRedoData_BBox(to)));
//расширяем границы }
if(null != to){ //расширяем границы
if(to.r2 >= oThis.nRowsCount) if (null != to) {
oThis.nRowsCount = to.r2 + 1; if (to.r2 >= oThis.nRowsCount)
if(to.c2 >= oThis.nColsCount) oThis.nRowsCount = to.r2 + 1;
oThis.nColsCount = to.c2 + 1; if (to.c2 >= oThis.nColsCount)
} oThis.nColsCount = to.c2 + 1;
}); }
this.hyperlinkManager = new RangeDataManager(function(data, from, to, oChangeParam){ });
if(History.Is_On() && (null != from || null != to)) this.hyperlinkManager = new RangeDataManager(function(data, from, to, oChangeParam) {
{ if (History.Is_On() && (null != from || null != to)) {
if(null != from) if (null != from)
from = from.clone(); from = from.clone();
if(null != to) if (null != to)
to = to.clone(); to = to.clone();
var oHistoryRange = from; var oHistoryRange = from;
if(null == oHistoryRange) if (null == oHistoryRange)
oHistoryRange = to; oHistoryRange = to;
var oHistoryData = null; var oHistoryData = null;
if(null == from || null == to) if (null == from || null == to)
oHistoryData = data.clone(); oHistoryData = data.clone();
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeHyperlink, oThis.getId(), oHistoryRange, new UndoRedoData_FromToHyperlink(from, to, oHistoryData)); History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeHyperlink, oThis.getId(), oHistoryRange,
} new UndoRedoData_FromToHyperlink(from, to, oHistoryData));
if (null != to) }
data.Ref = oThis.getRange3(to.r1, to.c1, to.r2, to.c2); if (null != to)
else if (oChangeParam && oChangeParam.removeStyle && null != data.Ref) data.Ref = oThis.getRange3(to.r1, to.c1, to.r2, to.c2); else if (oChangeParam && oChangeParam.removeStyle &&
data.Ref.cleanFormat(); null != data.Ref)
//расширяем границы data.Ref.cleanFormat();
if(null != to){ //расширяем границы
if(to.r2 >= oThis.nRowsCount) if (null != to) {
oThis.nRowsCount = to.r2 + 1; if (to.r2 >= oThis.nRowsCount)
if(to.c2 >= oThis.nColsCount) oThis.nRowsCount = to.r2 + 1;
oThis.nColsCount = to.c2 + 1; if (to.c2 >= oThis.nColsCount)
} oThis.nColsCount = to.c2 + 1;
}); }
this.hyperlinkManager.setDependenceManager(this.mergeManager); });
this.DrawingDocument = new CDrawingDocument(); this.hyperlinkManager.setDependenceManager(this.mergeManager);
this.sheetViews = []; this.DrawingDocument = new CDrawingDocument();
this.aConditionalFormatting = []; this.sheetViews = [];
this.sheetPr = null; this.aConditionalFormatting = [];
this.aFormulaExt = null; this.sheetPr = null;
this.aFormulaExt = null;
this.autoFilters = asc.AutoFilters !== undefined ? new asc.AutoFilters(this) : null;
this.autoFilters = asc.AutoFilters !== undefined ? new asc.AutoFilters(this) : null;
this.oDrawingOjectsManager = new DrawingObjectsManager(this); this.sparklineGroups = new sparklineGroups();
this.contentChanges = new CContentChanges();
this.oDrawingOjectsManager = new DrawingObjectsManager(this);
/*handlers*/ this.contentChanges = new CContentChanges();
this.handlers = null;
/*handlers*/
this.handlers = null;
} }
Woorksheet.prototype.addContentChanges = function(changes) Woorksheet.prototype.addContentChanges = function(changes)
......
...@@ -4406,9 +4406,11 @@ CellArea.prototype = { ...@@ -4406,9 +4406,11 @@ CellArea.prototype = {
} }
}; };
/** @constructor */
function sparklineGroups() { function sparklineGroups() {
this.arrSparklineGroup = []; this.arrSparklineGroup = [];
} }
/** @constructor */
function sparklineGroup() { function sparklineGroup() {
// attributes // attributes
this.manualMax = undefined; this.manualMax = undefined;
...@@ -4442,17 +4444,14 @@ function sparklineGroup() { ...@@ -4442,17 +4444,14 @@ function sparklineGroup() {
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();
...@@ -4467,6 +4466,7 @@ sparklineGroup.prototype.updateCache = function(wsView) ...@@ -4467,6 +4466,7 @@ sparklineGroup.prototype.updateCache = function(wsView)
{ {
wsView.objectRender.createSparklineViews(this); wsView.objectRender.createSparklineViews(this);
}; };
/** @constructor */
function sparkline() { function sparkline() {
this.sqref = '??'; // ToDo добавить значение по умолчанию this.sqref = '??'; // ToDo добавить значение по умолчанию
this.f = '??'; this.f = '??';
......
...@@ -2434,7 +2434,7 @@ ...@@ -2434,7 +2434,7 @@
/** Рисует спарклайны */ /** Рисует спарклайны */
WorksheetView.prototype._drawSparklines = function(drawingCtx, range, offsetX, offsetY) { WorksheetView.prototype._drawSparklines = function(drawingCtx, range, offsetX, offsetY) {
this.objectRender.drawSparkLineGroup(this.model.sparklineGroups, drawingCtx);
}; };
/** Рисует ячейки таблицы */ /** Рисует ячейки таблицы */
...@@ -2455,6 +2455,7 @@ ...@@ -2455,6 +2455,7 @@
this._drawCellText(drawingCtx, mc.c1, mc.r1, range.c1, range.c2, offsetX, offsetY, true); this._drawCellText(drawingCtx, mc.c1, mc.r1, range.c1, range.c2, offsetX, offsetY, true);
} }
} }
this._drawSparklines(drawingCtx, range, offsetX, offsetY);
return mergedCells; return mergedCells;
}; };
......
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