Commit fcae574f authored by GoshaZotov's avatar GoshaZotov

change function for draw hBar charts

parent 3d005d56
...@@ -63,6 +63,17 @@ var c_oChartTypes = ...@@ -63,6 +63,17 @@ var c_oChartTypes =
BubbleChart: 9 BubbleChart: 9
}; };
var c_oChartBar3dFaces =
{
front: 0,
up: 1,
left: 2,
right: 3,
down: 4,
back: 5
};
var globalGapDepth = 150; var globalGapDepth = 150;
var isTurnOn3DCharts = true; var isTurnOn3DCharts = true;
var standartMarginForCharts = 13; var standartMarginForCharts = 13;
...@@ -7102,67 +7113,133 @@ drawHBarChart.prototype = ...@@ -7102,67 +7113,133 @@ drawHBarChart.prototype =
_drawBar3D: function(path, pen, brush, k) _drawBar3D: function(path, pen, brush, k)
{ {
//затемнение боковых сторон //затемнение боковых сторон
//в excel всегда темные боковые стороны, лицевая и задняя стороны светлые var fill = this._getFill(pen, brush, k);
//pen = this.cChartSpace.chart.plotArea.valAx.compiledMajorGridLines; var newBrush = fill.brush;
//pen.setFill(brush); var newPen = fill.pen;
this.cChartDrawer.drawPath(path, newPen, newBrush);
},
if(null === pen || (null !== pen && null === pen.Fill) || (null !== pen && null !== pen.Fill && null === pen.Fill.fill)) _getFill: function(pen, brush, face)
{ {
pen = AscFormat.CreatePenFromParams(brush, undefined, undefined, undefined, undefined, 0.1); //k: 0 - передняя, 1 - верхняя, 2 - левая, 3 - правая, 4 - нижняя, 5 - задняя
} var shade = "shade";
var shadeValue1 = 35000;
var shadeValue2 = 45000;
var angleKf = 60000;
if(k != 5 && k != 0) var newBrush = brush;
{ var newPen = pen;
var duplicateBrush = brush; var t = this;
if(brush)
var applyColorModeByBrush = function(brushFill, val)
{ {
var props = this.cChartSpace.getParentObjects(); var props = t.cChartSpace.getParentObjects();
var duplicateBrush = brush.createDuplicate(); var duplicateBrush = brushFill.createDuplicate();
var cColorMod = new AscFormat.CColorMod; var cColorMod = new AscFormat.CColorMod;
cColorMod.val = val;
if(k === 1 || k === 4) cColorMod.name = shade;
{ duplicateBrush.addColorMod(cColorMod);
//для градиентной заливки верхнюю и нижнюю грань закрашиываем первым и последним цветом соотвенственно duplicateBrush.calculate(props.theme, props.slide, props.layout, props.master, new AscFormat.CUniColor().RGBA);
if(duplicateBrush.fill && AscDFH.historyitem_type_GradFill === duplicateBrush.fill.getObjectType())
{ return duplicateBrush;
var colors = duplicateBrush.fill.colors; };
if(k === 1 && colors && colors[0] && colors[0].color)
/*var colors = duplicateBrush.fill.colors;
if(k === 3 && colors && colors[0] && colors[0].color)
{ {
var tempColor = new AscFormat.CUniFill(); var tempColor = new AscFormat.CUniFill();
tempColor.setFill(new AscFormat.CSolidFill()); tempColor.setFill(new AscFormat.CSolidFill());
tempColor.fill.setColor(colors[0].color); tempColor.fill.setColor(colors[0].color);
duplicateBrush = tempColor; duplicateBrush = tempColor;
} }
else if(k === 4 && colors[colors.length - 1] && colors[colors.length - 1].color) else if(k === 2 && colors[colors.length - 1] && colors[colors.length - 1].color)
{ {
var tempColor = new AscFormat.CUniFill(); var tempColor = new AscFormat.CUniFill();
tempColor.setFill(new AscFormat.CSolidFill()); tempColor.setFill(new AscFormat.CSolidFill());
tempColor.fill.setColor(colors[colors.length - 1].color); tempColor.fill.setColor(colors[colors.length - 1].color);
duplicateBrush = tempColor; duplicateBrush = tempColor;
}*/
var getGradientFill = function(brushFill, faceIndex)
{
if(brushFill.fill.lin && null !== brushFill.fill.lin.angle)
{
var angle = brushFill.fill.lin.angle / angleKf;
}
};
if(null === pen || (null !== pen && null === pen.Fill) || (null !== pen && null !== pen.Fill && null === pen.Fill.fill))
{
pen = AscFormat.CreatePenFromParams(brush, undefined, undefined, undefined, undefined, 0.1);
} }
//TODO сделать для градиентной заливики в зависимости от угла
if(brush && brush.fill && AscDFH.historyitem_type_GradFill === brush.fill.getObjectType())
{
switch ( face )
{
case c_oChartBar3dFaces.front:
case c_oChartBar3dFaces.back:
{
break;
} }
case c_oChartBar3dFaces.up:
{
cColorMod.val = 45000; break;
} }
else case c_oChartBar3dFaces.left:
{ {
cColorMod.val = 35000;
break;
} }
case c_oChartBar3dFaces.right:
{
cColorMod.name = "shade"; break;
duplicateBrush.addColorMod(cColorMod); }
duplicateBrush.calculate(props.theme, props.slide, props.layout, props.master, new AscFormat.CUniColor().RGBA); case c_oChartBar3dFaces.down:
{
break;
}
}
}
else if(brush && brush.fill)
{
switch ( face )
{
case c_oChartBar3dFaces.front:
case c_oChartBar3dFaces.back:
{
break;
}
case c_oChartBar3dFaces.up:
case c_oChartBar3dFaces.down:
{
newBrush = applyColorModeByBrush(brush, shadeValue1);
if(null === pen) if(null === pen)
{ {
pen.setFill(duplicateBrush); newPen = pen.setFill(newBrush);
} }
break;
} }
case c_oChartBar3dFaces.left:
this.cChartDrawer.drawPath(path, pen, duplicateBrush); case c_oChartBar3dFaces.right:
{
newBrush = applyColorModeByBrush(brush, shadeValue2);
if(null === pen)
{
newPen = pen.setFill(newBrush);
} }
else break;
this.cChartDrawer.drawPath(path, pen, brush); }
}
}
return {brush: newBrush, pen: newPen};
} }
}; };
......
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