Commit 0d137805 authored by Sergey Luzyanin's avatar Sergey Luzyanin

Отрисовка спаклайнов

parent 25b8e107
......@@ -4463,9 +4463,34 @@ function sparklineGroup() {
this.colorHigh = null;
this.colorLow = null;
this.f = '??';
this.arrSparklines = [];
this.arrCachedSparklines = [];
}
sparklineGroup.prototype.clearCached = function()
{
this.arrCachedSparklines.length = 0;
};
sparklineGroup.prototype.addView = function(oSparklineView)
{
this.arrCachedSparklines.push(oSparklineView);
};
sparklineGroup.prototype.draw = function(oDrawingContext)
{
var graphics = new CGraphics();
graphics.init(oDrawingContext.ctx, oDrawingContext.getWidth(0), oDrawingContext.getHeight(0), oDrawingContext.getWidth(3), oDrawingContext.getHeight(3));
graphics.m_oFontManager = g_fontManager;
for(var i = 0; i < this.arrCachedSparklines.length; ++i)
{
this.arrCachedSparklines[i].draw(graphics);
}
};
sparklineGroup.prototype.updateCache = function(wsView)
{
wsView.objectRender.createSparklineViews(this);
};
function sparkline() {
this.sqref = '??'; // ToDo добавить значение по умолчанию
this.f = '??';
......
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"use strict";
/* DrawingObjects.js
......@@ -329,6 +329,77 @@ prot["asc_setFormatCode"] = prot.asc_setFormatCode;
function CSparklineView()
{
this.col = null;
this.row = null;
this.ws = null;
this.extX = null;
this.extY = null;
this.chartSpace = null;
}
CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGroup, worksheetView)
{
this.ws = worksheetView;
var settings = new asc_ChartSettings();
switch(oSparklineGroup.type)
{
case Asc.ESparklineType.Column:
{
settings.type = c_oAscChartTypeSettings.barNormal;
break;
}
case Asc.ESparklineType.Stacked:
{
settings.type = c_oAscChartTypeSettings.barStacked;
break;
}
default:
{
settings.type = c_oAscChartTypeSettings.lineNormal;
break;
}
}
var ser = new asc_CChartSeria();
ser.Val.Formula = oSparkline.f;
var chartSeries = {series: [ser], parsedHeaders: {bLeft: false, bTop: false}};
var chart_space = DrawingObjectsController.prototype._getChartSpace(chartSeries, settings, true);
chart_space.setWorksheet(worksheetView.model);
this.chartSpace = chart_space;
var oBBox = worksheetView.model.getCell(oSparkline.sqref);
this.col = oBBox.c1;
this.row = oBBox.r1;
this.extX = worksheetView.getColumnWidth(oBBox.c1, 3);
this.extY = worksheetView.getRowHeight(oBBox.r1, 3);
CheckSpPrXfrm(this.chartSpace);
this.chartSpace.spPr.xfrm.setOffX(0);
this.chartSpace.spPr.xfrm.setOffY(0);
this.chartSpace.spPr.xfrm.setExtX(this.extX);
this.chartSpace.spPr.xfrm.setExtY(this.extY);
this.chartSpace.recalculate();
};
CSparklineView.prototype.draw = function(graphics)
{
var x = this.ws.getCellLeft(this.col, 3);
var y = this.ws.getCellTop(this.row, 3);
var extX = this.ws.getColumnWidth(this.col, 3);
var extY = this.ws.getRowHeight(this.row, 3);
if(Math.abs(this.extX - extX) > 0.01 || Math.abs(this.extY - extY) > 0.01)
{
this.chartSpace.spPr.xfrm.setExtX(extX);
this.chartSpace.spPr.xfrm.setExtY(extY);
this.extX = extX;
this.extY = extY;
this.chartSpace.recalculate();
}
graphics.m_oCoordTransform.tx = x;
graphics.m_oCoordTransform.ty = y;
};
//-----------------------------------------------------------------------------------
// Manager
//-----------------------------------------------------------------------------------
......@@ -1937,6 +2008,23 @@ function DrawingObjects() {
}
};
_this.createSparklineViews = function(oSparkLineGroup)
{
oSparkLineGroup.clearCached();
for(var i = 0; i < oSparkLineGroup.arrSparklines.length; ++i)
{
var oSparklineView = new CSparklineView();
oSparklineView.initFromSparkline(oSparkLineGroup.arrSparklines[i], oSparkLineGroup, worksheet);
oSparkLineGroup.addView(oSparklineView);
}
};
_this.drawSparkLineGroup = function(oSparkLineGroup, oDrawingContext)
{
},
_this.rebuildChartGraphicObjects = function(data)
{
if(!worksheet)
......
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