Commit 338fbd5f authored by Sergey Luzyanin's avatar Sergey Luzyanin

sparkline previews

parent 868513b4
......@@ -4963,6 +4963,17 @@ CellArea.prototype = {
};
sparklineGroup.prototype.asc_getThumbBySparklineGroup = function(oSparklineGroup){
if(!this.canvas) {
this.canvas = document.createElement('canvas');
if(AscCommon.AscBrowser.isRetina) {
this.canvas.width = 100;
this.canvas.height = 100;
}
else{
this.canvas.width = 50;
this.canvas.height = 50;
}
}
// if(!this.sparklineView){
this.sparklineView = new AscFormat.CSparklineView();
var oSparkline = new sparkline();
......@@ -4978,23 +4989,29 @@ CellArea.prototype = {
this.sparklineView.chartSpace.extX = 100;
this.sparklineView.chartSpace.extY = 100;
this.sparklineView.chartSpace.x = 0;
this.sparklineView.chartSpace.x = 0;
this.sparklineView.chartSpace.y = 0;
if(oSparklineGroup.type === Asc.c_oAscSparklineType.Stacked){
AscFormat.ExecuteNoHistory(function(){
var oPlotArea = this.sparklineView.chartSpace.chart.plotArea;
if(!oPlotArea.layout){
oPlotArea.setLayout(new AscFormat.CLayout());
}
var fPos = 0.32;
oPlotArea.layout.setWMode(AscFormat.LAYOUT_MODE_FACTOR);
oPlotArea.layout.setW(1.0);
oPlotArea.layout.setHMode(AscFormat.LAYOUT_MODE_FACTOR);
oPlotArea.layout.setH(1 - 2*fPos);
oPlotArea.layout.setYMode(AscFormat.LAYOUT_MODE_EDGE);
oPlotArea.layout.setY(fPos);
}, this, []);
}
AscFormat.ExecuteNoHistory(function () {
AscFormat.CheckSpPrXfrm(this.sparklineView.chartSpace);
}, this, []);
this.sparklineView.chartSpace.recalculate();
this.sparklineView.chartSpace.brush = AscFormat.CreateSolidFillRGBA(0xFF, 0xFF, 0xFF, 0xFF);
// }
if(!this.canvas) {
this.canvas = document.createElement('canvas');
if(AscCommon.AscBrowser.isRetina) {
this.canvas.width = 100;
this.canvas.height = 100;
}
else{
this.canvas.width = 50;
this.canvas.height = 50;
}
}
var oGraphics = new AscCommon.CGraphics();
oGraphics.init(this.canvas.getContext('2d'), this.canvas.width, this.canvas.height, this.sparklineView.chartSpace.extX, this.sparklineView.chartSpace.extY);
oGraphics.m_oFontManager = AscCommon.g_fontManager;
......
......@@ -619,7 +619,7 @@ function CreateUniFillFromExcelColor(oExcelColor)
return oUnifill;
}
CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGroup, worksheetView)
CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGroup, worksheetView, bNoLine)
{
AscFormat.ExecuteNoHistory(function(){
this.ws = worksheetView;
......@@ -813,7 +813,7 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
{
if(oSeries.dPt[t].spPr)
{
if(oExcelColor){
if(oExcelColor && !(bNoLine === true)){
oSeries.dPt[t].spPr.Fill = CreateUniFillFromExcelColor(oExcelColor);
oSeries.dPt[t].spPr.ln = new AscFormat.CLn();
oSeries.dPt[t].spPr.ln.Fill = oSeries.dPt[t].spPr.Fill.createDuplicate();
......@@ -831,7 +831,7 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
var oDPt = new AscFormat.CDPt();
oDPt.idx = nIdx;
oDPt.spPr = new AscFormat.CSpPr();
if(oExcelColor) {
if(oExcelColor && !(bNoLine === true)) {
oDPt.spPr.Fill = CreateUniFillFromExcelColor(oExcelColor);
oDPt.spPr.ln = new AscFormat.CLn();
oDPt.spPr.ln.Fill = oDPt.spPr.Fill.createDuplicate();
......@@ -987,10 +987,13 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
}
else
{
oSerie.spPr.setFill(oUnifill);
oSerie.spPr.ln = new AscFormat.CLn();
oSerie.spPr.ln.Fill = oSerie.spPr.Fill.createDuplicate();
oSerie.spPr.ln.w = dLineWidthSpaces;
if(!(bNoLine === true))
{
oSerie.spPr.setFill(oUnifill);
oSerie.spPr.ln = new AscFormat.CLn();
oSerie.spPr.ln.Fill = oSerie.spPr.Fill.createDuplicate();
oSerie.spPr.ln.w = dLineWidthSpaces;
}
}
}
......
......@@ -8233,6 +8233,7 @@ FmtScheme.prototype =
{
var oCopy = new FmtScheme();
oCopy.name = this.name;
var i;
for(i = 0; i < this.fillStyleLst.length; ++i)
{
oCopy.fillStyleLst[i] = this.fillStyleLst[i].createDuplicate();
......
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