Commit afdf4e41 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@51814 954022d7-b5bf-4e40-9824-e11837661b57
parent 46f9d301
......@@ -31,12 +31,6 @@
this._xAxisTitle = new OfficeExcel.Title();
// yAxis Title
this._yAxisTitle = new OfficeExcel.Title();
// Chart shadow
this._shadow = new OfficeExcel.Shadow();
// zoom
this._zoom = new OfficeExcel.chartZoom();
// Tooltip
this._tooltip = new OfficeExcel.Tooltips();
// Other Props
this._otherProps = new OfficeExcel.OtherProps();
......@@ -60,11 +54,6 @@
// Used to store the coords of the bars
this.coords = [];
/**
* Set the .getShape commonly named method
*/
this.getShape = this.getBar;
}
/**
......@@ -76,21 +65,6 @@
this.scale = OfficeExcel.getScale(this.max, this,min,max);
this._otherProps._background_grid_autofit_numhlines = this.scale.length;
this._otherProps._numyticks = this.scale.length;
// MUST be the first thing done!
if (typeof(this._otherProps._background_image) == 'string' && !this.__background_image__) {
OfficeExcel.DrawBackgroundImage(this);
return;
}
/**
* Fire the onbeforedraw event
*/
OfficeExcel.FireCustomEvent(this, 'onbeforedraw');
/**
* Clear all of this canvases event handlers (the ones installed by OfficeExcel)
*/
//OfficeExcel.ClearEventListeners(this.id);
/**
* Convert any null values to 0. Won't make any difference to the bar (as opposed to the line chart)
......@@ -104,17 +78,6 @@
// Cache this in a class variable as it's used rather a lot
/**
* Check for tooltips and alert the user that they're not supported with pyramid charts
*/
if ( (this._otherProps._variant == 'pyramid' || this._otherProps._variant == 'dot')
&& typeof(this._tooltip._tooltips) == 'object'
&& this._tooltip._tooltips
&& this._tooltip._tooltips.length > 0) {
alert('[BAR] (' + this.id + ') Sorry, tooltips are not supported with dot or pyramid charts');
}
/**
* Stop the coords array from growing uncontrollably
*/
......@@ -134,16 +97,6 @@
// Progressively Draw the chart
OfficeExcel.background.Draw(this);
/**
* Install the clickand mousemove event listeners
*/
OfficeExcel.InstallUserClickListener(this, this._otherProps._events_click);
OfficeExcel.InstallUserMousemoveListener(this, this._otherProps._events_mousemove);
//If it's a sketch chart variant, draw the axes first
if (this._otherProps._variant == 'sketch') {
this.DrawAxes(min,max);
......@@ -203,13 +156,6 @@
if (this._otherProps._labels_ingraph) {
OfficeExcel.DrawInGraphLabels(this);
}
/**
* Draw crosschairs
*/
if (this._otherProps._crosshairs) {
OfficeExcel.DrawCrosshairs(this);
}
......@@ -219,12 +165,6 @@
if (this._otherProps._adjustable) {
OfficeExcel.AllowAdjusting(this);
}
/**
* Fire the OfficeExcel ondraw event
*/
OfficeExcel.FireCustomEvent(this, 'ondraw');
}
......@@ -552,11 +492,6 @@
var width = (this.canvas.width - this._chartGutter._left - this._chartGutter._right ) / this.data.length;
var orig_height = height;
var hmargin = this._otherProps._hmargin;
var shadow = this._shadow._visible;
var shadowColor = this._shadow._color;
var shadowBlur = this._shadow._blur;
var shadowOffsetX = this._shadow._offset_x;
var shadowOffsetY = this._shadow._offset_y;
var strokeStyle = this._otherProps._strokecolor;
var colors = this._otherProps._colors;
var sequentialColorIndex = 0;
......@@ -613,16 +548,6 @@
height = Math.abs(height);
}
/**
* Turn on the shadow if need be
*/
if (shadow) {
this.context.shadowColor = shadowColor;
this.context.shadowBlur = shadowBlur;
this.context.shadowOffsetX = shadowOffsetX;
this.context.shadowOffsetY = shadowOffsetY;
}
/**
* Draw the bar
*/
......@@ -682,10 +607,6 @@
// Regular bar
} else if (variant == 'bar' || variant == '3d' || variant == 'glass' || variant == 'bevel') {
if (OfficeExcel.isOld() && shadow) {
this.DrawIEShadow([x + hmargin, y, barWidth, height]);
}
if (variant == 'glass') {
OfficeExcel.filledCurvyRect(this.context, x + hmargin, y, barWidth, height, 3, this.data[i] > 0, this.data[i] > 0, this.data[i] < 0, this.data[i] < 0);
OfficeExcel.strokedCurvyRect(this.context, x + hmargin, y, barWidth, height, 3, this.data[i] > 0, this.data[i] > 0, this.data[i] < 0, this.data[i] < 0);
......@@ -771,12 +692,6 @@
// This bit draws the text labels that appear above the bars if requested
if (this._otherProps._labels_above) {
// Turn off any shadow
if (shadow) {
OfficeExcel.NoShadow(this);
}
var yPos = y - 3;
// Account for negative bars
......@@ -904,7 +819,6 @@
}
var barWidth = width - (2 * hmargin);
var redrawCoords = [];// Necessary to draw if the shadow is enabled
var startY = 0;
var dataset = this.data[i];
......@@ -952,11 +866,6 @@
*/
this.coords.push([x + hmargin, y, width - (2 * hmargin), height]);
// MSIE shadow
if (OfficeExcel.isOld() && shadow) {
this.DrawIEShadow([x + hmargin, y, width - (2 * hmargin), height + 1]);
}
this.context.strokeRect(x + hmargin, y, width - (2 * hmargin), height);
this.context.fillRect(x + hmargin, y, width - (2 * hmargin), height);
......@@ -966,13 +875,6 @@
var startX = x;
}
/**
* Store the redraw coords if the shadow is enabled
*/
if (shadow) {
redrawCoords.push([x + hmargin, y, width - (2 * hmargin), height, this.context.fillStyle]);
}
/**
* Stacked 3D effect
*/
......@@ -1042,15 +944,12 @@
// This bit draws the text labels that appear above the bars if requested
if (this._otherProps._labels_above) {
// Turn off any shadow
OfficeExcel.NoShadow(this);
this.context.fillStyle = this._otherProps._text_color;
OfficeExcel.Text(this.context,
this._otherProps._labels_above_font,
typeof(this._otherProps._labels_above_size) == 'number' ? this._otherProps._labels_above_size : this._otherProps._text_size - 3,
startX + (barWidth / 2) + this._otherProps._hmargin,
startY - (this._shadow._visible && this._shadow._offset_y < 0 ? 7 : 4) - (this._otherProps._variant == '3d' ? 5 : 0),
startY - 4 - (this._otherProps._variant == '3d' ? 5 : 0),
String(this._otherProps._units_pre + OfficeExcel.array_sum(this.data[i]).toFixed(this._otherProps._labels_above_decimals) + this._otherProps._units_post),
this._otherProps._labels_above_angle ? 'bottom' : null,
this._otherProps._labels_above_angle ? (this._otherProps._labels_above_angle > 0 ? 'right' : 'left') : 'center',
......@@ -1059,45 +958,11 @@
null,
bold,
textOptions);
// Turn any shadow back on
if (shadow) {
this.context.shadowColor = shadowColor;
this.context.shadowBlur = shadowBlur;
this.context.shadowOffsetX = shadowOffsetX;
this.context.shadowOffsetY = shadowOffsetY;
}
}
/**
* Redraw the bars if the shadow is enabled due to hem being drawn from the bottom up, and the
* shadow spilling over to higher up bars
*/
if (shadow) {
OfficeExcel.NoShadow(this);
for (k=0; k<redrawCoords.length; ++k) {
this.context.strokeStyle = strokeStyle;
this.context.fillStyle = redrawCoords[k][4];
this.context.strokeRect(redrawCoords[k][0], redrawCoords[k][1], redrawCoords[k][2], redrawCoords[k][3]);
this.context.fillRect(redrawCoords[k][0], redrawCoords[k][1], redrawCoords[k][2], redrawCoords[k][3]);
this.context.stroke();
this.context.fill();
}
// Reset the redraw coords to be empty
redrawCoords = [];
}
/**
* Grouped bar
*/
} else if (typeof(this.data[i]) == 'object' && this._otherProps._grouping == 'grouped') {
var redrawCoords = [];
this.context.lineWidth = this._otherProps._linewidth;
for (j=0; j<this.data[i].length; ++j) {
......@@ -1158,14 +1023,6 @@
var startY = this.canvas.height - this._chartGutter._bottom - height;
var height = Math.abs(height);
}
/**
* Draw MSIE shadow
*/
if (OfficeExcel.isOld() && shadow) {
this.DrawIEShadow([startX, startY, individualBarWidth, height]);
}
if(this._otherProps._type == 'accumulative' || this._otherProps._autoGrouping == 'stackedPer')
{
......@@ -1277,60 +1134,12 @@
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
if (this._shadow._visible) {
redrawCoords.push([startX, startY, individualBarWidth, height, this.context.fillStyle]);
}
}
/**
* Redraw the bar if shadows are going to the left
*/
if (redrawCoords.length) {
OfficeExcel.NoShadow(this);
this.context.lineWidth = this._otherProps._linewidth;
this.context.beginPath();
for (var j=0; j<redrawCoords.length; ++j) {
this.context.fillStyle = redrawCoords[j][4];
this.context.strokeStyle = this._otherProps._strokecolor;
this.context.fillRect(redrawCoords[j][0], redrawCoords[j][1], redrawCoords[j][2], redrawCoords[j][3]);
this.context.strokeRect(redrawCoords[j][0], redrawCoords[j][1], redrawCoords[j][2], redrawCoords[j][3]);
}
this.context.fill();
this.context.stroke();
redrawCoords = [];
}
}
this.context.closePath();
}
}
/**
* Turn off any shadow
*/
OfficeExcel.NoShadow(this);
/**
* Install the onclick event handler
*/
if (this._tooltip._tooltips) {
// Need to register this object for redrawing
OfficeExcel.Register(this);
OfficeExcel.PreLoadTooltipImages(this);
OfficeExcel.InstallBarTooltipEventListeners(this);
}
}
/**
......@@ -1862,83 +1671,6 @@
this.context.stroke();
}
/**
* This function is used by MSIE only to manually draw the shadow
*
* @param array coords The coords for the bar
*/
OfficeExcel.Bar.prototype.DrawIEShadow = function (coords)
{
var prevFillStyle = this.context.fillStyle;
var offsetx = this._shadow._offset_x;
var offsety = this._shadow._offset_y;
this.context.lineWidth = this._otherProps._linewidth;
this.context.fillStyle = this._shadow._color;
this.context.beginPath();
// Draw shadow here
this.context.fillRect(coords[0] + offsetx, coords[1] + offsety, coords[2], coords[3]);
this.context.fill();
// Change the fillstyle back to what it was
this.context.fillStyle = prevFillStyle;
}
/**
* Not used by the class during creating the graph, but is used by event handlers
* to get the coordinates (if any) of the selected bar
*
* @param object e The event object
* @param object OPTIONAL You can pass in the bar object instead of the
* function getting it from the canvas
*/
OfficeExcel.Bar.prototype.getBar = function (e)
{
var canvas = e.target;
var obj = e.target.__object__;
if (obj.__bar__) {
obj = obj.__bar__;
}
var mouseCoords = OfficeExcel.getMouseXY(e);
// This facilitates you being able to pass in the bar object as a parameter instead of
// the function getting it from the object
if (arguments[1]) {
obj = arguments[1];
}
/**
* Loop through the bars determining if the mouse is over a bar
*/
for (var i=0; i<obj.coords.length; i++) {
var mouseX = mouseCoords[0];
var mouseY = mouseCoords[1];
var left = obj.coords[i][0];
var top = obj.coords[i][1];
var width = obj.coords[i][2];
var height = obj.coords[i][3];
if ( mouseX >= left
&& mouseX <= left + width
&& mouseY >= top
&& mouseY <= top + height) {
return [obj, left, top, width, height, i];
}
}
return null;
}
/**
* When you click on the chart, this method can return the Y value at that point. It works for any point on the
* chart (that is inside the gutters) - not just points within the Bars.
......@@ -2001,11 +1733,6 @@
var xaxispos = this._otherProps._xaxispos;
var width = (this.canvas.width - this._chartGutter._left - this._chartGutter._right ) / this.data.length;
var hmargin = this._otherProps._hmargin;
var shadow = this._shadow._visible;
var shadowColor = this._shadow._color;
var shadowBlur = this._shadow._blur;
var shadowOffsetX = this._shadow._offset_x;
var shadowOffsetY = this._shadow._offset_y;
var strokeStyle = this._otherProps._strokecolor;
var colors = this._otherProps._colors;
var sequentialColorIndex = 0;
......@@ -2025,10 +1752,6 @@
{
this.context.strokeStyle = 'rgba(0,0,0,0)';
// Turn off any shadow
if (shadow) {
OfficeExcel.NoShadow(this);
}
startX = this.coords[i][0];
startY = this.coords[i][1];
individualBarWidth = this.coords[i][2];
......@@ -2062,14 +1785,6 @@
bold,
null,
textOptions);
// Turn any shadow back on
if (shadow) {
this.context.shadowColor = shadowColor;
this.context.shadowBlur = shadowBlur;
this.context.shadowOffsetX = shadowOffsetX;
this.context.shadowOffsetY = shadowOffsetY;
}
}
}
}
......
......@@ -23,49 +23,6 @@ OfficeExcel.Gutter = function()
this._bottom = 25;
}
OfficeExcel.Shadow = function()
{
this._visible = false;
this._offset_x = 2;
this._offset_y = 2;
this._blur = 3;
this._color = 'rgba(0,0,0,0.5)';
}
OfficeExcel.chartZoom = function()
{
this._factor = 1.5;
this._fade_in = true;
this._fade_out = true;
this._hdir = 'right';
this._vdir = 'down';
this._frames = 25;
this._delay = 16.666;
this._shadow = true;
this._mode = 'canvas';
this._thumbnail_width = 75;
this._thumbnail_height = 75;
this._thumbnail_fixed = false;
this._background = true;
this._action = 'zoom';
}
OfficeExcel.Tooltips = function()
{
this._tooltips = null;
this._effect = 'fade';
this._hotspot = 3;
this._css_class = 'OfficeExcel_tooltip';
this._highlight = true;
this._event = 'onmousemove'
this._override = null;
this._hotspot_xonly = false;
this._hotspot = 3;
this._coords_adjust = null;
}
OfficeExcel.OtherProps = function()
{
this._curvy = false;
......@@ -73,8 +30,6 @@ OfficeExcel.OtherProps = function()
this._noredraw = false;
this._chromefix = true;
this._adjustable = false;
this._xmin = 0;
......@@ -84,9 +39,6 @@ OfficeExcel.OtherProps = function()
this._outofbounds = false;
this._resizable = false;
this._total = true;
this._noaxes = false;
this._noxaxis = false;
this._noyaxis = false;
......@@ -108,64 +60,23 @@ OfficeExcel.OtherProps = function()
this._axis_color = 'black';
this._multiplier_x = 1;
this._multiplier_w = 1;
this._annotate_color = 'black';
this._annotatable = false;
this._units_pre = '';
this._units_post = '';
this._units_ingraph = false;
this._events_mousemove = null;
this._events_mousemove_revertto = null;
this._events_click = null;
this._events = [];
this._resize_handle_background = null;
this._crosshairs = false;
this._crosshairs_color = '#333';
this._crosshairs_hline = true;
this._crosshairs_vline = true;
this._crosshairs_linewidth = 1;
this._crosshairs_coords = false;
this._crosshairs_coords_fixed = true;
this._crosshairs_coords_fadeout = false;
this._crosshairs_coords_labels_x = 'X';
this._crosshairs_coords_labels_y = 'Y';
this._scale_round = false;
this._scale_decimals = 0;
this._scale_point = '.';
this._scale_thousand = ',';
this._scale_formatter = null;
this._highlight_stroke = 'black';
this._highlight_fill = 'rgba(255,255,255,0.5)';
this._highlight_style = 'explode';
this._highlight_style_2d_fill = 'rgba(255,255,255,0.5)';
this._highlight_style_2d_stroke = 'rgba(255,255,255,0)';
this._contextmenu = null;
this._contextmenu_bg = null;
this._contextmenu_submenu = null;
this._colors = ['rgb(0,0,255)', '#0f0', '#00f', '#ff0', '#0ff', '#0f0'];
this._colors_sequential = false;
this._colors_reverse = false;
this._colors_alternate = null;
this._colors_alpha = null;
this._colors_default = 'black';
this._title_yaxis_align = 'left';
this._title_yaxis_position = 'left';
this._title_left = '';
this._title_right = '';
this._gutter_center = 60;
this._radius = null;
......@@ -176,9 +87,8 @@ OfficeExcel.OtherProps = function()
this._centerx = null;
this._centery = null;
this._borders = true;
this._border = false;
this._area_border = true; // ãðàíèöà äëÿ âñåé îáëàñòè äèàãðàììû
this._area_border = true; // граница для всей области диаграммы
this._border_color = 'rgba(255,255,255,0.5)';
this._align = 'center';
......@@ -198,12 +108,6 @@ OfficeExcel.OtherProps = function()
this._ylabels_invert = false;
this._labels = [];
this._labels_offset = 0;
this._labels_offsetx = 10;
this._labels_offsety = 10;
this._labels_axes = '';
this._labels_position = 'center';
this._labels_align = 'bottom';
this._labels_ingraph = null;
this._labels_above = false;
this._labels_above_decimals = 0;
......@@ -212,7 +116,6 @@ OfficeExcel.OtherProps = function()
this._labels_sticks = false;
this._labels_sticks_length = 7;
this._labels_sticks_color = '#aaa';
this._labels_specific = null;
this._labels_specific_align = 'left';
this._background_barcolor1 = 'rgba(0,0,0,0)';
......@@ -231,12 +134,6 @@ OfficeExcel.OtherProps = function()
this._background_grid_autofit_align = false;
this._background_vbars = null;
this._background_hbars = null;
this._background_image = null;
this._background_image_x = null;
this._background_image_y = null;
this._background_image_stretch = true;
this._background_image_align = null;
this._background_circles = true;
this._line_visible = true;
......@@ -253,7 +150,6 @@ OfficeExcel.OtherProps = function()
this._smallxticks = 3;
this._largexticks = 5;
this._smallyticks = 3;
this._largeyticks = 5;
this._ticksize = 3;
this._tickdirection = -1;
......@@ -261,26 +157,18 @@ OfficeExcel.OtherProps = function()
this._tickmarks_linewidth = null;
this._tickmarks_dot_color = 'white';
this._resize_handle_adjust = [0,0];
this._key = [];
this._key_background = 'white';
this._key_position = 'graph';
this._key_position_x = null;
this._key_position_y = null;
this._key_position_gutter_boxed = true;
this._key_shadow = false;
this._key_shadow_color = '#666';
this._key_shadow_blur = 3;
this._key_shadow_offsetx = 2;
this._key_shadow_offsety = 2;
this._key_rounded = true;
this._key_linewidth = 1;
this._key_color_shape = 'square';
this._key_colors = null;
this._key_halign = 'right';
this._key_text_size = 10;
this._key_interactive = false;
this._noendxtick = false;
this._noendytick = true;
......@@ -293,13 +181,7 @@ OfficeExcel.OtherProps = function()
this._backdrop = false;
this._backdrop_size = 30;
this._backdrop_alpha = 0.2
this._animation_factor = 1;
this._animation_unfold_x = false;
this._animation_unfold_y = true;
this._animation_unfold_initial = 2;
this._animation_grow_factor = 1;
this._backdrop_alpha = 0.2;
this._grouping = 'grouped';
......@@ -310,10 +192,6 @@ OfficeExcel.OtherProps = function()
this._line = false;
this._line_linewidth = 1;
this._line_colors = ['green', 'red'];
this._line_shadow_color = 'rgba(0,0,0,0)';
this._line_shadow_offsetx = 3;
this._line_shadow_offsety = 3;
this._line_shadow_blur = 2;
this._line_stepped = false;
this._boxplot_width = 1;
......@@ -325,17 +203,5 @@ OfficeExcel.OtherProps = function()
this._xscale_numlabels = 10;
this._xscale_formatter = null;
this._xtickinterval = null;
this._margin = 2;
this._circle = 0;
this._circle_fill = 'red';
this._circle_stroke = 'black';
this._accumulative = false;
this._boxplot = false;
this._vbars = null;
}
\ No newline at end of file
 if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {isOfficeExcel:true,type:'common'};
OfficeExcel.Registry = {};
OfficeExcel.Registry.store = [];
OfficeExcel.Registry.store['chart.event.handlers'] = [];
OfficeExcel.background = {};
OfficeExcel.objects = [];
OfficeExcel.Resizing = {};
OfficeExcel.events = [];
......@@ -1456,19 +1452,6 @@
return obj != null && obj.constructor.toString().indexOf('Array') != -1;
}
/**
* Converts degrees to radians
*
* @param int degrees The number of degrees
* @return float The number of radians
*/
OfficeExcel.degrees2Radians = function (degrees)
{
return degrees * (Math.PI / 180);
}
/**
* This function draws an angled line. The angle is cosidered to be clockwise
*
......@@ -1973,8 +1956,6 @@
context.fill();
}
OfficeExcel.FireCustomEvent(canvas.__object__, 'onclear');
}
......@@ -2152,135 +2133,6 @@
}
/**
* Registers a graph object (used when the canvas is redrawn)
*
* @param object obj The object to be registered
*/
OfficeExcel.Register = function (obj)
{
var key = obj.id + '_' + obj.type;
OfficeExcel.objects[key] = obj;
}
/**
* Causes all registered objects to be redrawn
*
* @param string An optional string indicating which canvas is not to be redrawn
* @param string An optional color to use to clear the canvas
*/
OfficeExcel.Redraw = function ()
{
for (i in OfficeExcel.objects) {
// TODO FIXME Maybe include more intense checking for whether the object is an OfficeExcel object, eg obj.isOfficeExcel == true ...?
if (
typeof(i) == 'string'
&& typeof(OfficeExcel.objects[i]) == 'object'
&& typeof(OfficeExcel.objects[i].type) == 'string'
&& OfficeExcel.objects[i].isOfficeExcel) {
if (!arguments[0] || arguments[0] != OfficeExcel.objects[i].id) {
OfficeExcel.Clear(OfficeExcel.objects[i].canvas, arguments[1] ? arguments[1] : null);
OfficeExcel.objects[i].Draw();
}
}
}
}
/**
* Loosly mimicks the PHP function print_r();
*/
OfficeExcel.pr = function (obj)
{
var str = '';
var indent = (arguments[2] ? arguments[2] : '');
switch (typeof(obj)) {
case 'number':
if (indent == '') {
str+= 'Number: '
}
str += String(obj);
break;
case 'string':
if (indent == '') {
str+= 'String (' + obj.length + '):'
}
str += '"' + String(obj) + '"';
break;
case 'object':
// In case of null
if (obj == null) {
str += 'null';
break;
}
str += 'Object\n' + indent + '(\n';
for (var i in obj) {
if (typeof(i) == 'string' || typeof(i) == 'number') {
str += indent + ' ' + i + ' => ' + OfficeExcel.pr(obj[i], true, indent + ' ') + '\n';
}
}
var str = str + indent + ')';
break;
case 'function':
str += obj;
break;
case 'boolean':
str += 'Boolean: ' + (obj ? 'true' : 'false');
break;
}
/**
* Finished, now either return if we're in a recursed call, or alert()
* if we're not.
*/
if (arguments[1]) {
return str;
} else {
alert(str);
}
}
/**
* The OfficeExcel registry Set() function
*
* @param string name The name of the key
* @param mixed value The value to set
* @return mixed Returns the same value as you pass it
*/
OfficeExcel.Registry.Set = function (name, value)
{
// Store the setting
OfficeExcel.Registry.store[name] = value;
// Don't really need to do this, but ho-hum
return value;
}
/**
* The OfficeExcel registry Get() function
*
* @param string name The name of the particular setting to fetch
* @return mixed The value if exists, null otherwise
*/
OfficeExcel.Registry.Get = function (name)
{
//return OfficeExcel.Registry.store[name] == null ? null : OfficeExcel.Registry.store[name];
return OfficeExcel.Registry.store[name];
}
/**
* This function draws the background for the bar chart, line chart and scatter chart.
*
......@@ -2601,56 +2453,6 @@
}
/**
* Returns the day number for a particular date. Eg 1st February would be 32
*
* @param object obj A date object
* @return int The day number of the given date
*/
OfficeExcel.GetDays = function (obj)
{
var year = obj.getFullYear();
var days = obj.getDate();
var month = obj.getMonth();
if (month == 0) return days;
if (month >= 1) days += 31;
if (month >= 2) days += 28;
// Leap years. Crude, but if this code is still being used
// when it stops working, then you have my permission to shoot
// me. Oh, you won't be able to - I'll be dead...
if (year >= 2008 && year % 4 == 0) days += 1;
if (month >= 3) days += 31;
if (month >= 4) days += 30;
if (month >= 5) days += 31;
if (month >= 6) days += 30;
if (month >= 7) days += 31;
if (month >= 8) days += 31;
if (month >= 9) days += 30;
if (month >= 10) days += 31;
if (month >= 11) days += 30;
return days;
}
/**
* Debug short name functions
*/
function pd(variable) {OfficeExcel.pr(variable);}
function p(variable) {OfficeExcel.pr(variable);}
function a(variable) {alert(variable);}
/**
* A shortcut for console.log - as used by Firebug and Chromes console
*/
function cl (variable)
{
return console.log(variable);
}
// Makes a clone of an array
OfficeExcel.array_clone = function (obj)
{
......@@ -2918,11 +2720,6 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
}
}
/**
* Turn off any shadow
*/
OfficeExcel.NoShadow(obj);
if (labels_processed && labels_processed.length > 0) {
for (var i=0; i<labels_processed.length; ++i) {
......@@ -3051,217 +2848,6 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
}
/**
* This function "fills in" key missing properties that various implementations lack
*
* @param object e The event object
*/
OfficeExcel.FixEventObject = function (e)
{
if (OfficeExcel.isIE8()) {
var e = event;
e.pageX = (event.clientX + document.body.scrollLeft);
e.pageY = (event.clientY + document.body.scrollTop);
e.target = event.srcElement;
if (!document.body.scrollTop && document.documentElement.scrollTop) {
e.pageX += parseInt(document.documentElement.scrollLeft);
e.pageY += parseInt(document.documentElement.scrollTop);
}
}
// This is mainly for FF which doesn't provide offsetX
if (typeof(e.offsetX) == 'undefined' && typeof(e.offsetY) == 'undefined') {
var coords = OfficeExcel.getMouseXY(e);
e.offsetX = coords[0];
e.offsetY = coords[1];
}
// Any browser that doesn't implement stopPropagation() (MSIE)
if (!e.stopPropagation) {
e.stopPropagation = function () {window.event.cancelBubble = true;}
}
return e;
}
/**
* Draw crosshairs if enabled
*
* @param object obj The graph object (from which we can get the context and canvas as required)
*/
OfficeExcel.DrawCrosshairs = function (obj)//показывает позицию на графике
{
/*if (obj._otherProps._crosshairs) {
var canvas = obj.canvas;
var context = obj.context;
var crosshairs_mousemove = function (e)
{
var e = OfficeExcel.FixEventObject(e);
var canvas = obj.canvas;
var context = obj.context;
var width = canvas.width;
var height = canvas.height;
var adjustments = obj._tooltip._coords_adjust;
var gutterLeft = obj._chartGutter._left;
var gutterRight = obj._chartGutter._right;
var gutterTop = obj._chartGutter._top;
var gutterBottom = obj._chartGutter._bottom;
var mouseCoords = OfficeExcel.getMouseXY(e);
var x = mouseCoords[0];
var y = mouseCoords[1];
if (typeof(adjustments) == 'object' && adjustments[0] && adjustments[1]) {
x = x - adjustments[0];
y = y - adjustments[1];
}
OfficeExcel.Clear(canvas);
obj.Draw();
if ( x >= gutterLeft
&& y >= gutterTop
&& x <= (width - gutterRight)
&& y <= (height - gutterBottom)
) {
var linewidth = obj._otherProps._crosshairs_linewidth;
context.lineWidth = linewidth ? linewidth : 1;
context.beginPath();
context.strokeStyle = obj._otherProps._crosshairs_color;
// Draw a top vertical line
if (obj._otherProps._crosshairs_vline) {
context.moveTo(AA(this, x), AA(this, gutterTop));
context.lineTo(AA(this, x), AA(this, height - gutterBottom));
}
// Draw a horizontal line
if (obj._otherProps._crosshairs_hline) {
context.moveTo(AA(this, gutterLeft), AA(this, y));
context.lineTo(AA(this, width - gutterRight), AA(this, y));
}
context.stroke();
//Need to show the coords? if (obj._otherProps._crosshairs_coords) {
if (obj.type == 'scatter') {
var xCoord = (((x - obj._chartGutter._left) / (obj.canvas.width - gutterLeft - gutterRight)) * (obj._otherProps._xmax - obj._otherProps._xmin)) + obj._otherProps._xmin;
xCoord = xCoord.toFixed(obj._otherProps._scale_decimals);
var yCoord = obj.max - (((y - obj._chartGutter._top) / (obj.canvas.height - gutterTop - gutterBottom)) * obj.max);
if (obj.type == 'scatter' && obj._otherProps._xaxispos == 'center') {
yCoord = (yCoord - (obj.max / 2)) * 2;
}
yCoord = yCoord.toFixed(obj._otherProps._scale_decimals);
var div = OfficeExcelExcel.Registry.Get('chart.coordinates.coords.div');
var mouseCoords = OfficeExcel.getMouseXY(e);
var canvasXY = OfficeExcel.getCanvasXY(canvas);
if (!div) {
div = document.createElement('DIV');
div.__object__ = obj;
div.style.position = 'absolute';
div.style.backgroundColor = 'white';
div.style.border = '1px solid black';
div.style.fontFamily = 'Arial, Verdana, sans-serif';
div.style.fontSize = '10pt'
div.style.padding = '2px';
div.style.opacity = 1;
div.style.WebkitBorderRadius = '3px';
div.style.borderRadius = '3px';
div.style.MozBorderRadius = '3px';
document.body.appendChild(div);
OfficeExcel.Registry.Set('chart.coordinates.coords.div', div);
}
// Convert the X/Y pixel coords to correspond to the scale
div.style.opacity = 1;
div.style.display = 'inline';
if (!obj._otherProps._crosshairs_coords_fixed) {
div.style.left = Math.max(2, (e.pageX - div.offsetWidth - 3)) + 'px';
div.style.top = Math.max(2, (e.pageY - div.offsetHeight - 3)) + 'px';
} else {
div.style.left = canvasXY[0] + gutterLeft + 3 + 'px';
div.style.top = canvasXY[1] + gutterTop + 3 + 'px';
}
div.innerHTML = '<span style="color: #666">' + obj._otherProps._crosshairs_coords_labels_x + ':</span> ' + xCoord + '<br><span style="color: #666">' + obj._otherProps._crosshairs_coords_labels_y + ':</span> ' + yCoord;
canvas.addEventListener('mouseout', OfficeExcel.HideCrosshairCoords, false);
obj.canvas.__crosshairs_labels__ = div;
obj.canvas.__crosshairs_x__ = xCoord;
obj.canvas.__crosshairs_y__ = yCoord;
} else {
alert('[OfficeExcel] Showing crosshair coordinates is only supported on the Scatter chart');
}
}
//Fire the oncrosshairs custom event OfficeExcel.FireCustomEvent(obj, 'oncrosshairs');
} else {
OfficeExcel.HideCrosshairCoords();
}
}
canvas.addEventListener('mousemove', crosshairs_mousemove, false);
OfficeExcel.AddEventListener(obj.id, 'mousemove', crosshairs_mousemove);
}*/
}
/**
* Thisz function hides the crosshairs coordinates
*/
OfficeExcel.HideCrosshairCoords = function ()
{
/*var div = OfficeExcel.Registry.Get('chart.coordinates.coords.div');
if ( div
&& div.style.opacity == 1
&& div.__object__._otherProps._crosshairs_coords_fadeout
) {
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.9;}, 50);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.8;}, 100);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.7;}, 150);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.6;}, 200);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.5;}, 250);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.4;}, 300);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.3;}, 350);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.2;}, 400);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.1;}, 450);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.opacity = 0;}, 500);
setTimeout(function() {OfficeExcel.Registry.Get('chart.coordinates.coords.div').style.display = 'none';}, 550);
}*/
}
/**
* Trims the right hand side of a string. Removes SPACE, TAB
* CR and LF.
*
* @param string str The string to trim
*/
OfficeExcel.rtrim = function (str)
{
return str.replace(/( |\n|\r|\t)+$/, '');
}
/**
* Draws the3D axes/background
*/
......@@ -3301,33 +2887,6 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
context.fill();
}
// Turns off any shadow
OfficeExcel.NoShadow = function (obj)
{
obj.context.shadowColor = 'rgba(0,0,0,0)';
obj.context.shadowBlur = 0;
obj.context.shadowOffsetX = 0;
obj.context.shadowOffsetY = 0;
}
/**
* Sets the four shadow properties - a shortcut function
*
* @param object obj Your graph object
* @param string color The shadow color
* @param number offsetx The shadows X offset
* @param number offsety The shadows Y offset
* @param number blur The blurring effect applied to the shadow
*/
OfficeExcel.SetShadow = function (obj, color, offsetx, offsety, blur)
{
obj.context.shadowColor = color;
obj.context.shadowOffsetX = offsetx;
obj.context.shadowOffsetY = offsety;
obj.context.shadowBlur = blur;
}
// Compatibility canvas browser
OfficeExcel.CanvasBrowserCompat = function (context)
{
......@@ -3378,39 +2937,6 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
}
}
/**
* This is a function that can be used to run code asynchronously, which can
* be used to speed up the loading of you pages.
*
* @param string func This is the code to run. It can also be a function pointer.
* The front page graphs show this function in action. Basically
* each graphs code is made in a function, and that function is
* passed to this function to run asychronously.
*/
OfficeExcel.Async = function (func)
{
//return setTimeout(func, arguments[1] ? arguments[1] : 1);
}
/**
* A custom random number function
*
* @param number min The minimum that the number should be
* @param number max The maximum that the number should be
* @param number How many decimal places there should be. Default for this is 0
*/
OfficeExcel.random = function (min, max)
{
var dp = arguments[2] ? arguments[2] : 0;
var r = Math.random();
return Number((((max - min) * r) + min).toFixed(dp));
}
OfficeExcel.degrees2Radians=function(degrees){return degrees*(PI/180);}
/**
* Draws a rectangle with curvy corners
*
......@@ -3548,111 +3074,6 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
context.fill();
}
/**
* A crude timing function
*
* @param string label The label to use for the time
*/
OfficeExcel.Timer = function (label)
{
var d = new Date();
// This uses the Firebug console
console.log(label + ': ' + d.getSeconds() + '.' + d.getMilliseconds());
}
/**
* Hides the palette if it's visible
*/
OfficeExcel.HidePalette = function ()
{
var div = OfficeExcel.Registry.Get('palette');
if (typeof(div) == 'object' && div) {
div.style.visibility = 'hidden';
div.style.display = 'none';
OfficeExcel.Registry.Set('palette', null);
}
}
/**
* Hides the zoomed canvas
*/
OfficeExcel.HideZoomedCanvas = function ()
{
/*var interval = 15;
var frames = 10;
if (typeof(__zoomedimage__) == 'object') {
obj = __zoomedimage__.obj;
} else {
return;
}
if (obj._zoom._fade_out) {
for (var i=frames,j=1; i>=0; --i, ++j) {
if (typeof(__zoomedimage__) == 'object') {
setTimeout("__zoomedimage__.style.opacity = " + String(i / 10), j * interval);
}
}
if (typeof(__zoomedbackground__) == 'object') {
setTimeout("__zoomedbackground__.style.opacity = " + String(i / frames), j * interval);
}
}
if (typeof(__zoomedimage__) == 'object') {
setTimeout("__zoomedimage__.style.display = 'none'", obj._zoom._fade_out ? (frames * interval) + 10 : 0);
}
if (typeof(__zoomedbackground__) == 'object') {
setTimeout("__zoomedbackground__.style.display = 'none'", obj._zoom._fade_out ? (frames * interval) + 10 : 0);
}*/
}
/**
* Adds an event handler
*
* @param object obj The graph object
* @param string event The name of the event, eg ontooltip
* @param object func The callback function
*/
OfficeExcel.AddCustomEventListener = function (obj, name, func)
{
if (typeof(OfficeExcel.events[obj.id]) == 'undefined') {
OfficeExcel.events[obj.id] = [];
}
OfficeExcel.events[obj.id].push([obj, name, func]);
return OfficeExcel.events[obj.id].length - 1;
}
// Fire events
OfficeExcel.FireCustomEvent = function (obj, name)
{
if (obj && obj.isOfficeExcel) {
var id = obj.id;
if ( typeof(id) == 'string'
&& typeof(OfficeExcel.events) == 'object'
&& typeof(OfficeExcel.events[id]) == 'object'
&& OfficeExcel.events[id].length > 0) {
for(var j=0; j<OfficeExcel.events[id].length; ++j) {
if (OfficeExcel.events[id][j] && OfficeExcel.events[id][j][1] == name) {
OfficeExcel.events[id][j][2](obj);
}
}
}
}
}
// Checks the browser for traces of MSIE8
OfficeExcel.isIE8 = function ()
{
......@@ -3663,11 +3084,6 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
{
return navigator.userAgent.indexOf('MSIE 7') > 0;
}
// Checks the browser for traces of MSIE9
OfficeExcel.isIE9 = function ()
{
return navigator.userAgent.indexOf('MSIE 9') > 0;
}
// Checks the browser for traces of MSIE9
OfficeExcel.isOld = function ()
......@@ -3675,76 +3091,6 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
return OfficeExcel.isIE7() || OfficeExcel.isIE8();
}
// Checks the browser for traces of MSIE9
OfficeExcel.isIE9up = function ()
{
navigator.userAgent.match(/MSIE (\d+)/);
return Number(RegExp.$1) >= 9;
}
//Clear all Listeners
OfficeExcel.ClearEventListeners = function (id)
{
for (var i = 0; i < OfficeExcel.Registry.Get('chart.event.handlers').length; ++i) {
var el = OfficeExcel.Registry.Get('chart.event.handlers')[i];
if (el && (el[0] == id || el[0] == ('window_' + id))) {
if (el[0].substring(0, 7) == 'window_')
window.removeEventListener(el[1], el[2], false);
else {
if (document.getElementById(id)) {
document.getElementById(id).removeEventListener(el[1], el[2], false);
}
}
OfficeExcel.Registry.Get('chart.event.handlers')[i] = null;
}
}
}
/**
*
*/
OfficeExcel.AddEventListener = function (id, e, func)
{
var type = arguments[3] ? arguments[3] : 'unknown';
OfficeExcel.Registry.Get('chart.event.handlers').push([id, e, func, type]);
}
/**
* This function suggests a gutter size based on the widest left label. Given that the bottom
* labels may be longer, this may be a little out.
*
* @param object obj The graph object
* @param array data An array of graph data
* @return int A suggested gutter setting
*/
OfficeExcel.getGutterSuggest = function (obj, data)
{
var str = OfficeExcel.number_format(obj, OfficeExcel.array_max(OfficeExcel.getScale(OfficeExcel.array_max(data), obj)), obj._otherProps._units_pre, obj._otherProps._units_post);
// Take into account the HBar
if (obj.type == 'hbar') {
var str = '';
var len = 0;
for (var i=0; i<obj._otherProps._labels.length; ++i) {
str = (obj._otherProps._labels.length > str.length ? obj._otherProps._labels[i] : str);
}
}
obj.context.font = obj._otherProps._text_size + 'pt ' + obj._otherProps._text_font;
len = obj.context.measureText(str).width + 5;
return (obj.type == 'hbar' ? len / 3 : len);
}
/**
* A basic Array shift gunction
......@@ -3761,157 +3107,12 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
return ret;
}
/**
* If you prefer, you can use the SetConfig() method to set the configuration information
* for your chart. You may find that setting the configuration this way eases reuse.
*
* @param object obj The graph object
* @param object config The graph configuration information
*/
OfficeExcel.SetConfig = function (obj, c)
{
for (i in c) {
if (typeof(i) == 'string') {
obj.Set(i, c[i]);
}
}
return obj;
}
/**
* These are older functions that were used before the move to seperate gutter settings
*/
OfficeExcel.GetHeight=function(obj){return obj.canvas.height;}
OfficeExcel.GetWidth=function(obj){return obj.canvas.width;}
/**
* Clears all the custom event listeners that have been registered
*
* @param string Limits the clearing to this object ID
*/
OfficeExcel.RemoveAllCustomEventListeners = function ()
{
var id = arguments[0];
if (id && OfficeExcel.events[id]) {
OfficeExcel.events[id] = [];
} else {
OfficeExcel.events = [];
}
}
/**
* Clears a particular custom event listener
*
* @param object obj The graph object
* @param number i This is the index that is return by .AddCustomEventListener()
*/
OfficeExcel.RemoveCustomEventListener = function (obj, i)
{
if ( typeof(OfficeExcel.events) == 'object'
&& typeof(OfficeExcel.events[obj.id]) == 'object'
&& typeof(OfficeExcel.events[obj.id][i]) == 'object') {
OfficeExcel.events[obj.id][i] = null;
}
}
OfficeExcel.DrawBackgroundImage1 = function (obj)
{
var img = new Image();
img.__object__ = obj;
img.__canvas__ = obj.canvas;
img.__context__ = obj.context;
img.src = obj._otherProps._background_image;
img.onload = function ()
{
var obj = this.__object__;
obj.context.drawImage(this, 0, 0, obj.canvas.width, obj.canvas.height);
obj.__background_image__ = true;
obj.Draw();
}
}
// Draw the background
OfficeExcel.DrawBackgroundImage = function (obj)
{
var img = new Image();
img.__object__ = obj;
img.__canvas__ = obj.canvas;
img.__context__ = obj.context;
img.src = obj._otherProps._background_image;
obj.__background_image__ = img;
img.onload = function ()
{
var obj = this.__object__;
var gutterLeft = obj._chartGutter._left;
var gutterRight = obj._chartGutter._right;
var gutterTop = obj._chartGutter._top;
var gutterBottom = obj._chartGutter._bottom;
var stretch = obj._otherProps._background_image_stretch;
var align = obj._otherProps._background_image_align;
var x;
var y;
if (typeof(align) == 'string') {
if (align.indexOf('right') != -1)
x = obj.canvas.width - this.width - gutterRight;
else
x = gutterLeft;
if (align.indexOf('bottom') != -1)
y = obj.canvas.height - this.height - gutterBottom;
else
y = gutterTop;
} else {
x = gutterLeft;
y = gutterTop;
}
// X/Y coords take precedence over the align
x = typeof(obj._otherProps._background_image_x) == 'number' ? obj._otherProps._background_image_x : x;
y = typeof(obj._otherProps._background_image_y) == 'number' ? obj._otherProps._background_image_y : y;
var w = stretch ? obj.canvas.width - gutterLeft - gutterRight : this.width;
var h = stretch ? obj.canvas.height - gutterTop - gutterBottom : this.height;
OfficeExcel.Clear(obj.canvas);
obj.context.drawImage(this, x, y, w, h);
// Draw the graph
obj.Draw();
}
img.onerror = function ()
{
var obj = this.__canvas__.__object__;
// Show an error alert
alert('[ERROR] There was an error with the background image that you specified: ' + img.src);
// Draw the graph, because the onload doesn't fire
obj.Draw();
}
}
/**
* This resets the canvas. Keep in mind that any translate() that has been performed will also be reset.
*
......@@ -3933,70 +3134,20 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
return (newvalue - value) >= 0 ? newvalue : Math.floor(value);
}
OfficeExcel.InstallUserClickListener = function (obj, func)
{
if (typeof(func) == 'function') {
function UserClickListener (e)
{
var obj = e.target.__object__;
var shape = obj.getShape(e);
if (shape) {
func(e, shape);
}
}
obj.canvas.addEventListener('click', UserClickListener, false);
OfficeExcel.AddEventListener(obj.id, 'click', UserClickListener);
}
}
OfficeExcel.InstallUserMousemoveListener = function (obj, func)
{
if (typeof(func) == 'function') {
function UserMousemoveHandler (e)
{
var obj = e.target.__object__;
var shape = obj.getShape(e);
/**
* This bit saves the current pointer style if there isn't one already saved
*/
if (shape && typeof(func) == 'function') {
if (obj._otherProps._events_mousemove_revertto == null) {
obj._otherProps._events_mousemove_revertto = e.target.style.cursor;
}
func(e, shape)
} else if (typeof(obj._otherProps._events_mousemove_revertto) == 'string') {
e.target.style.cursor = obj._otherProps._events_mousemove_revertto;
obj._otherProps._events_mousemove_revertto = null;
}
}
obj.canvas.addEventListener('mousemove', UserMousemoveHandler, false);
OfficeExcel.AddEventListener(obj.id, 'mousemove', UserMousemoveHandler);
}
}
OfficeExcel.background.DrawArea = function (obj)
{
// Don't draw the axes?
if (obj._otherProps._noaxes)
return;
// Turn any shadow off
OfficeExcel.NoShadow(obj);
obj.context.lineWidth = 1;
obj.context.lineCap = 'butt';
obj.context.strokeStyle = obj._otherProps._axis_color;
obj.context.fillStyle = 'yellow';
obj.context.beginPath();
if (typeof(obj._otherProps._background_image) == 'string')
obj.context.fillStyle = "inherit";
else
obj.context.fillStyle = obj._otherProps._background_image_color;
obj.context.fillRect(0,0,obj.canvas.width,obj.canvas.height)
obj.context.fillStyle = obj._otherProps._background_image_color;
obj.context.fillRect(0,0,obj.canvas.width,obj.canvas.height);
// border
if ( !g_bChartPreview && obj._otherProps._area_border ) {
......
......@@ -46,10 +46,6 @@
}
}
/**
* This does the actual drawing of the key when it's in the graph
*
......@@ -86,7 +82,6 @@
var sizeLine = 26*scale;
if(bar._otherProps._key_color_shape != 'line')
sizeLine = 8*scale;
obj.coordsKey = [];
// Need to set this so that measuring the text works out OK
......@@ -207,18 +202,6 @@
vpos = obj._otherProps._key_position_y;
}
// Stipulate the shadow for the key box
if (obj._otherProps._key_shadow) {
context.shadowColor = obj._otherProps._key_shadow_color;
context.shadowBlur = obj._otherProps._key_shadow_blur;
context.shadowOffsetX = obj._otherProps._key_shadow_offsetx;
context.shadowOffsetY = obj._otherProps._key_shadow_offsety;
}
// Draw the box that the key resides in
context.beginPath();
context.fillStyle = obj._otherProps._key_background;
......@@ -239,9 +222,6 @@
context.stroke();
context.fill();
OfficeExcel.NoShadow(obj);
}
else if(null != obj._otherProps._key_rounded) {
context.strokeRect(AA(this, hpos), AA(this, vpos), width - 5, 5 + ( (text_size + 5) * OfficeExcel.getKeyLength(key)));
......@@ -249,8 +229,6 @@
}
}
OfficeExcel.NoShadow(obj);
context.beginPath();
/**
......@@ -275,7 +253,7 @@
if(obj._otherProps._key_levels)
levels = obj._otherProps._key_levels;
var gVpos = vpos;
// ,
//если не умещается легенда, делаем её в несколько строк
if(levels && levels.length)
{
......@@ -421,306 +399,10 @@
key[i]);
}
}
if (obj._otherProps._key_interactive) {
var px = hpos + 5;
var py = vpos + (5 * j) + (text_size * j) - text_size;
var pw = width - 5 - 5 - 5;
var ph = text_size;
obj.coordsKey.push([px, py, pw, ph]);
}
context.fill();
/**
* Install the interactivity event handler
*/
if (obj._otherProps._key_interactive) {
OfficeExcel.Register(obj);
var key_mousemove = function (e)
{
var obj = e.target.__object__;
var canvas = obj.canvas;
var context = obj.context;
var mouseCoords = OfficeExcel.getMouseXY(e);
var mouseX = mouseCoords[0];
var mouseY = mouseCoords[1];
for (var i=0; i<obj.coordsKey.length; ++i) {
var px = obj.coordsKey[i][0];
var py = obj.coordsKey[i][1];
var pw = obj.coordsKey[i][2];
var ph = obj.coordsKey[i][3];
if ( mouseX > (px-2) && mouseX < (px + pw + 2) && mouseY > (py - 2) && mouseY < (py + ph + 2) ) {
// Necessary?
//var index = obj.coordsKey.length - i - 1;
canvas.style.cursor = 'pointer';
return;
}
canvas.style.cursor = 'default';
if (typeof(obj._tooltip._tooltips) == 'object' && typeof(canvas_onmousemove_func) == 'function') {
canvas_onmousemove_func(e);
}
}
}
canvas.addEventListener('mousemove', key_mousemove, false);
OfficeExcel.AddEventListener(canvas.id, 'mousemove', key_mousemove);
var key_click = function (e)
{
OfficeExcel.Redraw();
var obj = e.target.__object__;
var canvas = obj.canvas;
var context = obj.context;
var mouseCoords = OfficeExcel.getMouseXY(e);
var mouseX = mouseCoords[0];
var mouseY = mouseCoords[1];
/**
* Hand over highlighting the pie chart key to another function
*/
if (obj.type == 'pie') {
return key_onclick_pie(e);
}
OfficeExcel.DrawKey(obj, obj._otherProps._key, obj._otherProps._colors);
for (var i=0; i<obj.coordsKey.length; ++i) {
var px = obj.coordsKey[i][0];
var py = obj.coordsKey[i][1];
var pw = obj.coordsKey[i][2];
var ph = obj.coordsKey[i][3];
if ( mouseX > px && mouseX < (px + pw) && mouseY > py && mouseY < (py + ph) ) {
/**
* Loop thru all objects. If they're objects with
* key_interactive enabled, redraw them
*/
for (j in OfficeExcel.objects) {
if (OfficeExcel.objects[j] && OfficeExcel.objects[j].Get && OfficeExcel.objects[j]._otherProps._key_interactive) {
if (OfficeExcel.objects[j]._otherProps._exploded) {
OfficeExcel.objects[j]._otherProps._exploded = [];
}
OfficeExcel.Clear(OfficeExcel.objects[j].canvas);
OfficeExcel.objects[j].Draw();
}
}
var index = obj.coordsKey.length - i - 1;
// HIGHLIGHT THE LINE HERE
context.beginPath();
context.fillStyle = 'rgba(255,255,255,0.9)';
context.fillRect(AA(obj, obj._chartGutter._left),AA(obj, obj._chartGutter._top),canvas.width - obj._chartGutter._left - obj._chartGutter._right,canvas.height - obj._chartGutter._top - obj._chartGutter._bottom);
context.fill();
context.beginPath();
context.strokeStyle = obj._otherProps._colors[index];
context.lineWidth = obj._otherProps._linewidth;
if (obj.coords2 &&obj.coords2[index] &&obj.coords2[index].length) {
for (var j=0; j<obj.coords2[index].length; ++j) {
var x = obj.coords2[index][j][0];
var y = obj.coords2[index][j][1];
if (j == 0) {
context.moveTo(x, y);
} else {
context.lineTo(x, y);
}
}
}
context.stroke();
context.lineWidth = 1;
context.beginPath();
context.strokeStyle = 'black';
context.fillStyle = 'white';
OfficeExcel.SetShadow(obj, 'rgba(0,0,0,0.5)', 0,0,10);
context.strokeRect(px - 2, py - 2, pw + 4, ph + 4);
context.fillRect(px - 2, py - 2, pw + 4, ph + 4);
context.stroke();
context.fill();
OfficeExcel.NoShadow(obj);
context.beginPath();
context.fillStyle = obj._otherProps._colors[index];
context.fillRect(px, py, blob_size, blob_size);
context.fill();
context.beginPath();
context.fillStyle = obj._otherProps._text_color;
OfficeExcel.Text(context,
obj._otherProps._text_font,
obj._otherProps._text_size,
px + 5 + blob_size,
py + ph,
obj._otherProps._key[obj._otherProps._key.length - i - 1]
);
context.fill();
canvas.style.cursor = 'pointer';
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
}
canvas.style.cursor = 'default';
}
}
canvas.addEventListener('click', key_click, false);
OfficeExcel.AddEventListener(canvas.id, 'click', key_click);
/**
* This function handles the Pie chart interactive key (the click event)
*
* @param object e The event object
*/
var key_onclick_pie = function (e)
{
var canvas = e.target;
var context = canvas.getContext('2d');
var obj = e.target.__object__;
var mouseCoords = OfficeExcel.getMouseXY(e);
var mouseX = mouseCoords[0];
var mouseY = mouseCoords[1];
//OfficeExcel.DrawKey(obj, obj._otherProps._key, obj._otherProps._colors);
for (var i=0; i<obj.coordsKey.length; ++i) {
var px = obj.coordsKey[i][0];
var py = obj.coordsKey[i][1];
var pw = obj.coordsKey[i][2];
var ph = obj.coordsKey[i][3];
if ( mouseX > (px - 2) && mouseX < (px + pw + 2) && mouseY > (py - 2) && mouseY < (py + ph + 2) ) {
var index = obj.coordsKey.length - i - 1;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
// ==========================================================================
var highlight_key = function ()
{
context.lineWidth = 1;
context.beginPath();
context.strokeStyle = 'black';
context.fillStyle = 'white';
OfficeExcel.SetShadow(obj, 'rgba(0,0,0,0.5)', 0,0,10);
context.strokeRect(px - 2, py - 2, pw + 4, ph + 4);
context.fillRect(px - 2, py - 2, pw + 4, ph + 4);
context.stroke();
context.fill();
OfficeExcel.NoShadow(obj);
context.beginPath();
context.fillStyle = obj._otherProps._colors[index];
context.fillRect(px, py, blob_size, blob_size);
context.fill();
context.beginPath();
context.fillStyle = obj._otherProps._text_color;
OfficeExcel.Text(context,
obj._otherProps._text_font,
obj._otherProps._text_size,
px + 5 + blob_size,
py + ph,
obj._otherProps._key[obj._otherProps._key.length - i - 1]
);
context.fill();
}
// ==========================================================================
setTimeout(function (){obj._otherProps._exploded[index] = 2;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 20);
setTimeout(function (){obj._otherProps._exploded[index] = 4;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 40);
setTimeout(function (){obj._otherProps._exploded[index] = 6;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 60);
setTimeout(function (){obj._otherProps._exploded[index] = 8;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 80);
setTimeout(function (){obj._otherProps._exploded[index] = 10;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 100);
setTimeout(function (){obj._otherProps._exploded[index] = 12;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 120);
setTimeout(function (){obj._otherProps._exploded[index] = 14;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 140);
setTimeout(function (){obj._otherProps._exploded[index] = 16;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 160);
setTimeout(function (){obj._otherProps._exploded[index] = 18;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 180);
setTimeout(function (){obj._otherProps._exploded[index] = 20;OfficeExcel.Clear(obj.canvas);obj.Draw();highlight_key();}, 200);
/**
* This is here so that when calling the Redraw function the Pie chart
* is drawn unexploded
*/
setTimeout(function (){obj._otherProps._exploded[index] = 0;}, 250);
return;
} else {
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
}
}
OfficeExcel.Clear(obj.canvas);
obj.Draw();
}
/**
* The window onclick for the pie chart
*/
var key_interactive_click = function (e)
{
if (obj && obj.type == 'pie') {
obj._otherProps._exploded = [];
}
OfficeExcel.Clear(obj.canvas);
obj.Draw();
}
window.addEventListener('click', key_interactive_click, false);
OfficeExcel.AddEventListener('window_' + canvas.id, 'click', key_interactive_click);
}
}
/**
* This does the actual drawing of the key when it's in the gutter
*
......@@ -807,14 +489,6 @@
*/
if (obj._otherProps._key_position_gutter_boxed) {
if (obj._otherProps._key_shadow) {
context.shadowColor = obj._otherProps._key_shadow_color;
context.shadowBlur = obj._otherProps._key_shadow_blur;
context.shadowOffsetX = obj._otherProps._key_shadow_offsetx;
context.shadowOffsetY = obj._otherProps._key_shadow_offsety;
}
context.beginPath();
context.fillStyle = fillstyle;
context.strokeStyle = strokestyle;
......@@ -829,9 +503,6 @@
context.stroke();
context.fill();
OfficeExcel.NoShadow(obj);
}
......@@ -886,7 +557,6 @@
}
}
/**
* Returns the key length, but accounts for null values
*
......
if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {isOfficeExcel:true,type:'common'};
/**
* This is used in two functions, hence it's here
*/
OfficeExcel.tooltips = {};
OfficeExcel.tooltips.padding = '3px';
OfficeExcel.tooltips.font_face = 'Tahoma';
OfficeExcel.tooltips.font_size = '10pt';
/**
* Shows a tooltip next to the mouse pointer
*
* @param canvas object The canvas element object
* @param text string The tooltip text
* @param int x The X position that the tooltip should appear at. Combined with the canvases offsetLeft
* gives the absolute X position
* @param int y The Y position the tooltip should appear at. Combined with the canvases offsetTop
* gives the absolute Y position
* @param int idx The index of the tooltip in the graph objects tooltip array
*/
OfficeExcel.Tooltip = function (canvas, text, x, y, idx)
{
//chart.tooltip.override allows you to totally take control of rendering the tooltip yourself
/*if (typeof(canvas.__object__._tooltip._override) == 'function') {
return canvas.__object__._tooltip._override(canvas, text, x, y, idx);
}
//This facilitates the "id:xxx" format
text = OfficeExcel.getTooltipTextFromDIV(text);
//First clear any exising timers
var timers = OfficeExcel.Registry.Get('chart.tooltip.timers');
if (timers && timers.length) {
for (i=0; i<timers.length; ++i) {
clearTimeout(timers[i]);
}
}
OfficeExcel.Registry.Set('chart.tooltip.timers', []);
//Hide the context menu if it's currently shown
if (canvas.__object__._otherProps._contextmenu) {
OfficeExcel.HideContext();
}
// Redraw the canvas?
if (canvas.__object__._tooltip._highlight) {
OfficeExcel.Redraw(canvas.id);
}
var effect = canvas.__object__._tooltip._effect.toLowerCase();
if (effect == 'snap' && OfficeExcel.Registry.Get('chart.tooltip') && OfficeExcel.Registry.Get('chart.tooltip').__canvas__.id == canvas.id) {
if ( canvas.__object__.type == 'line'
|| canvas.__object__.type == 'radar'
|| canvas.__object__.type == 'scatter'
|| canvas.__object__.type == 'rscatter'
) {
var tooltipObj = OfficeExcel.Registry.Get('chart.tooltip');
tooltipObj.style.width = null;
tooltipObj.style.height = null;
tooltipObj.innerHTML = text;
tooltipObj.__text__ = text;
//Now that the new content has been set, re-set the width & height
OfficeExcel.Registry.Get('chart.tooltip').style.width = OfficeExcel.getTooltipWidth(text, canvas.__object__) + 'px';
OfficeExcel.Registry.Get('chart.tooltip').style.height = OfficeExcel.Registry.Get('chart.tooltip').offsetHeight + 'px';
// Now (25th September 2011) use jQuery if it's available
if (typeof(jQuery) == 'function' && typeof($) == 'function') {
$('#' + tooltipObj.id).animate({
opacity: 1,
width: tooltipObj.offsetWidth + 'px',
height: tooltipObj.offsetHeight + 'px',
left: x + 'px',
top: (y - tooltipObj.offsetHeight) + 'px'
}, 300);
} else {
var currentx = parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left);
var currenty = parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top);
var diffx = x - currentx - ((x + OfficeExcel.Registry.Get('chart.tooltip').offsetWidth) > document.body.offsetWidth ? OfficeExcel.Registry.Get('chart.tooltip').offsetWidth : 0);
var diffy = y - currenty - OfficeExcel.Registry.Get('chart.tooltip').offsetHeight;
// Position the tooltip
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 0.2)) + 'px"', 25);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 0.4)) + 'px"', 50);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 0.6)) + 'px"', 75);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 0.8)) + 'px"', 100);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 1.0)) + 'px"', 125);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 0.2)) + 'px"', 25);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 0.4)) + 'px"', 50);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 0.6)) + 'px"', 75);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 0.8)) + 'px"', 100);
setTimeout('OfficeExcel.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 1.0)) + 'px"', 125);
}
} else {
alert('[TOOLTIPS] The "snap" effect is only supported on the Line, Rscatter, Scatter and Radar charts (tried to use it with type: ' + canvas.__object__.type);
}
//Fire the tooltip event
OfficeExcel.FireCustomEvent(canvas.__object__, 'ontooltip');
return;
}
//Hide any currently shown tooltip
OfficeExcel.HideTooltip();
//Show a tool tip
var tooltipObj = document.createElement('DIV');
tooltipObj.className = canvas.__object__._tooltip._css_class;
tooltipObj.style.display = 'none';
tooltipObj.style.position = 'absolute';
tooltipObj.style.left = 0;
tooltipObj.style.top = 0;
tooltipObj.style.backgroundColor = 'rgba(255,255,239,0.9)';
tooltipObj.style.color = 'black';
if (!document.all) tooltipObj.style.border = '';
tooltipObj.style.visibility = 'visible';
tooltipObj.style.paddingLeft = OfficeExcel.tooltips.padding;
tooltipObj.style.paddingRight = OfficeExcel.tooltips.padding;
tooltipObj.style.fontFamily = OfficeExcel.tooltips.font_face;
tooltipObj.style.fontSize = OfficeExcel.tooltips.font_size;
tooltipObj.style.zIndex = 3;
tooltipObj.style.borderRadius = '5px';
tooltipObj.style.MozBorderRadius = '5px';
tooltipObj.style.WebkitBorderRadius = '5px';
tooltipObj.style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 0 0 15px';
tooltipObj.style.MozBoxShadow = 'rgba(96,96,96,0.5) 0 0 15px';
tooltipObj.style.boxShadow = 'rgba(96,96,96,0.5) 0 0 15px';
tooltipObj.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135)';
tooltipObj.style.opacity = 0;
tooltipObj.style.overflow = 'hidden';
tooltipObj.innerHTML = text;
tooltipObj.__text__ = text; // This is set because the innerHTML can change when it's set
tooltipObj.__canvas__ = canvas;
tooltipObj.style.display = 'inline';
tooltipObj.id = '__OfficeExcel_tooltip_' + canvas.id + '_' + idx;
if (typeof(idx) == 'number') {
tooltipObj.__index__ = idx;
//Just for the line chart
if (canvas.__object__.type == 'line') {
var index2 = idx;
while (index2 >= canvas.__object__.data[0].length) {
index2 -= canvas.__object__.data[0].length;
}
tooltipObj.__index2__ = index2;
}
}
document.body.appendChild(tooltipObj);
var width = tooltipObj.offsetWidth;
var height = tooltipObj.offsetHeight;
if ((y - height - 2) > 0) {
y = y - height - 2;
} else {
y = y + 2;
}
//Set the width on the tooltip so it doesn't resize if the window is resized
tooltipObj.style.width = width + 'px';
//tooltipObj.style.height = 0; // Initially set the tooltip height to nothing
//If the mouse is towards the right of the browser window and the tooltip would go outside of the window,
// move it left
if ( (x + width) > document.body.offsetWidth ) {
x = x - width - 7;
var placementLeft = true;
if (canvas.__object__._tooltip._effect == 'none') {
x = x - 3;
}
tooltipObj.style.left = x + 'px';
tooltipObj.style.top = y + 'px';
} else {
x += 5;
tooltipObj.style.left = x + 'px';
tooltipObj.style.top = y + 'px';
}
if (effect == 'expand') {
tooltipObj.style.left = (x + (width / 2)) + 'px';
tooltipObj.style.top = (y + (height / 2)) + 'px';
leftDelta = (width / 2) / 10;
topDelta = (height / 2) / 10;
tooltipObj.style.width = 0;
tooltipObj.style.height = 0;
//tooltipObj.style.boxShadow = '';
//tooltipObj.style.MozBoxShadow = '';
//tooltipObj.style.WebkitBoxShadow = '';
//tooltipObj.style.borderRadius = 0;
//tooltipObj.style.MozBorderRadius = 0;
//tooltipObj.style.WebkitBorderRadius = 0;
tooltipObj.style.opacity = 1;
// Progressively move the tooltip to where it should be (the x position)
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 25));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 50));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 75));
OfficeExcelExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 100));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 125));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 150));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 175));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 200));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 225));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 250));
// Progressively move the tooltip to where it should be (the Y position)
OfficeExcelExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 25));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 50));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcelExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 75));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 100));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 125));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 150));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 175));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 200));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 225));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 250));
// Progressively grow the tooltip width
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.1) + "px'; }", 25));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.2) + "px'; }", 50));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.3) + "px'; }", 75));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.4) + "px'; }", 100));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.5) + "px'; }", 125));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.6) + "px'; }", 150));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.7) + "px'; }", 175));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.8) + "px'; }", 200));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 0.9) + "px'; }", 225));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + width + "px'; }", 250));
// Progressively grow the tooltip height
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.1) + "px'; }", 25));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.2) + "px'; }", 50));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.3) + "px'; }", 75));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.4) + "px'; }", 100));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.5) + "px'; }", 125));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.6) + "px'; }", 150));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.7) + "px'; }", 175));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.8) + "px'; }", 200));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 0.9) + "px'; }", 225));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + height + "px'; }", 250));
// When the animation is finished, set the tooltip HTML
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').innerHTML = OfficeExcel.Registry.Get('chart.tooltip').__text__; }", 250));
} else if (effect == 'contract') {
tooltipObj.style.left = (x - width) + 'px';
tooltipObj.style.top = (y - (height * 2)) + 'px';
tooltipObj.style.cursor = 'pointer';
leftDelta = width / 10;
topDelta = height / 10;
tooltipObj.style.width = (width * 5) + 'px';
tooltipObj.style.height = (height * 5) + 'px';
tooltipObj.style.opacity = 0.2;
// Progressively move the tooltip to where it should be (the x position)
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 25));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 50));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 75));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 100));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 125));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 150));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 175));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 200));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 225));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 250));
// Progressively move the tooltip to where it should be (the Y position)
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 25));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 50));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 75));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 100));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 125));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 150));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 175));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 200));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 225));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = (parseInt(OfficeExcel.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 250));
// Progressively shrink the tooltip width
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 5.5) + "px'; }", 25));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 5.0) + "px'; }", 50));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 4.5) + "px'; }", 75));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 4.0) + "px'; }", 100));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 3.5) + "px'; }", 125));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 3.0) + "px'; }", 150));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 2.5) + "px'; }", 175));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 2.0) + "px'; }", 200));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + (width * 1.5) + "px'; }", 225));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.width = '" + width + "px'; }", 250));
// Progressively shrink the tooltip height
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 5.5) + "px'; }", 25));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 5.0) + "px'; }", 50));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 4.5) + "px'; }", 75));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 4.0) + "px'; }", 100));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 3.5) + "px'; }", 125));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 3.0) + "px'; }", 150));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 2.5) + "px'; }", 175));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 2.0) + "px'; }", 200));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + (height * 1.5) + "px'; }", 225));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.height = '" + height + "px'; }", 250));
// When the animation is finished, set the tooltip HTML
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').innerHTML = OfficeExcel.Registry.Get('chart.tooltip').__text__; }", 250));
//This resets the pointer
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.cursor = 'default'; }", 275));
} else if (effect == 'snap') {
//Move the tooltip
for (var i=1; i<=10; ++i) {
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.left = '" + (x * 0.1 * i) + "px'; }", 15 * i));
OfficeExcel.Registry.Get('chart.tooltip.timers').push(setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.top = '" + (y * 0.1 * i) + "px'; }", 15 * i));
}
tooltipObj.style.left = 0 - tooltipObj.offsetWidth + 'px';
tooltipObj.style.top = 0 - tooltipObj.offsetHeight + 'px';
} else if (effect != 'fade' && effect != 'expand' && effect != 'none' && effect != 'snap' && effect != 'contract') {
alert('[COMMON] Unknown tooltip effect: ' + effect);
}
if (effect != 'none') {
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.1; }", 25);
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.2; }", 50);
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.3; }", 75);
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.4; }", 100);
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.5; }", 125);
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.6; }", 150);
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.7; }", 175);
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.8; }", 200);
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 0.9; }", 225);
}
setTimeout("if (OfficeExcel.Registry.Get('chart.tooltip')) { OfficeExcel.Registry.Get('chart.tooltip').style.opacity = 1;}", effect == 'none' ? 50 : 250);
//If the tooltip it self is clicked, cancel it
tooltipObj.onmousedown = function (e)
{
e = OfficeExcel.FixEventObject(e)
e.stopPropagation();
}
tooltipObj.onclick = function (e)
{
if (e.button == 0) {
e = OfficeExcel.FixEventObject(e);
e.stopPropagation();
}
}
//Install the function for hiding the tooltip.
document.body.onmousedown = function (event)
{
var tooltip = OfficeExcel.Registry.Get('chart.tooltip');
if (tooltip) {
OfficeExcel.HideTooltip();
// Redraw if highlighting is enabled
if (tooltip.__canvas__.__object__._tooltip._highlight) {
OfficeExcel.Redraw();
}
}
}
//If the window is resized, hide the tooltip
window.onresize = function ()
{
var tooltip = OfficeExcel.Registry.Get('chart.tooltip');
if (tooltip) {
tooltip.parentNode.removeChild(tooltip);
tooltip.style.display = 'none';
tooltip.style.visibility = 'hidden';
OfficeExcel.Registry.Set('chart.tooltip', null);
// Redraw the graph if necessary
if (canvas.__object__._tooltip._highlight) {
OfficeExcel.Clear(canvas);
canvas.__object__.Draw();
}
}
}
//Keep a reference to the tooltip
OfficeExcel.Registry.Set('chart.tooltip', tooltipObj);
//Fire the tooltip event
OfficeExcel.FireCustomEvent(canvas.__object__, 'ontooltip');*/
}
/**
*
*/
OfficeExcel.getTooltipTextFromDIV = function (text)
{
// This regex is duplicated firher down on roughly line 888
/*var result = /^id:(.*)/.exec(text);
if (result && result[1] && document.getElementById(result[1])) {
text = document.getElementById(result[1]).innerHTML;
} else if (result && result[1]) {
text = '';
}
return text;*/
}
/**
* This function handles the tooltip text being a string, function, or an array of functions.
*/
OfficeExcel.parseTooltipText = function (tooltips, idx)
{
// Get the tooltip text
/*if (typeof(tooltips) == 'function') {
var text = tooltips(idx);
} else if (typeof(tooltips) == 'object' && tooltips && typeof(tooltips[idx]) == 'function') {
var text = tooltips[idx](idx);
} else if (typeof(tooltips) == 'object' && tooltips) {
var text = String(tooltips[idx]);
} else {
var text = '';
}
if (text == 'undefined') {
text = '';
} else if (text == 'null') {
text = '';
}
return OfficeExcel.getTooltipTextFromDIV(text);*/
}
/**
*
*/
OfficeExcel.getTooltipWidth = function (text, obj)
{
/*var div = document.createElement('DIV');
div.className = obj._tooltip._css_class;
div.style.paddingLeft = OfficeExcel.tooltips.padding;
div.style.paddingRight = OfficeExcel.tooltips.padding;
div.style.fontFamily = OfficeExcel.tooltips.font_face;
div.style.fontSize = OfficeExcel.tooltips.font_size;
div.style.visibility = 'hidden';
div.style.position = 'absolute';
div.style.top = '300px';
div.style.left = 0;
div.style.display = 'inline';
div.innerHTML = OfficeExcel.getTooltipTextFromDIV(text);
document.body.appendChild(div);
return div.offsetWidth;*/
}
/**
* Hides the currently shown tooltip
*/
OfficeExcel.HideTooltip = function ()
{
/*var tooltip = OfficeExcel.Registry.Get('chart.tooltip');
if (tooltip) {
tooltip.parentNode.removeChild(tooltip);
tooltip.style.display = 'none';
tooltip.style.visibility = 'hidden';
OfficeExcel.Registry.Set('chart.tooltip', null);
}*/
}
/**
* The BAR chart onmousemove event Bar chart tooltips can now
* be based around the onmousemove event
*/
OfficeExcel.InstallBarTooltipEventListeners = function (obj)
{
//Install the window onclick handler
/*var window_onclick_func = function (){OfficeExcel.Redraw();};
window.addEventListener('click', window_onclick_func, false);
OfficeExcel.AddEventListener('window_' + obj.id, 'click', window_onclick_func);
var canvas_onmousemove = function (e)
{
e = OfficeExcel.FixEventObject(e);
var canvas = document.getElementById(e.target.id);
var obj = canvas.__object__;
if (obj.__bar__) {
var lineObj = obj;
obj = obj.__bar__;
obj.__line__ = lineObj;
}
var barCoords = obj.getBar(e);
//If there are bar coords AND the bar has height
if (barCoords && barCoords[4] > 0 && OfficeExcel.parseTooltipText(obj._tooltip._tooltips, barCoords[5])) {
//Get the tooltip text
var text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, barCoords[5]);
if (text) {
canvas.style.cursor = 'pointer';
} else {
canvas.style.cursor = 'default';
}
//Hide the currently displayed tooltip if the index is the same
if ( OfficeExcel.Registry.Get('chart.tooltip')
&& OfficeExcel.Registry.Get('chart.tooltip').__canvas__.id != obj.id
&& obj._tooltip._event == 'onmousemove') {
OfficeExcel.Redraw();
OfficeExcel.HideTooltip();
}
//This facilitates the tooltips using the onmousemove event
if ( obj._tooltip._event == 'onmousemove'
&& (
(OfficeExcel.Registry.Get('chart.tooltip') && OfficeExcel.Registry.Get('chart.tooltip').__index__ != barCoords[5])
|| !OfficeExcel.Registry.Get('chart.tooltip')
)
&& text) {
//Show a tooltip if it's defined
OfficeExcel.Redraw(obj);
if (obj._tooltip._highlight) {
obj.context.beginPath();
obj.context.strokeStyle = obj._otherProps._highlight_stroke;
obj.context.fillStyle = obj._otherProps._highlight_fill;
obj.context.strokeRect(AA(this, barCoords[1]), barCoords[2], barCoords[3], barCoords[4]);
obj.context.fillRect(AA(this, barCoords[1]), barCoords[2], barCoords[3], barCoords[4]);
obj.context.stroke();
obj.context.fill();
}
OfficeExcel.Tooltip(canvas, text, e.pageX, e.pageY, barCoords[5]);
}
} else if (obj.__line__ && obj.__line__.getPoint && obj.__line__.getPoint(e)) {
var point = obj.__line__.getPoint(e);
var mouseCoords = OfficeExcel.getMouseXY(e);
var mouseX = mouseCoords[0];
var mouseY = mouseCoords[1];
if ( mouseX > (point[0] - 5)
&& mouseX < (point[0] + 5)
&& mouseY > (point[1] - 5)
&& mouseY < (point[1] + 5) ) {
canvas.style.cursor = 'pointer';
}
} else {
canvas.style.cursor = 'default';
}
}
OfficeExcel.AddEventListener(obj.id, 'mousemove', canvas_onmousemove);
obj.canvas.addEventListener('mousemove', canvas_onmousemove, false);
//Install the onclick event handler for the tooltips
if (obj._tooltip._event == 'onclick') {
var canvas_onclick = function (e)
{
var e = OfficeExcel.FixEventObject(e);
// If the button pressed isn't the left, we're not interested
if (e.button != 0) return;
e = OfficeExcelExcel.FixEventObject(e);
var canvas = document.getElementById(this.id);
var obj = canvas.__object__;
if (obj.__bar__) {
obj = obj.__bar__;
}
var barCoords = obj.getBar(e);
//Redraw the graph first, in effect resetting the graph to as it was when it was first drawn
//This "deselects" any already selected bar
OfficeExcel.Redraw();
//Loop through the bars determining if the mouse is over a bar
if (barCoords) {
//Get the tooltip text
var text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, barCoords[5]);
//Show a tooltip if it's defined
if (text && text != 'undefined') {
if (obj._tooltip._highlight) {
obj.context.beginPath();
obj.context.strokeStyle = obj._otherProps._highlight_stroke;
obj.context.fillStyle = obj._otherProps._highlight_fill;
obj.context.strokeRect(AA(this, barCoords[1]), AA(this, barCoords[2]), barCoords[3], barCoords[4]);
obj.context.fillRect(AA(this, barCoords[1]), AA(this, barCoords[2]), barCoords[3], barCoords[4]);
obj.context.stroke();
obj.context.fill();
}
OfficeExcel.Tooltip(canvas, text, e.pageX, e.pageY, barCoords[5]);
}
}
//Stop the event bubbling
e.stopPropagation();
}
OfficeExcel.AddEventListener(obj.id, 'click', canvas_onclick);
obj.canvas.addEventListener('click', canvas_onclick, false);
}*/
}
/**
* The LINE chart tooltips event handlers
*
* @param object obj The graph object
*/
OfficeExcel.InstallLineTooltipEventListeners = function (obj)
{
/*var canvas_onclick_func = function (e)
{
e = OfficeExcel.FixEventObject(e);
var canvas = e.target;
var context = canvas.getContext('2d');
var obj = canvas.__object__;
var point = obj.getPoint(e);
var mouseCoords = OfficeExcel.getMouseXY(e);
var mouseX = mouseCoords[0]
var mouseY = mouseCoords[1]
if (obj._tooltip._highlight) {
OfficeExcel.Register(obj);
}
if ( point
&& typeof(point[0]) == 'object'
&& typeof(point[1]) == 'number'
&& typeof(point[2]) == 'number'
&& typeof(point[3]) == 'number'
) {
// point[0] is the graph object
var xCoord = point[1];
var yCoord = point[2];
var idx = point[3];
if ((obj._tooltip._tooltips[idx] || typeof(obj._tooltip._tooltips) == 'function')) {
var text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, idx);
// Change the pointer to a hand
if ( mouseX > (xCoord - 5)
&& mouseX < (xCoord + 5)
&& mouseY > (yCoord - 5)
&& mouseY < (yCoord + 5)
&& text) {
canvas.style.cursor = 'pointer';
} else {
canvas.style.cursor = 'default';
}
//If the tooltip is the same one as is currently visible (going by the array index), don't do squat and return.
if ( OfficeExcel.Registry.Get('chart.tooltip')
&& OfficeExcel.Registry.Get('chart.tooltip').__index__ == idx
&& OfficeExcel.Registry.Get('chart.tooltip').__canvas__.id == canvas.id
&& OfficeExcel.Registry.Get('chart.tooltip').__event__
&& OfficeExcel.Registry.Get('chart.tooltip').__event__ == 'mousemove') {
return;
}
//Redraw the graph
if (obj._tooltip._highlight || obj.__bar__) {
OfficeExcel.Redraw();
if (obj.__bar__) {
OfficeExcel.Clear(obj.canvas);
obj.__bar__.Draw();
}
}
// SHOW THE CORRECT TOOLTIP
OfficeExcel.Tooltip(canvas, text, e.pageX, obj._tooltip._hotspot_xonly ? (point[2] + OfficeExcel.getCanvasXY(canvas)[1]) : e.pageY, idx);
// Store the tooltip index on the tooltip object if it exists (because of override)
if (typeof(obj._tooltip._override) != 'function') {
OfficeExcel.Registry.Get('chart.tooltip').__index__ = Number(idx);
//This converts idx into the index that is not greater than the
//number of items in the data array
while (idx >= obj.data[0].length) {
idx -= obj.data[0].length
}
OfficeExcel.Registry.Get('chart.tooltip').__index2__ = idx;
//Set the source event
OfficeExcel.Registry.Get('chart.tooltip').__event__ = 'mousemove';
//Highlight the graph
if (obj._tooltip._highlight) {
context.beginPath();
context.moveTo(xCoord, yCoord);
context.arc(xCoord, yCoord, 2, 0, 6.28, 0);
context.strokeStyle = obj._otherProps._highlight_stroke;
context.fillStyle = obj._otherProps._highlight_fill;
context.stroke();
context.fill();
}
}
e.stopPropagation();
return;
}
}
//Not over a hotspot?
canvas.style.cursor = 'default';
}
obj.canvas.addEventListener('click', canvas_onclick_func, false);
OfficeExcel.AddEventListener(obj.id, 'click', canvas_onclick_func);
if (obj._tooltip._event == 'onmousemove') {
var canvas_onmousemove_func = function (e)
{
e = OfficeExcel.FixEventObject(e);
var canvas = e.target;
var context = canvas.getContext('2d');
var obj = canvas.__object__;
var point = obj.getPoint(e);
if (point && point.length > 0) {
var text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, point[3]);
// This regex is a duplicate of one further up on roughly line 482
if (text) {
canvas.style.cursor = 'pointer';
canvas_onclick_func(e);
}
} else {
canvas.style.cursor = 'default';
}
}
obj.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
OfficeExcel.AddEventListener(obj.id, 'mousemove', canvas_onmousemove_func);
// Just do the mouse pointer
} else {
var canvas_onmousemove_func = function (e)
{
e = OfficeExcel.FixEventObject(e);
var canvas = e.target;
var context = canvas.getContext('2d');
var obj = canvas.__object__;
var point = obj.getPoint(e);
if (point && point.length > 0) {
var text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, point[3]);
if (text) {
canvas.style.cursor = 'pointer';
}
} else {
canvas.style.cursor = 'default';
}
}
obj.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
OfficeExcel.AddEventListener(obj.id, 'mousemove', canvas_onmousemove_func);
}*/
}
/**
* This (as the name suggests preloads any images it can find in the tooltip text
*
* @param object obj The chart object
*/
OfficeExcel.PreLoadTooltipImages = function (obj)
{
/*var tooltips = obj._tooltip._tooltips;
if (obj.type == 'rscatter') {
tooltips = [];
for (var i=0; i<obj.data.length; ++i) {
tooltips.push(obj.data[3]);
}
}
for (var i=0; i<tooltips.length; ++i) {
// Add the text to an offscreen DIV tag
var div = document.createElement('DIV');
div.style.position = 'absolute';
div.style.opacity = 0;
div.style.top = '-100px';
div.style.left = '-100px';
div.innerHTML = tooltips[i];
document.body.appendChild(div);
// Now get the IMG tags and create them
var img_tags = div.getElementsByTagName('IMG');
// Create the image in an off-screen image tag
for (var j=0; j<img_tags.length; ++j) {
if (img_tags && img_tags[i]) {
var img = document.createElement('IMG');
img.style.position = 'absolute';
img.style.opacity = 0;
img.style.top = '-100px';
img.style.left = '-100px';
img.src = img_tags[i].src
document.body.appendChild(img);
setTimeout(function () {document.body.removeChild(img);}, 250);
}
}
// Now remove the div
document.body.removeChild(div);
}*/
}
\ No newline at end of file
......@@ -34,12 +34,6 @@
this._xAxisTitle = new OfficeExcel.Title();
// yAxis Title
this._yAxisTitle = new OfficeExcel.Title();
// Chart shadow
this._shadow = new OfficeExcel.Shadow();
// zoom
this._zoom = new OfficeExcel.chartZoom();
// Tooltip
this._tooltip = new OfficeExcel.Tooltips();
// Other Props
this._otherProps = new OfficeExcel.OtherProps();
......@@ -57,12 +51,6 @@
this.stackedOrGrouped = true;
}
}
/**
* Set the .getShape commonly named method
*/
this.getShape = this.getBar;
}
......@@ -71,17 +59,6 @@
*/
OfficeExcel.HBar.prototype.Draw = function (xmin,xmax,ymin,ymax,isSkip,isFormatCell)
{
/**
* Fire the onbeforedraw event
*/
OfficeExcel.FireCustomEvent(this, 'onbeforedraw');
/**
* Clear all of this canvases event handlers (the ones installed by OfficeExcel)
*/
//OfficeExcel.ClearEventListeners(this.id);
/**
* Stop the coords array from growing uncontrollably
*/
......@@ -174,9 +151,6 @@
// Progressively Draw the chart
OfficeExcel.background.Draw(this);
//getNullPosition(this);
this.Drawbars(isFormatCell);
this.DrawAxes();
this.DrawLabels(isFormatCell);
......@@ -187,186 +161,10 @@
OfficeExcel.DrawKey(this, this._otherProps._key, this._otherProps._colors);
}
/**
* Install the clickand mousemove event listeners
*/
OfficeExcel.InstallUserClickListener(this, this._otherProps._events_click);
OfficeExcel.InstallUserMousemoveListener(this, this._otherProps._events_mousemove);
/**
* Install the event handlers for tooltips
*/
if (this._tooltip._tooltips) {
// Need to register this object for redrawing
OfficeExcel.Register(this);
OfficeExcel.PreLoadTooltipImages(this);
/**
* Install the window onclick handler
*/
window.onclick = function ()
{
OfficeExcel.Redraw();
}
/**
* If the cursor is over a hotspot, change the cursor to a hand
*/
//this.canvas.onmousemove = function (e)
var canvas_onmousemove_func = function (e)
{
e = OfficeExcel.FixEventObject(e);
var canvas = document.getElementById(this.id);
var obj = canvas.__object__;
var bar = obj.getBar(e);
/**
* Get the mouse X/Y coordinates
*/
var mouseCoords = OfficeExcel.getMouseXY(e);
if (bar) {
var left = bar[0];
var top = bar[1];
var width = bar[2];
var height = bar[3];
var idx = bar[4];
var text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, idx);
if (!text) {
return;
}
canvas.style.cursor = 'pointer';
/**
* Show the tooltip if the event is onmousemove
*/
if (obj._tooltip._event == 'onmousemove') {
var tooltipObj = OfficeExcel.Registry.Get('chart.tooltip');
if (text) {
if (!tooltipObj || tooltipObj.__index__ != idx) {
OfficeExcel.HideTooltip();
OfficeExcel.Redraw();
obj.context.beginPath();
obj.context.strokeStyle = obj._otherProps._highlight_stroke;
obj.context.fillStyle = obj._otherProps._highlight_fill;
obj.context.strokeRect(left, top, width, height);
obj.context.fillRect(left, top, width, height);
OfficeExcel.Tooltip(canvas, text, e.pageX, e.pageY, idx);
}
return;
}
}
}
if (!bar) {
canvas.style.cursor = 'default';
}
}
this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
OfficeExcel.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
/**
* Install the onclick event handler for the tooltips
*/
//this.canvas.onclick = function (e)
var canvas_onclick_func = function (e)
{
e = OfficeExcel.FixEventObject(e);
//var canvas = document.getElementById(this.id);
var canvas = e.target;
var obj = canvas.__object__;
var bar = obj.getBar(e);
/**
* Redraw the graph first, in effect resetting the graph to as it was when it was first drawn
* This "deselects" any already selected bar
*/
OfficeExcel.Redraw();
/**
* Get the mouse X/Y coordinates
*/
var mouseCoords = OfficeExcel.getMouseXY(e);
/*******************************************************
* Only do this if a bar is being hovered over
*******************************************************/
if (bar) {
var left = bar[0];
var top = bar[1];
var width = bar[2];
var height = bar[3];
var idx = bar[4];
text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, idx);
if (!text) {
return;
}
/**
* Show a tooltip if it's defined
*/
if (String(text).length && text != null) {
obj.context.beginPath();
obj.context.strokeStyle = obj._otherProps._highlight_stroke;
obj.context.fillStyle = obj._otherProps._highlight_fill;
obj.context.strokeRect(left, top, width, height);
obj.context.fillRect(left, top, width, height);
obj.context.stroke();
obj.context.fill();
OfficeExcel.Tooltip(canvas, text, e.pageX, e.pageY, idx);
}
}
/**
* Stop the event bubbling
*/
e.stopPropagation();
}
this.canvas.addEventListener('click', canvas_onclick_func, false);
OfficeExcel.AddEventListener(this.id,'click', canvas_onclick_func);
// This resets the bar graph
if (OfficeExcel.Registry.Get('chart.tooltip')) {
OfficeExcel.Registry.Get('chart.tooltip').style.display = 'none';
OfficeExcel.Registry.Set('chart.tooltip', null)
}
}
/**
* Draw "in graph" labels
*/
OfficeExcel.DrawInGraphLabels(this);
/**
* Fire the OfficeExcel ondraw event
*/
OfficeExcel.FireCustomEvent(this, 'ondraw');
}
/**
......@@ -770,16 +568,6 @@
width = Math.abs(width);
}
/**
* Turn on the shadow if need be
*/
if (this._shadow._visible) {
this.context.shadowColor = this._shadow._color;
this.context.shadowBlur = this._shadow._blur;
this.context.shadowOffsetX = this._shadow._offset_x;
this.context.shadowOffsetY = this._shadow._offset_y;
}
/**
* Draw the bar
*/
......@@ -881,13 +669,6 @@
} else if (typeof(this.data[i]) == 'object' && this._otherProps._grouping == 'grouped') {
for (j=0; j<this.data[i].length; ++j) {
/**
* Turn on the shadow if need be
*/
if (this._shadow._visible)
OfficeExcel.SetShadow(this, this._shadow._color, this._shadow._offset_x, this._shadow._offset_y, this._shadow._blur);
// Set the fill/stroke colors
this.context.strokeStyle = this._otherProps._strokecolor;
if(this._otherProps._colors[j])
......@@ -990,13 +771,6 @@
this.context.fill();
this.context.stroke();
/**
* Now the bars are stroke()ed, turn off the shadow
*/
OfficeExcel.NoShadow(this);
this.RedrawBars(isFormatCell);
}
......@@ -1022,24 +796,11 @@
color: this._otherProps._labels_above_color,
underline: this._otherProps._labels_above_underline,
italic: this._otherProps._labels_above_italic
}
};
OfficeExcel.NoShadow(this);
this.context.strokeStyle = this._otherProps._strokecolor;
for (var i=0; i<coords.length; ++i) {
if (this._shadow._visible) {
this.context.beginPath();
this.context.strokeStyle = this._otherProps._strokecolor;
this.context.fillStyle = coords[i][4];
this.context.lineWidth = 1;
this.context.strokeRect(coords[i][0], coords[i][1], coords[i][2], coords[i][3]);
this.context.fillRect(coords[i][0], coords[i][1], coords[i][2], coords[i][3]);
this.context.fill();
this.context.stroke();
}
/**
* Draw labels "above" the bar
*/
......@@ -1047,7 +808,6 @@
this.context.fillStyle = color;
this.context.strokeStyle = 'black';
OfficeExcel.NoShadow(this);
var border = (coords[i][0] + coords[i][2] + 7 + this.context.measureText(this._otherProps._units_pre + this.coords[i][5] + this._otherProps._units_post).width) > OfficeExcel.GetWidth(this) ? true : false;
var textLabel = this.coords[i][5];
......@@ -1080,41 +840,7 @@
border ? 'rgba(255,255,255,0.9)' : null, bold, null, textOptions);
}
}
}
/*******************************************************
* This function can be used to get the appropriate bar information (if any)
*
* @param e Event object
* @return Appriate bar information (if any)
*******************************************************/
OfficeExcel.HBar.prototype.getBar = function (e)
{
var obj = e.target.__object__;
var canvas = obj.canvas;
var context = obj.context;
var mouseCoords = OfficeExcel.getMouseXY(e);
/**
* Loop through the bars determining if the mouse is over a bar
*/
for (var i=0,len=obj.coords.length; i<len; i++) {
var mouseX = mouseCoords[0]; // In relation to the canvas
var mouseY = mouseCoords[1]; // In relation to the canvas
var left = obj.coords[i][0];
var top = obj.coords[i][1];
var width = obj.coords[i][2];
var height = obj.coords[i][3];
var idx = i;
if (mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ) {
return [left, top, width, height, idx];
}
}
}
}
/**
* When you click on the chart, this method can return the X value at that point. It works for any point on the
......@@ -1160,54 +886,4 @@
}
return value;
}
function getNullPosition(obj)
{
var numNull = obj._otherProps._background_grid_autofit_numhlines;
var arrTemp = [];
if(undefined == obj.scale)
return;
if(typeof(obj.data[0]) == 'object')
{
var arrMin = [];
var arrMax = [];
for (var j=0; j < obj.data.length; j++) {
min = Math.min.apply(null, obj.data[j]);
max = Math.max.apply(null, obj.data[j]);
arrMin[j] = min;
arrMax[j] = max;
}
min = Math.min.apply(null, arrMin);
max = Math.max.apply(null, arrMax);
}
else
{
min = Math.min.apply(null, obj.data);
max = Math.max.apply(null, obj.data);
}
if(min >= 0 && max >= 0)
{
numNull = 0;
}
else if(min <= 0 && max <= 0)
{
numNull = obj._otherProps._background_grid_autofit_numhlines;
}
else
{
for (var i=0; i<obj.scale.length; i++)
{
if(obj.scale[i] == 0)
{
numNull = i + 1;
break;
}
}
}
var nullPosition;
if(0 == numNull)
nullPosition = 0;
else
nullPosition = (obj.canvas.width - obj._chartGutter._left - obj._chartGutter._right)/(obj._otherProps._background_grid_autofit_numhlines)*numNull;
obj.nullPositionOX = obj._chartGutter._left + nullPosition;
}
\ No newline at end of file
}
\ No newline at end of file
......@@ -11,7 +11,6 @@
this.max = 0;
this.coords = [];
this.coords2 = [];
this.coordsKey = [];
this.hasnegativevalues = false;
this.isOfficeExcel = true;
this.data = data;
......@@ -32,12 +31,6 @@
this._xAxisTitle = new OfficeExcel.Title();
// yAxis Title
this._yAxisTitle = new OfficeExcel.Title();
// Chart shadow
this._shadow = new OfficeExcel.Shadow();
// zoom
this._zoom = new OfficeExcel.chartZoom();
// Tooltip
this._tooltip = new OfficeExcel.Tooltips();
// Other Props
this._otherProps = new OfficeExcel.OtherProps();
......@@ -86,25 +79,6 @@
return;
}
// MUST be the SECOND thing done!
/*if (typeof(this._otherProps._background_image) == 'string' && !this.__background_image__) {
OfficeExcel.DrawBackgroundImage(this);
return;
}*/
if (typeof(this._otherProps._background_image) == 'string' && !this.__background_image__) {
OfficeExcel.DrawBackgroundImage1(this,mainBackground);
return;
}
if (this.__bar__ && this._tooltip._highlight) {
//this._tooltip._highlight = false;
}
// Fire onbeforedraw
OfficeExcel.FireCustomEvent(this, 'onbeforedraw');
// Clear all Listeners
//OfficeExcel.ClearEventListeners(this.id);
// Reset the data back to that which was initially supplied
this.data = OfficeExcel.array_clone(this.original_data);
......@@ -226,31 +200,11 @@
// Draw Axes
if (this._otherProps._axesontop == false)
this.DrawAxes(min,max);
// Shadow Color
var shadowColor = this._shadow._color;
for (var i = 0, j = 0; i < this.data.length; ++i, ++j) {
this.context.beginPath();
// Shadow
if (this._shadow._visible && !this._otherProps._filled) {
// Shadow Color
if (typeof(shadowColor) == 'object' && shadowColor[i - 1])
this.context.shadowColor = shadowColor[i];
else if (typeof(shadowColor) == 'object')
this.context.shadowColor = shadowColor[0];
else if (typeof(shadowColor) == 'string')
this.context.shadowColor = shadowColor;
this.context.shadowBlur = this._shadow._blur;
this.context.shadowOffsetX = this._shadow._offset_x;
this.context.shadowOffsetY = this._shadow._offset_y;
} else if (this._otherProps._filled && this._shadow._visible)
alert('[LINE] Shadows are not permitted when the line is filled');
// Draw line
// Draw line
var fill = null;
if (this._otherProps._fillstyle) {
if (typeof(this._otherProps._fillstyle) == 'object' && this._otherProps._fillstyle[j])
......@@ -333,7 +287,6 @@
this.coords2[i][j][0],
this.coords2[i][j][1],
this.context.strokeStyle,
false,
j == 0 ? 0 : this.coords2[i][j - 1][0],
j == 0 ? 0 : this.coords2[i][j - 1][1],
tickmarks,
......@@ -347,26 +300,6 @@
}
}
// Install mouse listeners
OfficeExcel.InstallUserClickListener(this, this._otherProps._events_click);
OfficeExcel.InstallUserMousemoveListener(this, this._otherProps._events_mousemove);
// Install tooltips
if (this._tooltip._tooltips && (this._tooltip._tooltips.length || typeof(this._tooltip._tooltips) == 'function')) {
// Register to redraw
if (this._tooltip._highlight)
OfficeExcel.Register(this);
OfficeExcel.PreLoadTooltipImages(this);
OfficeExcel.InstallLineTooltipEventListeners(this);
// If there's a bar, install bar listeners
if (this.__bar__)
OfficeExcel.InstallBarTooltipEventListeners(this.__bar__);
}
// Draw Axes if on top
if (this._otherProps._axesontop)
this.DrawAxes(min,max);
......@@ -388,9 +321,6 @@
// Draw in graph labels
OfficeExcel.DrawInGraphLabels(this);
// Draw crosschairs
OfficeExcel.DrawCrosshairs(this);
// Redraw the lines if a filled range is on the cards
if (this._otherProps._filled && this._otherProps._filled_range && this.data.length == 2) {
......@@ -428,9 +358,6 @@
// Adjustments
if (this._otherProps._adjustable)
OfficeExcel.AllowAdjusting(this);
// Ondraw event
OfficeExcel.FireCustomEvent(this, 'ondraw');
}
......@@ -442,9 +369,6 @@
if (this._otherProps._noaxes)
return;
// Turn any shadow off
OfficeExcel.NoShadow(this);
this.context.lineWidth = 1;
this.context.lineCap = 'butt';
this.context.strokeStyle = this._otherProps._axis_color;
......@@ -670,9 +594,6 @@
if(OfficeExcel.drawingCtxCharts && OfficeExcel.drawingCtxCharts.scaleFactor)
scaleFactor = OfficeExcel.drawingCtxCharts.scaleFactor;
// Turn off any shadow
OfficeExcel.NoShadow(this);
// This needs to be here
var font = this._otherProps._ylabels_font;
var text_size = this._otherProps._ylabels_size;
......@@ -1163,13 +1084,6 @@
// Draws the line
OfficeExcel.Line.prototype.DrawLine = function (lineData, color, fill, linewidth, tickmarks, index)
{
// This facilitates the Rise animation (the Y value only)
if (this._otherProps._animation_unfold_y && this._otherProps._animation_factor != 1) {
for (var i=0; i<lineData.length; ++i) {
lineData[i] *= this._otherProps._animation_factor;
}
}
var penUp = false;
var yPos = null;
var xPos = 0;
......@@ -1257,14 +1171,6 @@
xPos = this._otherProps._hmargin + this._chartGutter._left;
}
if (this._otherProps._animation_unfold_x) {
xPos *= this._otherProps._animation_factor;
if (xPos < this._chartGutter._left) {
xPos = this._chartGutter._left;
}
}
/**
* Add the coords to an array
*/
......@@ -1285,13 +1191,6 @@
// Store the coords in another format, indexed by line number
this.coords2[index] = lineCoords;
/**
* For IE only: Draw the shadow ourselves as ExCanvas doesn't produce shadows
*/
if (OfficeExcel.isOld() && this._shadow._visible) {
this.DrawIEShadow(lineCoords, this.context.shadowColor);
}
/**
* Now draw the actual line [FORMERLY SECOND]
*/
......@@ -1438,24 +1337,6 @@
}
/**
* FIXME this may need removing when Chrome is fixed
* SEARCH TAGS: CHROME SHADOW BUG
*/
if (navigator.userAgent.match(/Chrome/) && this._shadow._visible && this._otherProps._chromefix && this._shadow._blur > 0) {
for (var i=lineCoords.length - 1; i>=0; --i) {
if (
typeof(lineCoords[i][1]) != 'number'
|| (typeof(lineCoords[i+1]) == 'object' && typeof(lineCoords[i+1][1]) != 'number')
) {
this.context.moveTo(lineCoords[i][0],lineCoords[i][1]);
} else {
this.context.lineTo(lineCoords[i][0],lineCoords[i][1]);
}
}
}
this.context.stroke();
......@@ -1496,7 +1377,7 @@
var prevX = (i <= 0 ? null : lineCoords[i - 1][0]);
var prevY = (i <= 0 ? null : lineCoords[i - 1][1]);
this.DrawTick(lineData, lineCoords[i][0], lineCoords[i][1], color, false, prevX, prevY, tickmarks, i);
this.DrawTick(lineData, lineCoords[i][0], lineCoords[i][1], color, prevX, prevY, tickmarks, i);
// Draws tickmarks on the stepped bits of stepped charts. Takend out 14th July 2010
//
......@@ -1513,7 +1394,7 @@
// Draws a tick
OfficeExcel.Line.prototype.DrawTick = function (lineData, xPos, yPos, color, isShadow, prevX, prevY, tickmarks, index)
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)
......@@ -1524,8 +1405,8 @@
var offset = 0;
this.context.lineWidth = this._otherProps._tickmarks_linewidth ? this._otherProps._tickmarks_linewidth : this._otherProps._linewidth;
this.context.strokeStyle = isShadow ? this._shadow._color : this.context.strokeStyle;
this.context.fillStyle = isShadow ? this._shadow._color : this.context.strokeStyle;
this.context.strokeStyle = this.context.strokeStyle;
this.context.fillStyle = this.context.strokeStyle;
if ( tickmarks == 'circle'
|| tickmarks == 'filledcircle'
......@@ -1536,9 +1417,9 @@
this.context.arc(xPos + offset, yPos + offset, this._otherProps._ticksize, 0, 360 / (180 / Math.PI), false);
if (tickmarks == 'filledcircle') {
this.context.fillStyle = isShadow ? this._shadow._color : this.context.strokeStyle;
this.context.fillStyle = this.context.strokeStyle;
} else {
this.context.fillStyle = isShadow ? this._shadow._color : 'white';
this.context.fillStyle = 'white';
}
this.context.stroke();
......@@ -1585,7 +1466,7 @@
this.context.beginPath();
if (tickmarks == 'filledtriangle') {
this.context.fillStyle = isShadow ? this._shadow._color : this.context.strokeStyle;
this.context.fillStyle = this.context.strokeStyle;
} else {
this.context.fillStyle = 'white';
}
......@@ -1638,11 +1519,11 @@
// Fillrect
if (tickmarks == 'filledsquare' || tickmarks == 'filledendsquare') {
this.context.fillStyle = isShadow ? this._shadow._color : this.context.strokeStyle;
this.context.fillStyle = this.context.strokeStyle;
this.context.fillRect(xPos - this._otherProps._ticksize, yPos - this._otherProps._ticksize, this._otherProps._ticksize * 2, this._otherProps._ticksize * 2);
} else if (tickmarks == 'square' || tickmarks == 'endsquare') {
this.context.fillStyle = isShadow ? this._shadow._color : 'white';
this.context.fillStyle = 'white';
this.context.fillRect((xPos - this._otherProps._ticksize) + 1, (yPos - this._otherProps._ticksize) + 1, (this._otherProps._ticksize * 2) - 2, (this._otherProps._ticksize * 2) - 2);
}
......@@ -1821,32 +1702,6 @@
}
}
/**
* This function is used by MSIE only to manually draw the shadow
*
* @param array coords The coords for the line
*/
OfficeExcel.Line.prototype.DrawIEShadow = function (coords, color)
{
var offsetx = this._shadow._offset_x;
var offsety = this._shadow._offset_y;
this.context.lineWidth = this._otherProps._linewidth;
this.context.strokeStyle = color;
this.context.beginPath();
for (var i=0; i<coords.length; ++i) {
if (i == 0) {
this.context.moveTo(coords[i][0] + offsetx, coords[i][1] + offsety);
} else {
this.context.lineTo(coords[i][0] + offsetx, coords[i][1] + offsety);
}
}
this.context.stroke();
}
/**
* Draw the backdrop
*/
......@@ -1869,7 +1724,6 @@
// Reset the alpha value
this.context.globalAlpha = 1;
this.context.lineJoin = 'round';
OfficeExcel.NoShadow(this);
}
// Returns the linewidth
......@@ -1889,54 +1743,6 @@
}
}
/**
* The getPoint() method - used to get the point the mouse is currently over, if any
*
* @param object e The event object
* @param object OPTIONAL You can pass in the bar object instead of the
* function getting it from the canvas
*/
OfficeExcel.Line.prototype.getPoint = function (e)
{
var canvas = e.target;
var obj = canvas.__object__;
var context = obj.context;
var mouseXY = OfficeExcel.getMouseXY(e);
var mouseX = mouseXY[0];
var mouseY = mouseXY[1];
// This facilitates you being able to pass in the bar object as a parameter instead of
// the function getting it from the object
if (arguments[1]) {
obj = arguments[1];
}
for (var i=0; i<obj.coords.length; ++i) {
var xCoord = obj.coords[i][0];
var yCoord = obj.coords[i][1];
// Do this if the hotspot is triggered by the X coord AND the Y coord
if ( obj._tooltip._hotspot_xonly == false
&& mouseX <= (xCoord + 5)
&& mouseX >= (xCoord - 5)
&& mouseY <= (yCoord + 5)
&& mouseY >= (yCoord - 5)
) {
return [obj, xCoord, yCoord, i];
} else if ( obj._tooltip._hotspot_xonly == true
&& mouseX <= (xCoord + 5)
&& mouseX >= (xCoord - 5)) {
return [obj, xCoord, yCoord, i];
}
}
}
// Draws the above line labels
OfficeExcel.Line.prototype.DrawAboveLabels = function (format)
{
......
......@@ -32,12 +32,6 @@
this._xAxisTitle = new OfficeExcel.Title();
// yAxis Title
this._yAxisTitle = new OfficeExcel.Title();
// Chart shadow
this._shadow = new OfficeExcel.Shadow();
// zoom
this._zoom = new OfficeExcel.chartZoom();
// Tooltip
this._tooltip = new OfficeExcel.Tooltips();
// Other Props
this._otherProps = new OfficeExcel.OtherProps();
......@@ -47,12 +41,6 @@
for (var i=0,len=data.length; i<len; i++) {
this.total += data[i];
}
/**
* Set the .getShape commonly named method
*/
this.getShape = this.getSegment;
}
/**
......@@ -60,17 +48,6 @@
*/
OfficeExcel.Pie.prototype.Draw = function (min,max,ymin,ymax,isSkip,isFormatCell)
{
/**
* Fire the onbeforedraw event
*/
OfficeExcel.FireCustomEvent(this, 'onbeforedraw');
/**
* Clear all of this canvases event handlers (the ones installed by OfficeExcel)
*/
//OfficeExcel.ClearEventListeners(this.id);
this.radius = this._otherProps._radius ? this._otherProps._radius : this.getRadius();
// this.centerx now defined below
this.centery = ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) / 2) + this._chartGutter._top;
......@@ -116,30 +93,6 @@
this.centerx,
this._chartTitle._size ? this._chartTitle._size : this._otherProps._text_size + 2);
/**
* Draw the shadow if required
*/
if (this._shadow._visible && 0) {
var offsetx = document.all ? this._shadow._offset_x : 0;
var offsety = document.all ? this._shadow._offset_y : 0;
this.context.beginPath();
this.context.fillStyle = this._shadow._color;
this.context.shadowColor = this._shadow._color;
this.context.shadowBlur = this._shadow._blur;
this.context.shadowOffsetX = this._shadow._offset_x;
this.context.shadowOffsetY = this._shadow._offset_y;
this.context.arc(this.centerx + offsetx, this.centery + offsety, this.radius, 0, 6.28, 0);
this.context.fill();
// Now turn off the shadow
OfficeExcel.NoShadow(this);
}
/**
* The total of the array of values
*/
......@@ -153,18 +106,12 @@
this.DrawSegment(angle,this._otherProps._colors[i],i == (this.data.length - 1), i);
}
OfficeExcel.NoShadow(this);
/**
* Redraw the seperating lines
*/
this.DrawBorders();
/**
* Now draw the segments again with shadow turned off. This is always performed,
* not just if the shadow is on.
*/
//TODO граница между секторами круговой диаграммы - в следующей версии нужно зачитывать из xml
/*for (var i=0; i<this.angles.length; i++) {
......@@ -206,7 +153,7 @@
var strokeStyle = this._otherProps._strokecolor;
var isWhite = strokeStyle == 'white' || strokeStyle == '#fff' || strokeStyle == '#fffffff' || strokeStyle == 'rgb(255,255,255)' || strokeStyle == 'rgba(255,255,255,0)';
if (!isWhite || (isWhite && this._shadow._visible)) {
if (!isWhite) {
// Again (?)
this.DrawBorders();
}
......@@ -217,245 +164,6 @@
*/
this.DrawLabels(isFormatCell);
/**
* Install the clickand mousemove event listeners
*/
OfficeExcel.InstallUserClickListener(this, this._otherProps._events_click);
OfficeExcel.InstallUserMousemoveListener(this, this._otherProps._events_mousemove);
/**
* Tooltips
*/
if (this._tooltip._tooltips && this._tooltip._tooltips.length) {
/**
* Register this object for redrawing
*/
OfficeExcel.Register(this);
OfficeExcel.PreLoadTooltipImages(this);
/**
* The onclick event
*/
//this.canvas.onclick = function (e)
var canvas_onclick_func = function (e)
{
OfficeExcel.HideZoomedCanvas();
e = OfficeExcel.FixEventObject(e);
var mouseCoords = OfficeExcel.getMouseXY(e);
var canvas = e.target;
var context = canvas.getContext('2d');
var obj = e.target.__object__;
/**
* If it's actually a donut make sure the hyp is bigger
* than the size of the hole in the middle
*/
if (obj._otherProps._variant == 'donut' && Math.abs(hyp) < (obj.radius / 2)) {
return;
}
/**
* The angles for each segment are stored in "angles",
* so go through that checking if the mouse position corresponds
*/
var isDonut = obj._otherProps._variant == 'donut';
var hStyle = obj._otherProps._highlight_style;
var segment = obj.getSegment(e);
if (segment) {
var x = mouseCoords[0] - segment[0];
var y = mouseCoords[1] - segment[1];
var theta = Math.atan(y / x); // RADIANS
var hyp = y / Math.sin(theta);
if ( OfficeExcel.Registry.Get('chart.tooltip')
&& segment[5] == OfficeExcel.Registry.Get('chart.tooltip').__index__
&& OfficeExcel.Registry.Get('chart.tooltip').__canvas__.__object__.id == obj.id) {
return;
} else {
OfficeExcel.Redraw();
}
/**
* If a tooltip is defined, show it
*/
/**
* Get the tooltip text
*/
var text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, segment[5]);
if (text) {
OfficeExcel.Tooltip(canvas, text, e.pageX, e.pageY, segment[5]);
}
/**
* Do the highlighting
*/
if (text) {
if (hStyle == '2d') {
obj.highlight_segment(segment);
} else if (hStyle == 'explode') {
obj.Explode(segment[5], 25);
setTimeout(function () {obj._otherProps._exploded = [];}, document.all ? 1000 : 500);
e.stopPropagation();
e.cancelBubble = true;
//return false;
} else {
context.lineWidth = 2;
/**
* Draw a white segment where the one that has been clicked on was
*/
context.fillStyle = 'white';
context.strokeStyle = 'white';
context.beginPath();
//context.moveTo(segment[0], segment[1]);
context.arc(segment[0], segment[1], segment[2], obj.angles[segment[5]][0], obj.angles[segment[5]][1], false);
obj._otherProps._variant == 'donut' ? context.arc(segment[0], segment[1], segment[2] / 2, obj.angles[segment[5]][1], obj.angles[segment[5]][0], true) : context.lineTo(segment[0], segment[1]);
context.stroke();
context.fill();
context.lineWidth = 1;
context.shadowColor = '#666';
context.shadowBlur = 3;
context.shadowOffsetX = 3;
context.shadowOffsetY = 3;
// Draw the new segment
context.beginPath();
context.fillStyle = obj._otherProps._colors[segment[5]];
context.strokeStyle = obj._otherProps._strokecolor;
context.arc(segment[0] - 3, segment[1] - 3, segment[2], obj.angles[segment[5]][0], obj.angles[segment[5]][1], false);
obj._otherProps._variant == 'donut' ? context.arc(segment[0] - 3, segment[1] - 3, segment[2] / 2, obj.angles[segment[5]][1], obj.angles[segment[5]][0], true) : context.lineTo(segment[0], segment[1]);
context.closePath();
context.stroke();
context.fill();
// Turn off the shadow
OfficeExcel.NoShadow(obj);
/**
* If a border is defined, redraw that
*/
if (obj._otherProps._border) {
context.beginPath();
context.strokeStyle = obj._otherProps._border_color;
context.lineWidth = 5;
context.arc(segment[0] - 3, segment[1] - 3, obj.radius - 2, obj.angles[i][0], obj.angles[i][1], 0);
context.stroke();
}
}
}
/**
* Need to redraw the key?
*/
if (obj._otherProps._key && obj._otherProps._key.length && obj._otherProps._key_position == 'graph') {
OfficeExcel.DrawKey(obj, obj._otherProps._key, obj._otherProps._colors);
}
e.stopPropagation();
return;
} else if (obj._tooltip._event == 'onclick') {
OfficeExcel.Redraw();
}
}
var event_name = this._tooltip._event == 'onmousemove' ? 'mousemove' : 'click';
this.canvas.addEventListener(event_name, canvas_onclick_func, false);
OfficeExcel.AddEventListener(this.id, event_name, canvas_onclick_func);
/**
* The onmousemove event for changing the cursor
*/
//this.canvas.onmousemove = function (e)
var canvas_onmousemove_func = function (e)
{
OfficeExcel.HideZoomedCanvas();
e = OfficeExcel.FixEventObject(e);
var obj = e.target.__object__;
var segment = obj.getSegment(e);
if (segment) {
var text = OfficeExcel.parseTooltipText(obj._tooltip._tooltips, segment[5]);
if (text) {
e.target.style.cursor = 'pointer';
return;
}
}
/**
* Put the cursor back to null
*/
e.target.style.cursor = 'default';
}
this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
OfficeExcel.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
/**
* The window onclick function
*/
var window_onclick_func = function (e)
{
// Taken out on 02/10/11
//OfficeExcel.HideZoomedCanvas();
e = OfficeExcel.FixEventObject(e);
OfficeExcel.Redraw();
/**
* Put the cursor back to null
*/
//e.target.style.cursor = 'default';
}
window.addEventListener('click', window_onclick_func, false);
OfficeExcel.AddEventListener('window_' + this.id, 'click', window_onclick_func);
}
/**
* If a border is pecified, draw it
*/
......@@ -480,14 +188,6 @@
if (this._otherProps._key != null) {
OfficeExcel.DrawKey(this, this._otherProps._key, this._otherProps._colors);
}
OfficeExcel.NoShadow(this);
/**
* Fire the OfficeExcel ondraw event
*/
OfficeExcel.FireCustomEvent(this, 'ondraw');
}
......@@ -517,9 +217,6 @@
context.fillStyle = color;
context.strokeStyle = this._otherProps._strokecolor;
context.lineWidth = 0;
if (this._shadow._visible)
OfficeExcel.SetShadow(this, this._shadow._color,this._shadow._offset_x, this._shadow._offset_y, this._shadow._blur);
/**
* Exploded segments
......@@ -608,11 +305,6 @@
centerx = (this.canvas.width + this._chartGutter._left)/2;
if(centerx <= (this.radius + 14) || (this.canvas.width - (this.radius*2) - this._chartGutter._left) <= 14)
centerx = this.centerx;
/**
* Turn the shadow off
*/
OfficeExcel.NoShadow(this);
context.fillStyle = 'black';
context.beginPath();
......@@ -759,86 +451,6 @@
}
}
/**
* The (now Pie chart specific) getSegment function
*
* @param object e The event object
*/
OfficeExcel.Pie.prototype.getSegment = function (e)
{
OfficeExcel.FixEventObject(e);
// The optional arg provides a way of allowing some accuracy (pixels)
var accuracy = arguments[1] ? arguments[1] : 0;
var obj = e.target.__object__;
var canvas = obj.canvas;
var context = obj.context;
var mouseCoords = OfficeExcel.getMouseXY(e);
var r = obj.radius;
var angles = obj.angles;
var ret = [];
for (var i=0; i<angles.length; ++i) {
var x = mouseCoords[0] - angles[i][2];
var y = mouseCoords[1] - angles[i][3];
var theta = Math.atan(y / x); // RADIANS
var hyp = y / Math.sin(theta);
var hyp = (hyp < 0) ? hyp + accuracy : hyp - accuracy;
/**
* Account for the correct quadrant
*/
if (x < 0 && y >= 0) {
theta += Math.PI;
} else if (x < 0 && y < 0) {
theta += Math.PI;
}
if (theta > (2 * Math.PI)) {
theta -= (2 * Math.PI);
}
if (theta >= angles[i][0] && theta < angles[i][1]) {
hyp = Math.abs(hyp);
if (!hyp || (obj.radius && hyp > obj.radius) ) {
return null;
}
if (obj.type == 'pie' && obj._otherProps._variant == 'donut' && (hyp > obj.radius || hyp < (obj.radius / 2) ) ) {
return null;
}
ret[0] = angles[i][2];
ret[1] = angles[i][3];
ret[2] = obj.radius;
ret[3] = angles[i][0] - (2 * Math.PI);
ret[4] = angles[i][1];
ret[5] = i;
if (ret[3] < 0) ret[3] += (2 * Math.PI);
if (ret[4] > (2 * Math.PI)) ret[4] -= (2 * Math.PI);
ret[3] = ret[3];
ret[4] = ret[4];
return ret;
}
}
return null;
}
OfficeExcel.Pie.prototype.DrawBorders = function ()
{
if (this._otherProps._linewidth > 0) {
......@@ -874,54 +486,4 @@
OfficeExcel.Pie.prototype.getRadius = function ()
{
return Math.min(this.canvas.height - this._chartGutter._top - this._chartGutter._bottom, this.canvas.width - this._chartGutter._left - this._chartGutter._right) / 2;
}
/**
* A programmatic explode function
*
* @param object obj The chart object
* @param number index The zero-indexed number of the segment
* @param number size The size (in pixels) of the explosion
*/
OfficeExcel.Pie.prototype.Explode = function (index, size)
{
var obj = this;
this._otherProps._exploded = [];
this._otherProps._exploded[index] = 0;
for (var o=0; o<size; ++o) {
setTimeout(
function ()
{
obj._otherProps._exploded[index] += 1;
OfficeExcel.Clear(obj.canvas);
obj.Draw();
}, o * (document.all ? 25 : 16.666));
}
}
/**
* This function highlights a segment
*
* @param array segment The segment information that is returned by the pie.getSegment(e) function
*/
OfficeExcel.Pie.prototype.highlight_segment = function (segment)
{
var context = this.context;
context.beginPath();
context.strokeStyle = this._otherProps._highlight_style_2d_stroke;
context.fillStyle = this._otherProps._highlight_style_2d_fill;
context.moveTo(segment[0], segment[1]);
context.arc(segment[0], segment[1], segment[2], this.angles[segment[5]][0], this.angles[segment[5]][1], 0);
context.lineTo(segment[0], segment[1]);
context.closePath();
context.stroke();
context.fill();
}
\ No newline at end of file
......@@ -33,12 +33,6 @@
this._xAxisTitle = new OfficeExcel.Title();
// yAxis Title
this._yAxisTitle = new OfficeExcel.Title();
// Chart shadow
this._shadow = new OfficeExcel.Shadow();
// zoom
this._zoom = new OfficeExcel.chartZoom();
// Tooltip
this._tooltip = new OfficeExcel.Tooltips();
// Other Props
this._otherProps = new OfficeExcel.OtherProps();
......@@ -62,12 +56,6 @@
alert('[SCATTER] No canvas support');
return;
}
/**
* Set the .getShape commonly named method
*/
this.getShape = this.getPoint;
}
/**
......@@ -75,41 +63,11 @@
*/
OfficeExcel.Scatter.prototype.Draw = function (min,max,ymin,ymax,isSkip,isFormatCell,isformatCellScOy)
{
// MUST be the first thing done!
if (typeof(this._otherProps._background_image) == 'string' && !this.__background_image__) {
OfficeExcel.DrawBackgroundImage(this);
return;
}
var xScale;
/**
* Fire the onbeforedraw event
*/
OfficeExcel.FireCustomEvent(this, 'onbeforedraw');
/**
* Clear all of this canvases event handlers (the ones installed by OfficeExcel)
*/
//OfficeExcel.ClearEventListeners(this.id);
// Go through all the data points and see if a tooltip has been given
this._tooltip._tooltips = false;
this.hasTooltips = false;
var overHotspot = false;
// Reset the coords array
this.coords = [];
if (!OfficeExcel.isOld()) {
for (var i=0; i<this.data.length; ++i) {
for (var j =0;j<this.data[i].length; ++j) {
if (this.data[i][j] && this.data[i][j][3] && typeof(this.data[i][j][3]) == 'string' && this.data[i][j][3].length) {
this._tooltip._tooltips = [1];
this.hasTooltips = true;
}
}
}
}
// Reset the maximum value
this.max = 0;
......@@ -239,17 +197,8 @@
for(i=0; i<this.data.length; ++i) {
this.DrawMarks(i);
// Set the shadow
this.context.shadowColor = this._otherProps._line_shadow_color;
this.context.shadowOffsetX = this._otherProps._line_shadow_offsetx;
this.context.shadowOffsetY = this._otherProps._line_shadow_offsety;
this.context.shadowBlur = this._otherProps._line_shadow_blur;
if(this._otherProps._type != 'burse2')
this.DrawLine(i);
// Turn the shadow off
OfficeExcel.NoShadow(this);
}
......@@ -258,119 +207,6 @@
this.DrawMarks(i); // Call this again so the tickmarks appear over the line
}
}
/**
* Install the clickand mousemove event listeners
*/
OfficeExcel.InstallUserClickListener(this, this._otherProps._events_click);
OfficeExcel.InstallUserMousemoveListener(this, this._otherProps._events_mousemove);
/**
* Install the event handler for tooltips
*/
if (this.hasTooltips) {
/**
* Register all charts
*/
OfficeExcel.Register(this);
OfficeExcel.PreLoadTooltipImages(this);
var overHotspot = false;
var canvas_onmousemove_func = function (e)
{
e = OfficeExcel.FixEventObject(e);
var canvas = e.target;
var obj = canvas.__object__;
var context = obj.context;
var mouseCoords = OfficeExcel.getMouseXY(e);
var point = obj.getPoint(e);
var overHotspot = false;
if (point) {
var __dataset__ = point[2];
var __index__ = point[3];
var __text__ = point[4];
var overHotspot = true;
/**
* Get the tooltip text
*/
var text = OfficeExcel.parseTooltipText(obj.data[__dataset__][__index__], 3);
if (point[4]) {
if (
!OfficeExcel.Registry.Get('chart.tooltip') ||
OfficeExcel.Registry.Get('chart.tooltip').__text__ != __text__ ||
OfficeExcel.Registry.Get('chart.tooltip').__index__ != __index__ ||
OfficeExcel.Registry.Get('chart.tooltip').__dataset__ != __dataset__
) {
if (obj._tooltip._highlight) {
OfficeExcel.Redraw();
}
/**
* Show the tooltip
*/
if (text) {
canvas.style.cursor = 'pointer';
OfficeExcel.Tooltip(canvas, text, e.pageX, e.pageY, __index__);
OfficeExcel.Registry.Get('chart.tooltip').__text__ = obj.data[__dataset__][__index__][3];
}
OfficeExcel.Registry.Get('chart.tooltip').__index__ = __index__;
if (OfficeExcel.Registry.Get('chart.tooltip')) {
OfficeExcel.Registry.Get('chart.tooltip').__dataset__ = __dataset__;
}
/**
* Draw a circle around the mark. Also highlight the boxplot if necessary
*/
if (obj._tooltip._highlight && typeof(point[0]) == 'object') {
context.beginPath();
context.strokeStyle = 'black';
context.fillStyle = 'rgba(255,255,255,0.5)';
context.strokeRect(point[0][0], point[1][0], point[0][1], point[1][1]);
context.fillRect(point[0][0], point[1][0], point[0][1], point[1][1]);
context.stroke();
context.fill();
} else if (obj._tooltip._highlight && typeof(point[0]) == 'number') {
context.beginPath();
context.fillStyle = 'rgba(255,255,255,0.5)';
context.arc(point[0], point[1], 3, 0, 6.28, 0);
context.fill();
}
// Just change the mouse pointer
} else if (point[4] && text) {
e.target.style.cursor = 'pointer';
}
}
}
/**
* Reset the pointer
*/
if (!overHotspot || !point[4]) {
canvas.style.cursor = 'default';
}
}
this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
OfficeExcel.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
}
/**
* Draw the key if necessary
......@@ -391,18 +227,6 @@
* Draw the "in graph" labels, using the member function, NOT the shared function in OfficeExcel.common.core.js
*/
this.DrawInGraphLabels(this);
/**
* Draw crosschairs
*/
OfficeExcel.DrawCrosshairs(this);
/**
* Fire the OfficeExcel ondraw event
*/
OfficeExcel.FireCustomEvent(this, 'ondraw');
}
/**
......@@ -583,40 +407,16 @@
*/
if(!this._otherProps._noxaxis)
{
if('auto' == this._otherProps._ylabels_count)
var x = this._chartGutter._left;
var yStart = this.nullPositionOY;
var yEnd = this.nullPositionOY + 5;
for (var j=0; j <= this._otherProps._background_grid_autofit_numvlines; j++)
{
var x = this._chartGutter._left;
var yStart = this.nullPositionOY;
var yEnd = this.nullPositionOY + 5;
for (var j=0; j <= this._otherProps._background_grid_autofit_numvlines; j++)
{
var newX = x + ((this.canvas.width - this._chartGutter._right - this._chartGutter._left)/(this._otherProps._background_grid_autofit_numvlines))*j;
if(j == this._otherProps._background_grid_autofit_numvlines)
newX = this.canvas.width - this._chartGutter._right;
this.context.moveTo(AA(this, newX), yStart);
this.context.lineTo(AA(this, newX), yEnd);
}
}
else if (this._otherProps._xticks && this._otherProps._xaxis) {
var x = 0;
var y = (this._otherProps._xaxispos == 'center') ? this._chartGutter._top + (this.grapharea / 2): (this.canvas.height - this._chartGutter._bottom);
this.xTickGap = (this.Get('chart.labels') && this.Get('chart.labels').length) ? ((this.canvas.width - this.gutterLeft - this.gutterRight ) / this.Get('chart.labels').length) : (this.canvas.width - this.gutterLeft - this.gutterRight) / 10;
for (x = (this._chartGutter._left + (this._otherProps._yaxispos == 'left' ? this.xTickGap : 0) );
x <= (this.canvas.width - this._chartGutter._right - (this._otherProps._yaxispos == 'left' ? -1 : 1));
x += this.xTickGap) {
if (this._otherProps._yaxispos == 'left' && this._otherProps._noendxtick == true && x == (this.canvas.width - this._chartGutter._right) ) {
continue;
} else if (this._otherProps._yaxispos == 'right' && this._otherProps._noendxtick == true && x == this._chartGutter._left) {
continue;
}
context.moveTo(AA(this, x), y - (this._otherProps._xaxispos == 'center' ? 3 : 0));
context.lineTo(AA(this, x), y + 3);
}
var newX = x + ((this.canvas.width - this._chartGutter._right - this._chartGutter._left)/(this._otherProps._background_grid_autofit_numvlines))*j;
if(j == this._otherProps._background_grid_autofit_numvlines)
newX = this.canvas.width - this._chartGutter._right;
this.context.moveTo(AA(this, newX), yStart);
this.context.lineTo(AA(this, newX), yEnd);
}
}
context.stroke();
......@@ -1653,11 +1453,6 @@
}
}
/**
* Turn off any shadow
*/
OfficeExcel.NoShadow(obj);
if (labels_processed && labels_processed.length > 0) {
var i=0;
......@@ -1710,66 +1505,6 @@
}
}
/**
* This function makes it much easier to get the (if any) point that is currently being hovered over.
*
* @param object e The event object
*/
OfficeExcel.Scatter.prototype.getPoint = function (e)
{
var canvas = e.target;
var obj = canvas.__object__;
var context = obj.context;
var mouseXY = OfficeExcel.getMouseXY(e);
var mouseX = mouseXY[0];
var mouseY = mouseXY[1];
var overHotspot = false;
var offset = obj._tooltip._hotspot;
for (var _set=0; _set<obj.coords.length; ++_set) {
for (var i=0; i<obj.coords[_set].length; ++i) {
var xCoord = obj.coords[_set][i][0];
var yCoord = obj.coords[_set][i][1];
if (typeof(yCoord) == 'number') {
if (mouseX <= (xCoord + offset) &&
mouseX >= (xCoord - offset) &&
mouseY <= (yCoord + offset) &&
mouseY >= (yCoord - offset)) {
return [xCoord, yCoord, _set, i, obj.data[_set][i][3]];
}
} else {
var mark = obj.data[_set][i];
/**
* Determine the width
*/
var width = obj._otherProps._boxplot_width;
if (typeof(mark[1][7]) == 'number') {
width = mark[1][7];
}
if ( typeof(xCoord) == 'object'
&& mouseX > xCoord[0]
&& mouseX < xCoord[1]
&& mouseY < yCoord[3]
&& mouseY > yCoord[1]
) {
return [[xCoord[0], xCoord[1] - xCoord[0]], [yCoord[1], yCoord[3] - yCoord[1]], _set, i, obj.data[_set][i][3]];
}
}
}
}
}
/**
* Draws the above line labels
*/
......
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