Commit 7aec60c2 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add sparklineInfo to asc_onSelectionChanged

parent 4124f8bf
...@@ -5694,6 +5694,14 @@ Woorksheet.prototype.updateSparklineCache = function(sheet, ranges) { ...@@ -5694,6 +5694,14 @@ Woorksheet.prototype.updateSparklineCache = function(sheet, ranges) {
this.aSparklineGroups[i].updateCache(sheet, ranges); this.aSparklineGroups[i].updateCache(sheet, ranges);
} }
}; };
Woorksheet.prototype.getSparklineGroup = function(c, r) {
for (var i = 0; i < this.aSparklineGroups.length; ++i) {
if (-1 !== this.aSparklineGroups[i].contains(c, r)) {
return this.aSparklineGroups[i];
}
}
return null;
};
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
/** /**
* @constructor * @constructor
......
...@@ -4553,128 +4553,141 @@ CellArea.prototype = { ...@@ -4553,128 +4553,141 @@ CellArea.prototype = {
} }
}; };
/** @constructor */ /** @constructor */
function sparklineGroup() { function sparklineGroup() {
// attributes // attributes
this.manualMax = undefined; this.manualMax = undefined;
this.manualMin = undefined; this.manualMin = undefined;
this.lineWeight = 0.75; this.lineWeight = 0.75;
this.type = Asc.ESparklineType.Line; this.type = Asc.ESparklineType.Line;
this.dateAxis = false; this.dateAxis = false;
this.displayEmptyCellsAs = Asc.EDispBlanksAs.Zero; this.displayEmptyCellsAs = Asc.EDispBlanksAs.Zero;
this.markers = false; this.markers = false;
this.high = false; this.high = false;
this.low = false; this.low = false;
this.first = false; this.first = false;
this.last = false; this.last = false;
this.negative = false; this.negative = false;
this.displayXAxis = false; this.displayXAxis = false;
this.displayHidden = false; this.displayHidden = false;
this.minAxisType = Asc.SparklineAxisMinMax.Individual; this.minAxisType = Asc.SparklineAxisMinMax.Individual;
this.maxAxisType = Asc.SparklineAxisMinMax.Individual; this.maxAxisType = Asc.SparklineAxisMinMax.Individual;
this.rightToLeft = false; this.rightToLeft = false;
// elements // elements
this.colorSeries = null; this.colorSeries = null;
this.colorNegative = null; this.colorNegative = null;
this.colorAxis = null; this.colorAxis = null;
this.colorMarkers = null; this.colorMarkers = null;
this.colorFirst = null; this.colorFirst = null;
this.colorLast = null; this.colorLast = null;
this.colorHigh = null; this.colorHigh = null;
this.colorLow = null; this.colorLow = null;
this.f = null; this.f = null;
this.arrSparklines = []; this.arrSparklines = [];
this.arrCachedSparklines = []; this.arrCachedSparklines = [];
}
sparklineGroup.prototype.clone = function() {
var res = new sparklineGroup();
res.manualMax = this.manualMax;
res.manualMin = this.manualMin;
res.lineWeight = this.lineWeight;
res.type = this.type;
res.dateAxis = this.dateAxis;
res.displayEmptyCellsAs = this.displayEmptyCellsAs;
res.markers = this.markers;
res.high = this.high;
res.low = this.low;
res.first = this.first;
res.last = this.last;
res.negative = this.negative;
res.displayXAxis = this.displayXAxis;
res.displayHidden = this.displayHidden;
res.minAxisType = this.minAxisType;
res.maxAxisType = this.maxAxisType;
res.rightToLeft = this.rightToLeft;
res.colorSeries = this.colorSeries ? this.colorSeries.clone() : null;
res.colorNegative = this.colorNegative ? this.colorNegative.clone() : null;
res.colorAxis = this.colorAxis ? this.colorAxis : null;
res.colorMarkers = this.colorMarkers ? this.colorMarkers : null;
res.colorFirst = this.colorFirst ? this.colorFirst : null;
res.colorLast = this.colorLast ? this.colorLast : null;
res.colorHigh = this.colorHigh ? this.colorHigh : null;
res.colorLow = this.colorLow ? this.colorLow : null;
res.f = this.f;
for (var i = 0; i < this.arrSparklines.length; ++i) {
res.arrSparklines.push(this.arrSparklines[i].clone());
}
return res;
};
sparklineGroup.prototype.addView = function(oSparklineView, index) {
this.arrCachedSparklines[index] = oSparklineView;
};
sparklineGroup.prototype.draw = function(oDrawingContext) {
var graphics = new AscCommon.CGraphics();
graphics.init(oDrawingContext.ctx, oDrawingContext.getWidth(0), oDrawingContext.getHeight(0),
oDrawingContext.getWidth(3), oDrawingContext.getHeight(3));
graphics.m_oFontManager = AscCommon.g_fontManager;
for (var i = 0; i < this.arrCachedSparklines.length; ++i) {
this.arrCachedSparklines[i].draw(graphics);
} }
};
sparklineGroup.prototype.cleanCache = function() { sparklineGroup.prototype.clone = function () {
// ToDo clean only colors (for color scheme) var res = new sparklineGroup();
this.arrCachedSparklines = []; res.manualMax = this.manualMax;
}; res.manualMin = this.manualMin;
sparklineGroup.prototype.updateCache = function(sheet, ranges) { res.lineWeight = this.lineWeight;
var sparklineRange; res.type = this.type;
for (var i = 0; i < this.arrSparklines.length; ++i) { res.dateAxis = this.dateAxis;
sparklineRange = this.arrSparklines[i]._f; res.displayEmptyCellsAs = this.displayEmptyCellsAs;
for (var j = 0; j < ranges.length; ++j) { res.markers = this.markers;
if (sparklineRange.isIntersect(ranges[j], sheet)) { res.high = this.high;
this.arrCachedSparklines[i] = null; res.low = this.low;
break; res.first = this.first;
res.last = this.last;
res.negative = this.negative;
res.displayXAxis = this.displayXAxis;
res.displayHidden = this.displayHidden;
res.minAxisType = this.minAxisType;
res.maxAxisType = this.maxAxisType;
res.rightToLeft = this.rightToLeft;
res.colorSeries = this.colorSeries ? this.colorSeries.clone() : null;
res.colorNegative = this.colorNegative ? this.colorNegative.clone() : null;
res.colorAxis = this.colorAxis ? this.colorAxis : null;
res.colorMarkers = this.colorMarkers ? this.colorMarkers : null;
res.colorFirst = this.colorFirst ? this.colorFirst : null;
res.colorLast = this.colorLast ? this.colorLast : null;
res.colorHigh = this.colorHigh ? this.colorHigh : null;
res.colorLow = this.colorLow ? this.colorLow : null;
res.f = this.f;
for (var i = 0; i < this.arrSparklines.length; ++i) {
res.arrSparklines.push(this.arrSparklines[i].clone());
}
return res;
};
sparklineGroup.prototype.addView = function (oSparklineView, index) {
this.arrCachedSparklines[index] = oSparklineView;
};
sparklineGroup.prototype.draw = function (oDrawingContext) {
var graphics = new AscCommon.CGraphics();
graphics.init(oDrawingContext.ctx, oDrawingContext.getWidth(0), oDrawingContext.getHeight(0),
oDrawingContext.getWidth(3), oDrawingContext.getHeight(3));
graphics.m_oFontManager = AscCommon.g_fontManager;
for (var i = 0; i < this.arrCachedSparklines.length; ++i) {
this.arrCachedSparklines[i].draw(graphics);
}
};
sparklineGroup.prototype.cleanCache = function () {
// ToDo clean only colors (for color scheme)
this.arrCachedSparklines = [];
};
sparklineGroup.prototype.updateCache = function (sheet, ranges) {
var sparklineRange;
for (var i = 0; i < this.arrSparklines.length; ++i) {
sparklineRange = this.arrSparklines[i]._f;
for (var j = 0; j < ranges.length; ++j) {
if (sparklineRange.isIntersect(ranges[j], sheet)) {
this.arrCachedSparklines[i] = null;
break;
}
}
}
};
sparklineGroup.prototype.contains = function (c, r) {
for (var j = 0; j < this.arrSparklines.length; ++j) {
if (oSparklineGroup.arrSparklines[j].contains(c, r)) {
return j;
} }
} }
return -1;
};
/** @constructor */
function sparkline() {
this.sqref = null;
this.f = null;
this._f = null;
} }
};
/** @constructor */ sparkline.prototype.clone = function () {
function sparkline() { var res = new sparkline();
this.sqref = null;
this.f = null; res.sqref = this.sqref ? this.sqref.clone() : null;
this._f = null; res.f = this.f;
} res._f = this._f ? this._f.clone() : null;
sparkline.prototype.clone = function() {
var res = new sparkline(); return res;
};
res.sqref = this.sqref ? this.sqref.clone() : null; sparkline.prototype.setSqref = function (sqref) {
res.f = this.f; this.sqref = AscCommonExcel.g_oRangeCache.getAscRange(sqref);
res._f = this._f ? this._f.clone() : null; };
sparkline.prototype.setF = function (f) {
return res; this.f = f;
}; this._f = AscCommonExcel.g_oRangeCache.getRange3D(this.f);
sparkline.prototype.setSqref = function(sqref) { };
this.sqref = AscCommonExcel.g_oRangeCache.getAscRange(sqref); sparkline.prototype.checkInRange = function (range) {
}; return this.sqref ? range.isIntersect(this.sqref) : false;
sparkline.prototype.setF = function(f) { };
this.f = f; sparkline.prototype.contains = function (c, r) {
this._f = AscCommonExcel.g_oRangeCache.getRange3D(this.f); return this.sqref ? range.contains(c, r) : false;
}; };
sparkline.prototype.checkInRange = function(range) {
return this.sqref ? range.isIntersect(this.sqref) : false;
};
// For Auto Filters // For Auto Filters
/** @constructor */ /** @constructor */
......
...@@ -7108,6 +7108,8 @@ ...@@ -7108,6 +7108,8 @@
} }
} }
cell_info.sparklineInfo = this.model.getSparklineGroup(c1, r1);
return cell_info; return cell_info;
}; };
......
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