Commit baa65989 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

правка для бага #20164

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@51188 954022d7-b5bf-4e40-9824-e11837661b57
parent bf003e34
...@@ -1009,6 +1009,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options) ...@@ -1009,6 +1009,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options)
var formatCellScOy = 'General'; var formatCellScOy = 'General';
var defaultFormat = 'General'; var defaultFormat = 'General';
var isDateTimeFormat; var isDateTimeFormat;
var catNameFormat;
var api_doc = window["editor"]; var api_doc = window["editor"];
var api_sheet = window["Asc"]["editor"]; var api_sheet = window["Asc"]["editor"];
...@@ -1018,6 +1019,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options) ...@@ -1018,6 +1019,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options)
arrBaseColors = styleManager.getBaseColors( parseInt(chart.styleId) ); arrBaseColors = styleManager.getBaseColors( parseInt(chart.styleId) );
var arrFormatAdobeLabels = []; var arrFormatAdobeLabels = [];
var catNameLabels = [];
//просматриваем bShowValue для каждой из серий //просматриваем bShowValue для каждой из серий
//TODO позже отрисовывать значения для каждой серии индивидуально //TODO позже отрисовывать значения для каждой серии индивидуально
...@@ -1029,7 +1031,10 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options) ...@@ -1029,7 +1031,10 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options)
} }
} }
} }
if(chart.bShowCatName)
chart.bShowValue = true;
if(chart.series && chart.series.length != 0 /*&& !chart.range.intervalObject*/)//берём данные из NumCache if(chart.series && chart.series.length != 0 /*&& !chart.range.intervalObject*/)//берём данные из NumCache
{ {
isSeries = true; isSeries = true;
...@@ -1092,6 +1097,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options) ...@@ -1092,6 +1097,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options)
skipSeries[l] = false; skipSeries[l] = false;
arrValues[numSeries] = []; arrValues[numSeries] = [];
arrFormatAdobeLabels[numSeries] = []; arrFormatAdobeLabels[numSeries] = [];
catNameLabels[numSeries] = [];
isSkip[numSeries] = true; isSkip[numSeries] = true;
var row = firstRow; var row = firstRow;
...@@ -1160,6 +1166,14 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options) ...@@ -1160,6 +1166,14 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options)
else else
arrValues[numSeries][n] = value; arrValues[numSeries][n] = value;
arrFormatAdobeLabels[numSeries][n] = formatAdobeLabel; arrFormatAdobeLabels[numSeries][n] = formatAdobeLabel;
if(chart.bShowCatName && chart.type != 'Scatter')
{
if(chart.bShowCatName && series[numSeries] && series[numSeries].Cat && chart.type != "Pie")
catNameLabels[numSeries][n] = series[numSeries].Cat.NumCache[col].val;
else if(series[numSeries] && series[numSeries] && series[numSeries].TxCache)
catNameLabels[numSeries][n] = series[numSeries].TxCache.Tx;
}
n++; n++;
} }
numSeries++; numSeries++;
...@@ -1321,7 +1335,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options) ...@@ -1321,7 +1335,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options)
chart.max = max; chart.max = max;
if(skipSeries) if(skipSeries)
chart.skipSeries = skipSeries; chart.skipSeries = skipSeries;
chart.catNameLabels = null;
if(newArr != undefined) if(newArr != undefined)
{ {
chart.arrFormatAdobeLabels = newAdobeLabels; chart.arrFormatAdobeLabels = newAdobeLabels;
...@@ -1337,12 +1351,16 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options) ...@@ -1337,12 +1351,16 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart, options)
chart.isSkip = arrReverse(isSkip); chart.isSkip = arrReverse(isSkip);
arrValuesRev = arrReverse(arrValues); arrValuesRev = arrReverse(arrValues);
chart.arrFormatAdobeLabels = arrReverse(arrFormatAdobeLabels); chart.arrFormatAdobeLabels = arrReverse(arrFormatAdobeLabels);
if(catNameLabels && catNameLabels.length)
chart.catNameLabels = arrReverse(catNameLabels);
drawChart(chart, arrValuesRev, width, height, options); drawChart(chart, arrValuesRev, width, height, options);
} }
else else
{ {
chart.isSkip = isSkip; chart.isSkip = isSkip;
chart.arrFormatAdobeLabels = arrFormatAdobeLabels; chart.arrFormatAdobeLabels = arrFormatAdobeLabels;
if(catNameLabels && catNameLabels.length)
chart.catNameLabels = catNameLabels;
drawChart(chart, arrValues, width, height, options); drawChart(chart, arrValues, width, height, options);
} }
} }
...@@ -1701,6 +1719,10 @@ function drawChart(chart, arrValues, width, height, options) { ...@@ -1701,6 +1719,10 @@ function drawChart(chart, arrValues, width, height, options) {
else else
bar._otherProps._background_image_color = defaultColor; bar._otherProps._background_image_color = defaultColor;
bar.margins = chart.margins; bar.margins = chart.margins;
if(chart.catNameLabels && chart.catNameLabels.length)
bar.catNameLabels = chart.catNameLabels;
else
bar.catNameLabels = null;
bar.Draw(chart.min,chart.max,chart.ymin,chart.ymax,chart.isSkip,chart.isFormatCell,chart.isformatCellScOy); bar.Draw(chart.min,chart.max,chart.ymin,chart.ymax,chart.isSkip,chart.isFormatCell,chart.isformatCellScOy);
} }
......
...@@ -1302,7 +1302,10 @@ ...@@ -1302,7 +1302,10 @@
var formatCellTrue = formatCell; var formatCellTrue = formatCell;
if(this.arrFormatAdobeLabels && this.arrFormatAdobeLabels[i]) if(this.arrFormatAdobeLabels && this.arrFormatAdobeLabels[i])
formatCellTrue = this.arrFormatAdobeLabels[i][j]; formatCellTrue = this.arrFormatAdobeLabels[i][j];
this.coords.push([startX, startY, individualBarWidth, height, formatCellTrue, this.firstData[i][j]]); var catName;
if(this.catNameLabels && this.catNameLabels[i] && this.catNameLabels[i][j])
catName = this.catNameLabels[i][j];
this.coords.push([startX, startY, individualBarWidth, height, formatCellTrue, this.firstData[i][j], catName]);
// Facilitate shadows going to the left // Facilitate shadows going to the left
if (this._shadow._visible) { if (this._shadow._visible) {
...@@ -2069,7 +2072,10 @@ ...@@ -2069,7 +2072,10 @@
value = this.coords[i][5]; value = this.coords[i][5];
if(value != '') if(value != '')
value = OfficeExcel.numToFormatText(OfficeExcel.num_round(value),formatCellTrue); value = OfficeExcel.numToFormatText(OfficeExcel.num_round(value),formatCellTrue);
//catName
if(this.catNameLabels && this.coords[i][6])
value = this.coords[i][6];
this.context.fillStyle = this._otherProps._text_color; this.context.fillStyle = this._otherProps._text_color;
OfficeExcel.Text(this.context, OfficeExcel.Text(this.context,
this._otherProps._labels_above_font, this._otherProps._labels_above_font,
......
...@@ -1388,6 +1388,8 @@ ...@@ -1388,6 +1388,8 @@
OfficeExcel.num_round = function (num) OfficeExcel.num_round = function (num)
{ {
if(num.toString() && num.toString().indexOf('e+') == -1 && isNaN(parseFloat(num)))
return num;
var floatKoff = 100000000000; var floatKoff = 100000000000;
if(num.toString() && num.toString().indexOf('e+') > -1) if(num.toString() && num.toString().indexOf('e+') > -1)
{ {
......
...@@ -993,7 +993,12 @@ ...@@ -993,7 +993,12 @@
//this.context.strokeRect(startX, startY, width, individualBarHeight); //this.context.strokeRect(startX, startY, width, individualBarHeight);
if(width != 0) if(width != 0)
this.context.fillRect(startX, startY, width, individualBarHeight); this.context.fillRect(startX, startY, width, individualBarHeight);
var catName;
if(this.catNameLabels && this.catNameLabels[i] && this.catNameLabels[i][j])
{
catName = this.catNameLabels[i][j];
}
this.coords.push([startX, this.coords.push([startX,
startY, startY,
width, width,
...@@ -1002,7 +1007,8 @@ ...@@ -1002,7 +1007,8 @@
this.data[i][j], this.data[i][j],
true, true,
this.arrFormatAdobeLabels[i][j], this.arrFormatAdobeLabels[i][j],
this.firstData[i][j] this.firstData[i][j],
catName
]); ]);
} }
} }
...@@ -1076,14 +1082,16 @@ ...@@ -1076,14 +1082,16 @@
var formatLabel = format; var formatLabel = format;
if(this.coords[i][7]) if(this.coords[i][7])
formatLabel = this.coords[i][7]; formatLabel = this.coords[i][7];
if(this.coords[i][8]) if(this.coords[i][9])
textLabel = this.coords[i][9];
else if(this.coords[i][8])
textLabel = this.coords[i][8]; textLabel = this.coords[i][8];
else else
continue; continue;
if(this.coords[i][7] == null && !textLabel) if(this.coords[i][7] == null && !textLabel)
textLabel = ""; textLabel = "";
if(textLabel != '') if(textLabel != '' && !this.coords[i][9])
textLabel = OfficeExcel.numToFormatText(OfficeExcel.num_round(textLabel),formatLabel); textLabel = OfficeExcel.numToFormatText(OfficeExcel.num_round(textLabel),formatLabel);
OfficeExcel.Text(this.context, OfficeExcel.Text(this.context,
......
...@@ -1977,11 +1977,19 @@ ...@@ -1977,11 +1977,19 @@
n = 0; n = 0;
for (var i = 0; i < this.firstData.length; ++i) { for (var i = 0; i < this.firstData.length; ++i) {
for (var j = 0; j < this.firstData[i].length; ++j) { for (var j = 0; j < this.firstData[i].length; ++j) {
tempData[n] = this.firstData[i][j]; if(this.catNameLabels && this.catNameLabels[i] && this.catNameLabels[i][j])
if(this.arrFormatAdobeLabels && this.arrFormatAdobeLabels[i] && this.arrFormatAdobeLabels[i][j]) {
formatLabels[n] = this.arrFormatAdobeLabels[i][j]; tempData[n] = this.catNameLabels[i][j];
formatLabels[n] = "General";
}
else else
formatLabels[n] = format; {
tempData[n] = this.firstData[i][j];
if(this.arrFormatAdobeLabels && this.arrFormatAdobeLabels[i] && this.arrFormatAdobeLabels[i][j])
formatLabels[n] = this.arrFormatAdobeLabels[i][j];
else
formatLabels[n] = format;
}
n++; n++;
} }
} }
......
...@@ -623,6 +623,7 @@ ...@@ -623,6 +623,7 @@
var labels = this._otherProps._labels; var labels = this._otherProps._labels;
var context = this.context; var context = this.context;
var bold = this._otherProps._labels_above_bold; var bold = this._otherProps._labels_above_bold;
var curLabel;
var textOptions = var textOptions =
{ {
color: this._otherProps._labels_above_color, color: this._otherProps._labels_above_color,
...@@ -714,13 +715,19 @@ ...@@ -714,13 +715,19 @@
context.fillStyle = this._otherProps._text_color; context.fillStyle = this._otherProps._text_color;
if(this.catNameLabels && typeof this.catNameLabels[0][i] == "string")
{
curLabel = this.catNameLabels[0][i];
isFormatCellTrue = "General";
}
else
curLabel = labels[i];
OfficeExcel.Text(context, OfficeExcel.Text(context,
this._otherProps._text_font, this._otherProps._text_font,
text_size, text_size,
centerx + explosion_offsetx + ((this.radius - 10)* Math.cos(a)) + (this._otherProps._labels_sticks ? (a < 1.57 || a > 4.71 ? 2 : -2) : 0), centerx + explosion_offsetx + ((this.radius - 10)* Math.cos(a)) + (this._otherProps._labels_sticks ? (a < 1.57 || a > 4.71 ? 2 : -2) : 0),
this.centery + explosion_offsety + (((this.radius - 10) * Math.sin(a))), this.centery + explosion_offsety + (((this.radius - 10) * Math.sin(a))),
OfficeExcel.numToFormatText(labels[i],isFormatCellTrue), OfficeExcel.numToFormatText(curLabel,isFormatCellTrue),
vAlignment, vAlignment,
hAlignment, false, null,null, bold, null, textOptions); hAlignment, false, null,null, bold, null, textOptions);
} }
......
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