Commit e81fd7d4 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53571 954022d7-b5bf-4e40-9824-e11837661b57
parent 5f133a65
......@@ -2160,7 +2160,7 @@ function CreateAreaChart(asc_series, type)
pt.setVal(asc_series[i].Val.NumCache[j].val);
num_cache.addPt(pt);
}
bar_chart.addSer(series);
area_chart.addSer(series);
}
area_chart.setDLbls(new CDLbls());
area_chart.addAxId(plot_area.catAx);
......
......@@ -248,7 +248,7 @@ function NullState(drawingObjectsController)
{
var cur_drawing_base = arr_drawing_objects[i];
var cur_drawing = cur_drawing_base;
if(cur_drawing.isShape() || cur_drawing.isImage())
if(cur_drawing.isShape() || cur_drawing.isImage() || cur_drawing.isChart())
{
result = handleShapeImage(cur_drawing, this.drawingObjectsController, e, x, y);
if(result)
......@@ -260,12 +260,12 @@ function NullState(drawingObjectsController)
if(result)
return result;
}
else if(cur_drawing.isChart())
/*else if(cur_drawing.isChart())
{
result = handleChart(cur_drawing, this.drawingObjectsController, e, x, y);
if(result)
return result;
}
}*/
else if(cur_drawing.isTable && cur_drawing.isTable())
{
result = handleTable(cur_drawing, this.drawingObjectsController, e, x, y);
......
......@@ -2,6 +2,26 @@ CChartSpace.prototype.addToDrawingObjects = CShape.prototype.addToDrawingObject
CChartSpace.prototype.setDrawingObjects = CShape.prototype.setDrawingObjects;
CChartSpace.prototype.setDrawingBase = CShape.prototype.setDrawingBase;
CChartSpace.prototype.deleteDrawingBase = CShape.prototype.deleteDrawingBase;
CChartSpace.prototype.recalculateTransform = CShape.prototype.recalculateTransform;
CChartSpace.prototype.recalculateBounds = CShape.prototype.recalculateBounds;
CChartSpace.prototype.deselect = CShape.prototype.deselect;
CChartSpace.prototype.hitToHandles = CShape.prototype.hitToHandles;
CChartSpace.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
CChartSpace.prototype.getRotateAngle = CShape.prototype.getRotateAngle;
CChartSpace.prototype.getInvertTransform = CShape.prototype.getInvertTransform;
CChartSpace.prototype.hit = CShape.prototype.hit;
CChartSpace.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
CChartSpace.prototype.hitInPath = CShape.prototype.hitInPath;
CChartSpace.prototype.hitInTextRect = CShape.prototype.hitInTextRect;
CChartSpace.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection;
CChartSpace.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum;
CChartSpace.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients;
CChartSpace.prototype.check_bounds = CShape.prototype.check_bounds;
CChartSpace.prototype.normalize = CShape.prototype.normalize;
CChartSpace.prototype.getFullFlipH = CShape.prototype.getFullFlipH;
CChartSpace.prototype.getFullFlipV = CShape.prototype.getFullFlipV;
CChartSpace.prototype.setRecalculateInfo = function()
{
this.recalcInfo =
......@@ -9,7 +29,8 @@ CChartSpace.prototype.setRecalculateInfo = function()
recalculateTransform: true,
recalculateBounds: true,
recalculateChart: true,
recalculateStyle: true
recalculateBaseColors: true,
recalculateSeriesColors: true
};
this.baseColors = [];
this.bounds = {l: 0, t: 0, r: 0, b:0, w: 0, h:0};
......@@ -26,6 +47,14 @@ CChartSpace.prototype.recalcChart = function()
{
this.recalcInfo.recalculateChart = true;
};
CChartSpace.prototype.recalcBaseColors = function()
{
this.recalcInfo.recalculateBaseColors = true;
};
CChartSpace.prototype.recalcSeriesColors = function()
{
this.recalcInfo.recalculateSeriesColors = true;
};
CChartSpace.prototype.addToRecalculate = CShape.prototype.addToRecalculate;
CChartSpace.prototype.handleUpdatePosition = function()
......@@ -50,7 +79,7 @@ CChartSpace.prototype.handleUpdateChart = function()
};
CChartSpace.prototype.convertPixToMM = CShape.prototype.convertPixToMM;
CChartSpace.prototype.getCanvasContext = CShape.prototype.getCanvasContext;
CChartSpace.prototype.getHierarchy = CShape.prototype.getParentObjects;
CChartSpace.prototype.getHierarchy = CShape.prototype.getHierarchy;
CChartSpace.prototype.getParentObjects = CShape.prototype.getParentObjects;
CChartSpace.prototype.recalculateTransform = CShape.prototype.recalculateTransform;
CChartSpace.prototype.recalculateChart = function()
......@@ -100,6 +129,16 @@ CChartSpace.prototype.recalculate = function()
this.recalculateBounds();
this.recalcInfo.recalculateBounds = false;
}
if(this.recalcInfo.recalculateBaseColors)
{
this.recalculateBaseColors();
this.recalcInfo.recalculateBaseColors = false;
}
if(this.recalcInfo.recalculateSeriesColors)
{
this.recalculateSeriesColors();
this.recalcInfo.recalculateBaseColors = false;
}
};
CChartSpace.prototype.deselect = CShape.prototype.deselect;
CChartSpace.prototype.hitInWorkArea = function()
......@@ -161,7 +200,31 @@ function CreateColorMapByIndex(index)
return ret;
}
CChartSpace.prototype.recalculateStyle = function()
function CreateUniFillSolidFillWidthTintOrShade(unifill, effectVal)
{
var ret = unifill.createDuplicate();
var unicolor = ret.fill.color;
if(effectVal !== 0)
{
unicolor.setMods(new CColorModifiers());
var mod = new CColorMod();
if(effectVal > 0)
{
mod.setName("tint");
mod.setVal(effectVal);
}
else
{
mod.setName("shade");
mod.setVal(Math.abs(effectVal));
}
unicolor.Mods.addMod(mod);
}
return ret;
}
CChartSpace.prototype.recalculateBaseColors = function()
{
var is_on = History.Is_On();
if(is_on)
......@@ -169,16 +232,71 @@ CChartSpace.prototype.recalculateStyle = function()
History.TurnOff();
}
if ( styleId && (typeof(styleId) == 'number') ) {
if ( styleId % 8 === 0 )
if ( this.style && (typeof(this.style) == 'number') ) {
if ( this.style % 8 === 0 )
this.baseColors = CreateColorMapByIndex(8);
else
this.baseColors = CreateColorMapByIndex(styleId % 8);
this.baseColors = CreateColorMapByIndex(this.style % 8);
}
else
this.baseColors = CreateColorMapByIndex(2);
if(is_on)
{
History.TurnOn();
}
};
CChartSpace.prototype.hitToAdjustment = function()
{
return {hit: false};
}
CChartSpace.prototype.recalculateSeriesColors = function()
{
var is_on = History.Is_On();
if(is_on)
{
History.TurnOff();
}
if(this.chart && this.chart.plotArea && this.chart.plotArea.chart && this.chart.plotArea.chart.series)
{
var series = this.chart.plotArea.chart.series;
var arrayColors = [];
var countBase = this.baseColors.length;
var needCreate = parseInt(series.length / countBase) + 1;
for (var i = 0; i < needCreate; i++) {
for (var j = 0; j < countBase; j++) {
// : percent = i / needCreate
var percent = (-70 + 140 * ( (i + 1) / (needCreate + 1) )) / 100.0; // ECMA-376 Part 1
var color = CreateUniFillSolidFillWidthTintOrShade(this.baseColors[j], percent);
arrayColors.push( color );
}
}
arrayColors.splice(series.length, arrayColors.length - series.length);
var RGBA = {R: 0, G: 0, B: 0, A:255};
var parents = this.getParentObjects();
for(var i = 0; i < series.length; ++i)
{
var ser = series[i];
if(ser.spPr && ser.spPr.Fill)
{
ser.brush = ser.spPr.Fill;
}
else
{
ser.brush = arrayColors[i];
}
ser.brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA);
}
}
if(is_on)
{
History.TurnOn();
}
};
......@@ -134,6 +134,7 @@ DrawingObjectsController.prototype.addChartDrawingObject = function(asc_chart, o
var chart = this.getChartSpace(asc_chart, options);
if(chart)
{
chart.setStyle(2);
this.resetSelection();
var chartLeft = this.drawingObjects.convertMetric(options && options.left ? ptToPx(options.left) : (parseInt($("#ws-canvas").css('width')) / 2) - c_oAscChartDefines.defaultChartWidth / 2, 0, 3);
var chartTop = this.drawingObjects.convertMetric(options && options.top ? ptToPx(options.top) : (parseInt($("#ws-canvas").css('height')) / 2) - c_oAscChartDefines.defaultChartHeight / 2, 0, 3);
......
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