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

add draw sparklines to view

parent b36eab66
...@@ -3075,50 +3075,51 @@ function Woorksheet(wb, _index, sId){ ...@@ -3075,50 +3075,51 @@ function Woorksheet(wb, _index, sId){
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 (null != to) {
if(to.r2 >= oThis.nRowsCount) if (to.r2 >= oThis.nRowsCount)
oThis.nRowsCount = to.r2 + 1; oThis.nRowsCount = to.r2 + 1;
if(to.c2 >= oThis.nColsCount) if (to.c2 >= oThis.nColsCount)
oThis.nColsCount = to.c2 + 1; oThis.nColsCount = to.c2 + 1;
} }
}); });
this.hyperlinkManager = new RangeDataManager(function(data, from, to, oChangeParam){ this.hyperlinkManager = new RangeDataManager(function(data, from, to, oChangeParam) {
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;
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) if (null != to)
data.Ref = oThis.getRange3(to.r1, to.c1, to.r2, to.c2); data.Ref = oThis.getRange3(to.r1, to.c1, to.r2, to.c2); else if (oChangeParam && oChangeParam.removeStyle &&
else if (oChangeParam && oChangeParam.removeStyle && null != data.Ref) null != data.Ref)
data.Ref.cleanFormat(); data.Ref.cleanFormat();
//расширяем границы //расширяем границы
if(null != to){ if (null != to) {
if(to.r2 >= oThis.nRowsCount) if (to.r2 >= oThis.nRowsCount)
oThis.nRowsCount = to.r2 + 1; oThis.nRowsCount = to.r2 + 1;
if(to.c2 >= oThis.nColsCount) if (to.c2 >= oThis.nColsCount)
oThis.nColsCount = to.c2 + 1; oThis.nColsCount = to.c2 + 1;
} }
}); });
...@@ -3130,6 +3131,7 @@ function Woorksheet(wb, _index, sId){ ...@@ -3130,6 +3131,7 @@ function Woorksheet(wb, _index, sId){
this.aFormulaExt = 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.sparklineGroups = new sparklineGroups();
this.oDrawingOjectsManager = new DrawingObjectsManager(this); this.oDrawingOjectsManager = new DrawingObjectsManager(this);
this.contentChanges = new CContentChanges(); this.contentChanges = new CContentChanges();
......
...@@ -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