Commit 0f49c9c4 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

delete unused code

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@51848 954022d7-b5bf-4e40-9824-e11837661b57
parent fa817a87
......@@ -516,13 +516,6 @@ function ChartPreviewManager() {
}
}
function OnFormatText(command) {
frames.message.document.designMode = 'On';
frames.message.focus();
frames.message.document.execCommand(command, 0, 0);
alert(frames.message.document.body.innerHTML);
}
//-----------------------------------------------------------------------------------
// Calculate
//-----------------------------------------------------------------------------------
......
 if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {};
/**
* The bar chart constructor
*
* @param object canvas The canvas object
* @param array data The chart data
*/
OfficeExcel.Bar = function (chartCanvas, data)
{
// Get the canvas and context objects
this.id = null;
this.canvas = chartCanvas ? chartCanvas : document.getElementById(id);
this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
this.canvas = chartCanvas;
this.context = (this.canvas && this.canvas.getContext) ? this.canvas.getContext("2d") : null;
this.canvas.__object__ = this;
this.type = 'bar';
this.max = 0;
this.stackedOrGrouped = false;
this.isOfficeExcel = true;
/**
* Compatibility with older browsers
......@@ -28,21 +18,6 @@
// Other Props
this._otherProps = new OfficeExcel.OtherProps();
// Check for support
if (!this.canvas) {
alert('[BAR] No canvas support');
return;
}
/**
* Determine whether the chart will contain stacked or grouped bars
*/
for (i=0; i<data.length; ++i) {
if (typeof(data[i]) == 'object') {
this.stackedOrGrouped = true;
}
}
// Store the data
this.data = data;
......@@ -122,11 +97,6 @@
line.__bar__ = this;
// Check the X axis positions
if (this._otherProps._xaxispos != line._otherProps._xaxispos) {
alert("[BAR] Using different X axis positions when combining the Bar and Line is not advised");
}
line._chartGutter = this._chartGutter;
line._otherProps._hmargin = (this.canvas.width - this._chartGutter._left - this._chartGutter._right) / (line.original_data[0].length * 2);
......@@ -142,13 +112,6 @@
// The boolean is used to specify that the Line chart .Draw() method is being called by the Bar chart
line.Draw(true);
}
/**
* This function enables adjusting
*/
if (this._otherProps._adjustable) {
OfficeExcel.AllowAdjusting(this);
}
}
......@@ -692,10 +655,6 @@
this.context.stroke();
this.context.lineWidth = 1;
// Unknown variant type
} else {
alert('[BAR] Warning! Unknown variant: ' + variant);
}
this.coords.push([x + hmargin, y, width - (2 * hmargin), height]);
......@@ -706,28 +665,12 @@
*/
} else if (typeof(this.data[i]) == 'object' && this._otherProps._grouping == 'stacked') {
if (this.min) {
alert("[ERROR] Stacked Bar charts with a Y min are not supported");
}
var barWidth = width - (2 * hmargin);
var startY = 0;
var dataset = this.data[i];
for (j=0; j<dataset.length; ++j) {
// Stacked bar chart and X axis pos in the middle - poitless since negative values are not permitted
if (xaxispos == 'center') {
alert("[BAR] It's pointless having the X axis position at the center on a stacked bar chart.");
return;
}
// Negative values not permitted for the stacked chart
if (this.data[i][j] < 0) {
alert('[BAR] Negative values are not permitted with a stacked bar chart. Try a grouped one instead.');
return;
}
/**
* Set the fill and stroke colors
*/
......
......@@ -10,13 +10,6 @@ OfficeExcel.Gutter = function()
OfficeExcel.OtherProps = function()
{
this._curvy = false;
this._curvy_factor = 0.25; // should be 0 - 0.5
this._noredraw = false;
this._adjustable = false;
this._xmin = 0;
this._xmax = 0;
this._ymin = 0;
......@@ -116,8 +109,6 @@ OfficeExcel.OtherProps = function()
this._background_vbars = null;
this._background_hbars = null;
this._line_visible = true;
this._variant = null;
this._stepped = false;
......
 if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {isOfficeExcel:true,type:'common'};
 if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {type:'common'};
OfficeExcel.background = {};
OfficeExcel.Resizing = {};
......@@ -2113,11 +2113,6 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
hbars[i][1] = -1 * (obj.max + hbars[i][0]);
}
// If the X axis is at the bottom, and a negative max is given, warn the user
if (obj._otherProps._xaxispos == 'bottom' && (hbars[i][0] < 0 || (hbars[i][1] + hbars[i][1] < 0)) ) {
alert('[' + obj.type.toUpperCase() + ' (ID: ' + obj.id + ') BACKGROUND HBARS] You have a negative value in one of your background hbars values, whilst the X axis is in the center');
}
var ystart = (obj.grapharea - ((hbars[i][0] / obj.max) * obj.grapharea));
var height = (Math.min(hbars[i][1], obj.max - hbars[i][0]) / obj.max) * obj.grapharea;
......
if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {};
/**
* The horizontal bar chart constructor. The horizontal bar is a minor variant
* on the bar chart. If you have big labels, this may be useful as there is usually
* more space available for them.
*
* @param object canvas The canvas object
* @param array data The chart data
*/
OfficeExcel.HBar = function (chartCanvas, data)
{
// Get the canvas and context objects
this.id = null;
this.canvas = chartCanvas ? chartCanvas : document.getElementById(id);
this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
this.canvas = chartCanvas;
this.context = (this.canvas && this.canvas.getContext) ? this.canvas.getContext("2d") : null;
this.canvas.__object__ = this;
this.data = data;
this.type = 'hbar';
this.coords = [];
this.isOfficeExcel = true;
/**
* Compatibility with older browsers
......@@ -32,19 +20,6 @@
this._otherProps = new OfficeExcel.OtherProps();
this.max = 0;
this.stackedOrGrouped = false;
// Check for support
if (!this.canvas) {
alert('[HBAR] No canvas support');
return;
}
for (i=0; i<this.data.length; ++i) {
if (typeof(this.data[i]) == 'object') {
this.stackedOrGrouped = true;
}
}
}
......@@ -59,14 +34,6 @@
this.coords = [];
this.max = 0;
/**
* Check for xmin in stacked charts
*/
if (this._otherProps._xmin > 0 && this._otherProps._grouping == 'stacked') {
alert('[HBAR] Using xmin is not supported with stacked charts, resetting xmin to zero');
this.__otherProps._xmin = 0;
}
var grouping = this._otherProps._grouping;
for (i=0; i<this.data.length; ++i) {
......@@ -609,12 +576,7 @@
*/
} else if (typeof(this.data[i]) == 'object' && this._otherProps._grouping == 'stacked') {
if (this._otherProps._yaxispos == 'center') {
alert('[HBAR] You can\'t have a stacked chart with the Y axis in the center, change it to grouped');
}
var barHeight = height - (2 * vmargin);
for (j=0; j<this.data[i].length; ++j) {
......@@ -770,10 +732,6 @@
*/
OfficeExcel.HBar.prototype.RedrawBars = function (format)
{
if (this._otherProps._noredraw) {
return;
}
var coords = this.coords;
var font = this._otherProps._labels_above_font;
......
......@@ -2,23 +2,15 @@
OfficeExcel.Line = function (chartCanvas, data)
{
// Get the canvas and context objects
this.id = null;
this.canvas = chartCanvas ? chartCanvas : document.getElementById(id);
this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
this.canvas = chartCanvas;
this.context = (this.canvas && this.canvas.getContext) ? this.canvas.getContext("2d") : null;
this.canvas.__object__ = this;
this.type = 'line';
this.max = 0;
this.coords = [];
this.coords2 = [];
this.hasnegativevalues = false;
this.isOfficeExcel = true;
this.data = data;
// Check for support
if (!this.canvas) {
alert('[LINE] Fatal error: no canvas support');
return;
}
// Compatibility canvas browser
OfficeExcel.CanvasBrowserCompat(this.context);
......@@ -169,14 +161,6 @@
this.halfgrapharea = this.grapharea / 2;
this.halfTextHeight = this._otherProps._text_size / 2;
// Check the combination of the X axis position and if there any negative values
//
// 19th Dec 2010 - removed for Opera since it can be reported incorrectly whn there
// are multiple graphs on the page
if ('auto' != this._otherProps._ylabels_count && this._otherProps._xaxispos == 'bottom' && this.hasnegativevalues && navigator.userAgent.indexOf('Opera') == -1) {
alert('[LINE] You have negative values and the X axis is at the bottom. This is not good...');
}
//Draw Area
OfficeExcel.background.DrawArea(this);
......@@ -201,8 +185,6 @@
fill = this._otherProps._fillstyle[j];
else if (typeof(this._otherProps._fillstyle) == 'string')
fill = this._otherProps._fillstyle;
else
alert('[LINE] Warning: fillstyle must be either a string or an array with the same number of elements as you have sets of data');
} else if (this._otherProps._filled)
fill = this._otherProps._colors[j];
......@@ -339,12 +321,7 @@
}
this.context.stroke();
} else if (this._otherProps._filled && this._otherProps._filled_range)
alert('[LINE] You must have only two sets of data for a filled range chart');
// Adjustments
if (this._otherProps._adjustable)
OfficeExcel.AllowAdjusting(this);
}
}
......@@ -678,8 +655,6 @@
'-' + OfficeExcel.number_format(this, (this.scale[4] - ((this.scale[4] / numYLabels) * (numYLabels - i - 1))).toFixed((this._otherProps._scale_decimals)),units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
} else {
alert('[LINE SCALE] The number of Y labels must be 1/3/5/10');
}
if (typeof(this._otherProps._ymin) == 'number') {
OfficeExcel.Text(context, font, text_size, xpos, this.canvas.height / 2, OfficeExcel.number_format(this, this._otherProps._ymin.toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', align, bounding, null, bgcolor, bold, null, textOptions);
......@@ -761,8 +736,6 @@
OfficeExcel.Text(context,font,text_size,xpos,(2 * interval) + this._chartGutter._top + this.halfTextHeight + ((i/10) * (this.grapharea) ),'-' + OfficeExcel.number_format(this,(scale[0] - (((scale[0] - this.min) / numYLabels) * (numYLabels - i - 1))).toFixed((this._otherProps._scale_decimals)),units_pre,units_post),null,align,bounding,null,bgcolor, bold, null, textOptions);
}
} else {
alert('[LINE SCALE] The number of Y labels must be 1/3/5/10');
}
......@@ -827,11 +800,8 @@
OfficeExcel.Text(context,font,text_size,xpos,this._chartGutter._top + this.halfTextHeight + ((i/10) * (this.grapharea) ),OfficeExcel.number_format(this,((((this.scale[4] - this.min) / numYLabels) * (numYLabels - i)) + this.min).toFixed((this._otherProps._scale_decimals)),units_pre,units_post),null,align,bounding,null,bgcolor, bold, null, textOptions);
}
} else {
alert('[LINE SCALE] The number of Y labels must be 1/3/5/10');
}
/**
* Accommodate translating back after reversing the labels
*/
......@@ -1384,7 +1354,7 @@
OfficeExcel.Line.prototype.DrawTick = function (lineData, xPos, yPos, color, prevX, prevY, tickmarks, index)
{
// If the yPos is null - no tick
if ((yPos == null || yPos > (this.canvas.height - this._chartGutter._bottom) || yPos < this._chartGutter._top) && !this._otherProps._outofbounds || !this._otherProps._line_visible)
if ((yPos == null || yPos > (this.canvas.height - this._chartGutter._bottom) || yPos < this._chartGutter._top) && !this._otherProps._outofbounds)
return;
this.context.beginPath();
......@@ -1604,20 +1574,9 @@
// Redraws the line with the correct line width etc
OfficeExcel.Line.prototype.RedrawLine = function (coords, color, linewidth)
{
if (this._otherProps._noredraw)
return;
this.context.strokeStyle = (typeof(color) == 'object' && color ? color[0] : color);
this.context.lineWidth = linewidth;
if (!this._otherProps._line_visible)
this.context.strokeStyle = 'rgba(0,0,0,0)';
if (this._otherProps._curvy) {
this.DrawCurvyLine(coords, !this._otherProps._line_visible ? 'rgba(0,0,0,0)' : color, linewidth);
return;
}
this.context.beginPath();
var len = coords.length;
......@@ -1725,8 +1684,6 @@
return linewidth[i];
else
return linewidth[0];
alert('[LINE] Error! linewidth should be a single number or an array of one or more numbers');
}
}
......@@ -1775,66 +1732,3 @@
context.fill();
}
\ No newline at end of file
/**
* Draw a curvy line. This isn't 100% accurate but may be more to your tastes
*/
OfficeExcel.Line.prototype.DrawCurvyLine = function (coords, color, linewidth)
{
var co = this.context;
// Now calculate the halfway point
co.beginPath();
co.strokeStyle = color;
co.lineWidth = linewidth;
for (var i=0; i<coords.length; ++i) {
var factor = this._otherProps._curvy_factor;
if (coords[i] && typeof(coords[i][1]) == 'number' && coords[i + 1] && typeof(coords[i + 1][1]) == 'number') {
var coordX = coords[i][0];
var coordY = coords[i][1];
var nextX = coords[i + 1][0];
var nextY = coords[i + 1][1];
var prevX = coords[i - 1] ? coords[i - 1][0] : null;
var prevY = coords[i - 1] ? coords[i - 1][1] : null;
var offsetX = (coords[i + 1][0] - coords[i][0]) * factor;
var offsetY = (coords[i + 1][1] - coords[i][1]) * factor;
if (i == 0) {
co.moveTo(coordX, coordY);
co.lineTo(nextX - offsetX, nextY - offsetY);
} else if (nextY == null) {
co.lineTo(coordX, coordY);
} else if (prevY == null) {
co.moveTo(coordX, coordY);
} else if (coordY == null) {
co.moveTo(nextX, nextY);
} else {
co.quadraticCurveTo(coordX, coordY, coordX + offsetX, coordY + offsetY);
if (nextY) {
co.lineTo(nextX - offsetX, nextY - offsetY);
} else {
co.lineTo(coordX, coordY);
}
}
} else if (typeof(coords[i][1]) == 'number') {
co.lineTo(coords[i][0], coords[i][1]);
}
}
co.stroke();
}
\ No newline at end of file
if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {};
/**
* The pie chart constructor
*
* @param data array The data to be represented on the pie chart
*/
OfficeExcel.Pie = function (chartCanvas, data)
{
this.id = null;
this.canvas = chartCanvas ? chartCanvas : document.getElementById(id);
this.context = this.canvas.getContext("2d");
this.canvas = chartCanvas;
this.context = (this.canvas && this.canvas.getContext) ? this.canvas.getContext("2d") : null;
this.canvas.__object__ = this;
this.total = 0;
this.subTotal = 0;
this.angles = [];
this.data = data;
this.type = 'pie';
this.isOfficeExcel = true;
/**
* Compatibility with older browsers
......
if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {};
/**
* The scatter graph constructor
*
* @param object canvas The cxanvas object
* @param array data The chart data
*/
OfficeExcel.Scatter = function (chartCanvas, data)
{
// Get the canvas and context objects
this.id = null;
this.canvas = chartCanvas ? chartCanvas : document.getElementById(id);
this.canvas = chartCanvas;
this.canvas.__object__ = this;
this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
this.context = (this.canvas && this.canvas.getContext) ? this.canvas.getContext("2d") : null;
this.max = 0;
this.coords = [];
this.data = [];
this.type = 'scatter';
this.isOfficeExcel = true;
/**
* Compatibility with older browsers
......@@ -44,12 +34,6 @@
this.data[i - 1] = arguments[i];
}
}
// Check for support
if (!this.canvas) {
alert('[SCATTER] No canvas support');
return;
}
}
/**
......@@ -556,8 +540,6 @@
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (i/20) ) + (this.grapharea / 2) + (this.grapharea / 20),'-' + OfficeExcel.number_format(this, ((this.max * (i/10)) + (this.max * (1/10))).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
} else {
alert('[SCATTER SCALE] Number of Y labels can be 1/3/5/10 only');
}
}
......@@ -685,8 +667,6 @@
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (i/10) ),OfficeExcel.number_format(this, (this.max - ((this.max - this.min) * (i/10))).toFixed((this._otherProps._scale_decimals)), units_pre, units_post),'center', align, boxed, null, bold, null, textOptions);
}
}
} else {
alert('[SCATTER SCALE] Number of Y labels can be 1/3/5/10 only');
}
if (this._otherProps._ymin) {
......@@ -1247,8 +1227,6 @@
/**
* Unknown tickmark type
*/
} else {
alert('[SCATTER] (' + this.id + ') Unknown tickmark style: ' + tickmarks );
}
}
......@@ -1368,8 +1346,6 @@
} else {
return linewidth[0];
}
alert('[SCATTER] Error! linewidth should be a single number or an array of one or more numbers');
}
}
......
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