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

изменил отрисовку текста в диаграммах(рисуем через Asc.DrawingContext),добавил...

изменил отрисовку текста в диаграммах(рисуем через Asc.DrawingContext),добавил изменения в отрисовке всех графиков.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47393 954022d7-b5bf-4e40-9824-e11837661b57
parent 5b80048b

var bar;
var bar;
var chartCanvas = null;
var g_bChartPreview = false;
......@@ -373,26 +372,6 @@ function OnFormatText(command) {
//-----------------------------------------------------------------------------------
function calcGutter(axis,min,max,ymin,ymax,isSkip,isFormatCell) {
/*if (typeof (bar.data[0]) == 'object') {
var arrMin = [];
var arrMax = [];
for (var j = 0; j < bar.data.length; j++) {
min = Math.min.apply(null, bar.data[j]);
max = Math.max.apply(null, bar.data[j]);
arrMin[j] = min;
arrMax[j] = max;
}
var min = Math.min.apply(null, arrMin);
var max = Math.max.apply(null, arrMax);
}
else {
var min = Math.min.apply(null, bar.data);
var max = Math.max.apply(null, bar.data);
}
if(isNaN(min) && isNaN(min))
{
min = 0;max = 0;
}*/
var scale = bar.scale
if(undefined == scale)
scale = [max, min]
......@@ -516,7 +495,7 @@ function calcWidthGraph() {
}
function calcAllMargin(isFormatCell,isformatCellScOy,minX,maxX,minY,maxY) {
function calcAllMargin(isFormatCell,isformatCellScOy,minX,maxX,minY,maxY, chart) {
if (typeof (bar.data[0]) == 'object') {
var arrMin = [];
var arrMax = [];
......@@ -541,19 +520,51 @@ function calcAllMargin(isFormatCell,isformatCellScOy,minX,maxX,minY,maxY) {
var left = 0;
var standartMargin = 14;
bar.context.font = '13px Arial'
bar.context.font = '13px Arial';
if(bar.scale != undefined && bar.scale[bar.scale.length -1] != undefined && bar._otherProps._ylabels != false)
//для определении ширины текста(подписи оси OY), необходимо получить scale
var tempScale;
if(!bar.scale && bar.type != "pie")
{
if(bar.type == 'hbar' && bar._otherProps._autoGrouping == 'stackedPer')
{
for (i=0; i<bar.data.length; ++i) {
if (typeof(bar.data[i]) == 'object') {
var value = Number(OfficeExcel.array_max(bar.data[i], true));
} else {
var value = Number(Math.abs(bar.data[i]));
}
bar.max = Math.max(Math.abs(bar.max), Math.abs(value));
}
tempScale = OfficeExcel.getScale(bar.max);
}
else
tempScale = OfficeExcel.getScale(Math.abs(parseFloat(chart.max)),bar,chart.min,chart.max);
if(bar.type == 'bar')
bar.min = bar._otherProps._ymin;
else if(bar.type == 'hbar')
{
bar._otherProps._background_grid_autofit_numvlines = tempScale.length;
bar._otherProps._background_grid_autofit_numhlines = bar.data.length;
}
}
else
tempScale = bar.scale;
if(tempScale != undefined && tempScale[tempScale.length -1] != undefined && bar._otherProps._ylabels != false)
{
//left = bar.context.measureText(bar.scale[bar.scale.length -1]).width;
var tempArr = [];
for (var j = 0; j < bar.scale.length; j++) {
for (var j = 0; j < tempScale.length; j++) {
if(bar.type == 'hbar')
tempArr[j] = bar.context.measureText(bar.scale[j]).width
tempArr[j] = bar.context.measureText(tempScale[j]).width
else if(bar.type == 'scatter')
tempArr[j] = bar.context.measureText(OfficeExcel.numToFormatText(bar.scale[j],isformatCellScOy)).width
tempArr[j] = bar.context.measureText(OfficeExcel.numToFormatText(tempScale[j],isformatCellScOy)).width
else
tempArr[j] = bar.context.measureText(OfficeExcel.numToFormatText(bar.scale[j],isFormatCell)).width
tempArr[j] = bar.context.measureText(OfficeExcel.numToFormatText(tempScale[j],isFormatCell)).width
}
if((bar.type == 'hbar' && min < 0 )|| ( bar.type == 'scatter' && bar._otherProps._type != 'burse2' && minX < 0))
left = 0
......@@ -592,8 +603,6 @@ function calcAllMargin(isFormatCell,isformatCellScOy,minX,maxX,minY,maxY) {
left += 95;
else if (bar._yAxisTitle._align == 'ver')
left += 0;
//if(bar._otherProps._ylabels == false && left > 0)
//left += -30;
var right = 0;
if (bar._otherProps._key_halign == 'right')
......@@ -624,10 +633,6 @@ function calcAllMargin(isFormatCell,isformatCellScOy,minX,maxX,minY,maxY) {
bar._chartGutter._left = standartMargin + left;
bar._chartGutter._right = standartMargin + right;
bar._chartGutter._top = standartMargin + top;
/*if(bar._otherProps._xlabels != false && bar.type != 'pie')
standartMargin = 0;
if(bottom < 0)
bottom = 0;*/
bar._chartGutter._bottom = bottom + standartMargin;
}
......@@ -683,7 +688,6 @@ function checkDataRange(type,subType,dataRange,isRows,worksheet) {
function formulaToRange(formula, worksheet) {
var range = null;
if ( formula && worksheet ) {
var ref3D = parserHelp.is3DRef(formula, 0);
if ( !ref3D[0] )
......@@ -692,7 +696,6 @@ function formulaToRange(formula, worksheet) {
var resultRef = parserHelp.parse3DRef(formula);
if ( null !== resultRef ) {
var ws = worksheet.workbook.getWorksheetByName(resultRef.sheet);
//var ws = worksheet.workbook.getWorksheetByName(resultRef.sheet);
if ( ws )
range = ws.getRange2(resultRef.range);
}
......@@ -1166,15 +1169,6 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart) {
}
}
/*if(chart.type == 'Stock' && isNewChart)
{
if((chart.range.columns && arrValues[0].length != 4) || (chart.range.rows && arrValues.length != 4))
{
chart.range.intervalObject.worksheet.workbook.handlers.trigger("asc_onError", c_oAscError.ID.StockChartError, c_oAscError.Level.NoCritical)
return false;
}
}*/
if(isSeries)
var arrValuesRev = arrValues;
isEn = false;
......@@ -1400,10 +1394,6 @@ function drawChart(chart, arrValues, width, height) {
// Цвета и шрифты
bar._otherProps._axis_color = 'grey';
bar._otherProps._background_grid_color = 'graytext';
bar._otherProps._key_text_size = 10;
bar._otherProps._key_text_font = 'Arial';
bar._otherProps._text_font = 'Arial';
bar._otherProps._text_font_size = 8;
if('Line' == chart.type || 'Area' == chart.type)
bar._otherProps._colors = generateColors(data.length, arrBaseColors, true);
else if(chart.type == 'HBar')
......@@ -1418,26 +1408,12 @@ function drawChart(chart, arrValues, width, height) {
chart.xAxis.title = defaultXTitle;
if((!chart.header.title || chart.header.title == null || chart.header.title == undefined || chart.header.title == '') && chart.header.bDefaultTitle)
chart.header.title = defaultTitle;
if (chart.yAxis.title)
bar._chartGutter._left = 35 + 29;
else
bar._chartGutter._left = 35;
if (chart.xAxis.title)
bar._chartGutter._bottom = 35 + 29;
else
bar._chartGutter._bottom = 35;
calcWidthGraph();
//bar.Draw();
// Легенда
if (chart.legend.bShow && chart.legend.position != '') {
bar._otherProps._key_position = 'graph';
bar._otherProps._key = [];
bar._otherProps._key_halign = chart.legend.position;
//setKeyPosition(chart);
var legendCnt = (chart.type == "Scatter") ? data.length : data.length;
if(chart.type == 'Pie' || chart.type == 'Bar' || chart.type == 'HBar')
......@@ -1457,14 +1433,12 @@ function drawChart(chart, arrValues, width, height) {
}
}
// без рамки
bar._otherProps._key_rounded = null;
if (bar._otherProps._filled != true && bar.type != 'bar' && bar.type != 'hbar' && bar.type != 'pie')
bar._otherProps._key_color_shape = 'line';
bar._otherProps._key_text_size = 9;
if(chart.type == 'HBar' && chart.subType != 'stacked' && chart.subType != 'stackedPer')
{
......@@ -1490,7 +1464,6 @@ function drawChart(chart, arrValues, width, height) {
bar._otherProps._key = [];
}
// Подписи данных
if(chart.type != 'Stock')
{
......@@ -1500,7 +1473,6 @@ function drawChart(chart, arrValues, width, height) {
bar._otherProps._labels_above = true;
else
bar._otherProps._labels_above = false;
bar._otherProps._labels_above_size = 10;
}
// Название
......@@ -1508,7 +1480,6 @@ function drawChart(chart, arrValues, width, height) {
bar._chartTitle._text = chart.header.title;
bar._chartTitle._vpos = 32;
bar._chartTitle._hpos = 0.5;
bar._chartTitle._size = 18;
}
if (chart.xAxis.title) {
......@@ -1517,7 +1488,6 @@ function drawChart(chart, arrValues, width, height) {
if(chart.legend.position == 'bottom')
legendTop = 30;
bar._xAxisTitle._text = chart.xAxis.title;
bar._xAxisTitle._size = 10;
}
if (chart.yAxis.title) {
......@@ -1528,7 +1498,6 @@ function drawChart(chart, arrValues, width, height) {
if (bar._otherProps._key_halign == 'left')
keyLeft = 70;
bar._yAxisTitle._angle = 'null';
bar._yAxisTitle._size = 10;
}
// Основная сетка
......@@ -1537,7 +1506,7 @@ function drawChart(chart, arrValues, width, height) {
var axis;
calcGutter(axis,chart.min,chart.max,chart.ymin,chart.ymax,chart.isSkip,chart.isFormatCell);
calcAllMargin(chart.isFormatCell,chart.isformatCellScOy,chart.min,chart.max,chart.ymin,chart.ymax);
calcAllMargin(chart.isFormatCell,chart.isformatCellScOy,chart.min,chart.max,chart.ymin,chart.ymax, chart);
calcWidthGraph();
if (chart.xAxis.title)
......@@ -1551,7 +1520,8 @@ function drawChart(chart, arrValues, width, height) {
bar._yAxisTitle._vpos = bar._chartGutter._top + (bar.canvas.height - bar._chartGutter._top - bar._chartGutter._bottom) / 2 ;
bar._yAxisTitle._hpos = 23 + keyLeft;
}
//выставляем параметры текса
setFontChart(chart);
bar.Draw(chart.min,chart.max,chart.ymin,chart.ymax,chart.isSkip,chart.isFormatCell,chart.isformatCellScOy);
}
......@@ -1622,7 +1592,7 @@ function DrawScatterChart(chartCanvas, chartSubType, data, chart) {
data = newData;
}
bar = new OfficeExcel.Scatter(chartCanvas, data);
bar = new OfficeExcel.Scatter(chartCanvas, data);
if(chartSubType == 'Stock')
{
bar._otherProps._type = 'burse2';
......@@ -1641,12 +1611,8 @@ function DrawScatterChart(chartCanvas, chartSubType, data, chart) {
}
bar._chartGutter._left = 45;
//bar._otherProps._background_grid_autofit_numvlines = data.length;
//addOptions('chart.gutter.right',70);
bar._chartGutter._right = 90;
//addOptions('chart.gutter.top',50);
bar._chartGutter._top = 13;
//addOptions('chart.gutter.bottom',50);
bar._chartGutter._bottom = 30;
//для соединения линий
bar._otherProps._area_border = chart.bShowBorder;
......@@ -1660,8 +1626,6 @@ function DrawScatterChart(chartCanvas, chartSubType, data, chart) {
bar._otherProps._line_colors = colors;
bar._otherProps._linewidth = 3;
bar._otherProps._ylabels_count = 'auto';
//bar._otherProps._xmax = 360;
//bar._otherProps._ymax = 1;
bar._otherProps._scale_decimals = 1;
bar._otherProps._xscale_decimals = 0;
bar._otherProps._tickmarks = 'diamond';
......@@ -1669,8 +1633,6 @@ function DrawScatterChart(chartCanvas, chartSubType, data, chart) {
bar._otherProps._tickmarks_dot_color = 'steelblue';
bar._otherProps._xscale = 'true';
bar._otherProps._gutter_left = 50;
bar._otherProps._key_text_size = 10;
bar._otherProps._text_font = 'Arial';
bar._otherProps._axis_color = 'grey';
//для биржевой диаграммы
if (original_data != undefined) {
......@@ -1699,14 +1661,11 @@ function DrawScatterChart(chartCanvas, chartSubType, data, chart) {
function DrawPieChart(chartCanvas, chartSubType, data, chart) {
bar = new OfficeExcel.Pie(chartCanvas, data);
bar = new OfficeExcel.Pie(chartCanvas, data);
//для кольцевой диаграммы
//bar._otherProps._variant = 'donut';
//для разрезанной кольцевой или разрезанной круговой
//bar._otherProps._exploded = 15;
bar._otherProps._area_border = chart.bShowBorder;
bar._otherProps._ylabels_count = 'auto';
bar._otherProps._colors = ['steelblue', 'IndianRed', 'Silver'];
......@@ -1715,23 +1674,20 @@ function DrawPieChart(chartCanvas, chartSubType, data, chart) {
bar._chartGutter._top = 13;
bar._chartGutter._bottom = 30;
bar._otherProps._key_rounded = null;
bar.Draw(chart.min,chart.max,chart.ymin,chart.ymax,chart.isSkip,chart.isFormatCell);
}
function DrawLineChart(chartCanvas, chartType, chartSubType, data, chart) {
var copyData = $.extend(true, [], data);
bar = new OfficeExcel.Line(chartCanvas, data);
bar.firstData = copyData;
bar._otherProps._autoGrouping = chartType;
//в случае поверхностной диаграммы
if (chartSubType == c_oAscChartType.area)
bar._otherProps._filled = true;
//для нормированных графиков с накоплением и без него.
//bar._otherProps._autoGrouping = 'stackedPer';
//для нормированных графиков с накоплением и без него
if (bar._otherProps._autoGrouping == 'stacked') {
for (var j = 0; j < (data.length - 1); j++) {
for (var i = 0; i < data[j].length; i++) {
......@@ -1773,11 +1729,9 @@ function DrawLineChart(chartCanvas, chartType, chartSubType, data, chart) {
bar.firstData = copyData;
bar._otherProps._ylabels_count = 'auto';
//для поверхностной диаграммы выставляем свойство
//bar._otherProps._filled = true;
//обводка графика для поверхностной диаграммы
bar._otherProps._filled_accumulative = false;
if (bar._otherProps._filled != true) {
bar._chartGutter._left = 35;
bar._chartGutter._bottom = 35;
......@@ -1788,24 +1742,10 @@ function DrawLineChart(chartCanvas, chartType, chartSubType, data, chart) {
bar._otherProps._background_grid_color = 'graytext';
bar._otherProps._background_barcolor1 = 'white';
bar._otherProps._background_barcolor2 = 'white';
//bar._otherProps._fillstyle = [['steelblue'],['red'],['black'],['grey']];
bar._otherProps._colors = ['steelblue', 'IndianRed', 'green', 'grey'];
bar._otherProps._linewidth = 3;
//bar._otherProps._noxaxis = true;
//bar._otherProps._noyaxis = true;
//для подписей данных
// bar._otherProps._labels_above = true;
//для графика с маркерами
//bar._otherProps._tickmarks = ['filledendsquare','filledsquare','filledarrow'];
//bar._otherProps._fillstyle = '#fcc';
//bar._otherProps._numxticks = data.length;
//bar._otherProps._background_grid_autofit_numhlines = 10;
//bar._otherProps._numyticks = 10;
//bar._otherProps._ylabels_count = 10
//bar._otherProps._background_grid_autofit_numhlines =
var tempMas = [];
if ('object' == typeof data[0]) {
var testMas = [];
......@@ -1826,17 +1766,15 @@ function DrawLineChart(chartCanvas, chartType, chartSubType, data, chart) {
tempMas[i] = i;
}
}
bar._otherProps._labels = tempMas;
//отключаем вертикальную сетку
//bar._otherProps._background_grid_vlines = false;
//bar._otherProps._background_grid_border = false;
//bar._otherProps._ymax = 60;
//bar._otherProps._ymin = 50;
//подписи по оси OX
if(chart && chart.series && chart.series[0] && chart.series[0].xVal && chart.series[0].xVal.NumCache)
bar._otherProps._labels = chart.series[0].xVal.NumCache;
else
bar._otherProps._labels = tempMas;
if (bar._otherProps._autoGrouping == 'stackedPer')
bar._otherProps._units_post = '%';
bar.Draw(chart.min,chart.max,chart.ymin,chart.ymax,chart.isSkip,chart.isFormatCell);
if (bar._otherProps._filled != true)
bar._otherProps._hmargin = bar._otherProps._background_grid_vsize / 2;
else
......@@ -1845,7 +1783,7 @@ function DrawLineChart(chartCanvas, chartType, chartSubType, data, chart) {
function DrawBarChart(chartCanvas, chartSubType, data, chart) {
bar = new OfficeExcel.Bar(chartCanvas, data);
bar = new OfficeExcel.Bar(chartCanvas, data);
//меняем входные данные для нормированной диаграммы
bar._otherProps._autoGrouping = chartSubType;
//с накоплениями
......@@ -1877,16 +1815,16 @@ function DrawBarChart(chartCanvas, chartSubType, data, chart) {
bar._otherProps._background_grid_color = 'graytext';
bar._otherProps._background_barcolor1 = 'white';
bar._otherProps._background_barcolor2 = 'white';
//bar._otherProps._background_grid_autofit_numhlines = 6;
//bar._otherProps._linewidth = 10;
//bar._otherProps._key = ['ряд1'];
var tempMas = [];
for (var i = 0; i < data.length; i++) {
tempMas[i] = i + 1;
}
bar._otherProps._labels = tempMas;
bar.Draw(chart.min,chart.max,chart.ymin,chart.ymax,chart.isSkip,chart.isFormatCell);
//подписи по оси OX
if(chart && chart.series && chart.series[0] && chart.series[0].xVal && chart.series[0].xVal.NumCache)
bar._otherProps._labels = chart.series[0].xVal.NumCache;
else
bar._otherProps._labels = tempMas;
//отступы меняют ширину
if (bar._otherProps._autoGrouping == 'stacked' || bar._otherProps._autoGrouping == 'stackedPer') {
......@@ -1909,7 +1847,7 @@ function DrawHBarChart(chartCanvas, chartSubType, data, chart) {
}
data = OfficeExcel.array_reverse(data);
bar = new OfficeExcel.HBar(chartCanvas, data);
bar = new OfficeExcel.HBar(chartCanvas, data);
bar._otherProps._autoGrouping = chartSubType;
var originalData = $.extend(true, [], data);
......@@ -1969,15 +1907,16 @@ function DrawHBarChart(chartCanvas, chartSubType, data, chart) {
for (var i = 0; i < data.length; i++) {
tempMas[data.length - i - 1] = i + 1;
}
bar._otherProps._labels = tempMas;
//подписи по оси OY
if(chart && chart.series && chart.series[0] && chart.series[0].xVal && chart.series[0].xVal.NumCache)
bar._otherProps._labels = chart.series[0].xVal.NumCache;
else
bar._otherProps._labels = tempMas;
bar._otherProps._background_grid_autofit_numhlines = data.length;
bar._otherProps._numyticks = data.length;
bar._chartGutter._left = 45;
//addOptions('chart.gutter.right',70);
bar._chartGutter._right = 90;
//addOptions('chart.gutter.top',50);
bar._chartGutter._top = 13;
//addOptions('chart.gutter.bottom',50);
bar._chartGutter._bottom = 30;
//аналогично для измения высоты(ширины)
if (bar._otherProps._autoGrouping == 'stacked' || bar._otherProps._autoGrouping == 'stackedPer') {
......@@ -1988,18 +1927,8 @@ function DrawHBarChart(chartCanvas, chartSubType, data, chart) {
else
bar._otherProps._vmargin = (((bar.canvas.height - (bar._chartGutter._top + bar._chartGutter._bottom)) * 0.3) / bar.data.length) / bar.data[0].length;
bar._otherProps._key_text_size = 10;
bar._otherProps._text_font = 'Arial';
//для того, чтобы не строить рамку вокруг легенды
bar._otherProps._key_rounded = null;
bar.Draw(chart.min,chart.max,chart.ymin,chart.ymax,chart.isSkip,chart.isFormatCell);
bar._otherProps._background_grid_autofit_numvlines = bar.scale.length;
bar._otherProps._background_grid_autofit_numhlines = data.length;
//отключаем горизонтальную сетку
//bar._otherProps._background_grid_hlines = false;
//bar._otherProps._background_grid_border = false;
}
function findPrevValue(originalData, num, max) {
......@@ -2016,4 +1945,90 @@ function findPrevValue(originalData, num, max) {
}
}
return summ;
}
\ No newline at end of file
}
function setFontChart(chart)
{
var defaultColor = "#000000"
var defaultFont = "Arial";
var defaultSize = "10";
if(chart.header.font)//заголовок
{
bar._chartTitle._bold = chart.header.font.bold ? chart.header.font.bold : true;
bar._chartTitle._color = chart.header.font.color ? chart.header.font.color : defaultColor;
bar._chartTitle._font = chart.header.font.name ? chart.header.font.name : defaultFont;
bar._chartTitle._size = chart.header.font.size ? chart.header.font.size : defaultSize;
bar._chartTitle._italic = chart.header.font.italic ? chart.header.font.italic : false;
bar._chartTitle._underline = chart.header.font.underline ? chart.header.font.underline : false;
}
if(chart.xAxis.titleFont)//название оси OX
{
bar._xAxisTitle._bold = chart.xAxis.titleFont.bold ? chart.xAxis.titleFont.bold : true;
bar._xAxisTitle._color = chart.xAxis.titleFont.color ? chart.xAxis.titleFont.color : defaultColor;
bar._xAxisTitle._font = chart.xAxis.titleFont.name ? chart.xAxis.titleFont.name : defaultFont;
bar._xAxisTitle._size = chart.xAxis.titleFont.size ? chart.xAxis.titleFont.size : defaultSize;
bar._xAxisTitle._italic = chart.xAxis.titleFont.italic ? chart.xAxis.titleFont.italic : false;
bar._xAxisTitle._underline = chart.xAxis.titleFont.underline ? chart.xAxis.titleFont.underline : false;
}
if(chart.yAxis.titleFont)//название оси OY
{
bar._yAxisTitle._bold = chart.yAxis.titleFont.bold ? chart.yAxis.titleFont.bold : true;
bar._yAxisTitle._color = chart.yAxis.titleFont.color ? chart.yAxis.titleFont.color : defaultColor;
bar._yAxisTitle._font = chart.yAxis.titleFont.name ? chart.yAxis.titleFont.name : defaultFont;
bar._yAxisTitle._size = chart.yAxis.titleFont.size ? chart.yAxis.titleFont.size : defaultSize;
bar._yAxisTitle._italic = chart.yAxis.titleFont.italic ? chart.yAxis.titleFont.italic : false;
bar._yAxisTitle._underline = chart.yAxis.titleFont.underline ? chart.yAxis.titleFont.underline : false;
}
if(chart.legend.font)//подписи легенды
{
bar._otherProps._key_text_bold = chart.legend.font.bold ? chart.legend.font.bold : false;
bar._otherProps._key_text_color = chart.legend.font.color ? chart.legend.font.color : defaultColor;
bar._otherProps._key_text_font = chart.legend.font.name ? chart.legend.font.name : defaultFont;
bar._otherProps._key_text_size = chart.legend.font.size ? chart.legend.font.size : 10;
bar._otherProps._key_text_italic = chart.legend.font.italic ? chart.legend.font.italic : false;
bar._otherProps._key_text_underline = chart.legend.font.underline ? chart.legend.font.underline : false;
}
if(chart.xAxis.labelFont)//значения по оси OX
{
bar._otherProps._xlabels_bold = chart.xAxis.labelFont.bold ? chart.xAxis.labelFont.bold : false;
bar._otherProps._xlabels_color = chart.xAxis.labelFont.color ? chart.xAxis.labelFont.color : defaultColor;
bar._otherProps._xlabels_font = chart.xAxis.labelFont.name ? chart.xAxis.labelFont.name : defaultFont;
bar._otherProps._xlabels_size = chart.xAxis.labelFont.size ? chart.xAxis.labelFont.size : defaultSize;
bar._otherProps._xlabels_italic = chart.xAxis.labelFont.italic ? chart.xAxis.labelFont.italic : false;
bar._otherProps._xlabels_underline = chart.xAxis.labelFont.underline ? chart.xAxis.labelFont.underline : false;
}
if(chart.yAxis.labelFont)//значения по оси OY
{
bar._otherProps._ylabels_bold = chart.yAxis.labelFont.bold ? chart.yAxis.labelFont.bold : false;
bar._otherProps._ylabels_color = chart.yAxis.labelFont.color ? chart.yAxis.labelFont.color : defaultColor;
bar._otherProps._ylabels_font = chart.yAxis.labelFont.name ? chart.yAxis.labelFont.name : defaultFont;
bar._otherProps._ylabels_size = chart.yAxis.labelFont.size ? chart.yAxis.labelFont.size : defaultSize;
bar._otherProps._ylabels_italic = chart.yAxis.labelFont.italic ? chart.yAxis.labelFont.italic : false;
bar._otherProps._ylabels_underline = chart.yAxis.labelFont.underline ? chart.yAxis.labelFont.underline : false;
}
if(chart.legend.font)//подписи значений графика
{
bar._otherProps._labels_above_bold = chart.legend.font.bold ? chart.legend.font.bold : false;
bar._otherProps._labels_above_color = chart.legend.font.color ? chart.legend.font.color : defaultColor;
bar._otherProps._labels_above_font = chart.legend.font.name ? chart.legend.font.name : defaultFont;
bar._otherProps._labels_above_size = chart.legend.font.size ? chart.legend.font.size : defaultSize;
bar._otherProps._labels_above_italic = chart.legend.font.italic ? chart.legend.font.italic : false;
bar._otherProps._labels_above_underline = chart.legend.font.underline ? chart.legend.font.underline : false;
}
if(chart.xAxis.font)//остальные подписи
{
bar._otherProps._text_color = defaultColor;
bar._otherProps._text_bold = false;
bar._otherProps._text_italic = false;
bar._otherProps._text_underline = false;
bar._otherProps._text_font = defaultFont;
bar._otherProps._text_size = defaultSize;
}
}
......@@ -72,7 +72,11 @@
*/
OfficeExcel.Bar.prototype.Draw = function (min,max,ymin,ymax,isSkip,isFormatCell)
{
// MUST be the first thing done!
this.max = max;
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;
......@@ -120,7 +124,6 @@
* Work out a few things. They need to be here because they depend on things you can change before you
* call Draw() but after you instantiate the object
*/
this.max = 0;
this.grapharea = OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom;
this.halfgrapharea = this.grapharea / 2;
this.halfTextHeight = this._otherProps._text_size / 2;
......@@ -140,19 +143,6 @@
OfficeExcel.InstallUserClickListener(this, this._otherProps._events_click);
OfficeExcel.InstallUserMousemoveListener(this, this._otherProps._events_mousemove);
/*for (i=0; i<this.data.length; ++i) {
if (typeof(this.data[i]) == 'object') {
var value = this._otherProps._grouping == 'grouped' ? Number(OfficeExcel.array_max(this.data[i], true)) : Number(OfficeExcel.array_sum(this.data[i])) ;
} else {
var value = Number(this.data[i]);
}*/
this.max = max;
//}
this.scale = OfficeExcel.getScale(this.max, this,min,max);
//If it's a sketch chart variant, draw the axes first
if (this._otherProps._variant == 'sketch') {
......@@ -624,6 +614,14 @@
var strokeStyle = this._otherProps._strokecolor;
var colors = this._otherProps._colors;
var sequentialColorIndex = 0;
var bold = this._otherProps._labels_above_bold;
var textOptions =
{
color: this._otherProps._labels_above_color,
italic: this._otherProps._labels_above_italic,
underline: this._otherProps._labels_above_underline
};
for (i=0; i<this.data.length; ++i) {
......@@ -852,7 +850,7 @@
this.context.fillStyle = this._otherProps._text_color;
OfficeExcel.Text(this.context,
this._otherProps._text_font,
this._otherProps._labels_above_font,
typeof(this._otherProps._labels_above_size) == 'number' ? this._otherProps._labels_above_size : this._otherProps._text_size - 3,
x + hmargin + (barWidth / 2),
yPos,
......@@ -860,7 +858,11 @@
this._otherProps._labels_above_angle ? 'bottom' : null,
this._otherProps._labels_above_angle ? (this._otherProps._labels_above_angle > 0 && (this._otherProps._xaxispos != 'top') ? 'right' : 'left') : 'center',
null,
this._otherProps._labels_above_angle
this._otherProps._labels_above_angle,
null,
bold,
null,
textOptions
);
}
......@@ -1099,7 +1101,7 @@
this.context.fillStyle = this._otherProps._text_color;
OfficeExcel.Text(this.context,
this._otherProps._text_font,
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),
......@@ -1107,7 +1109,10 @@
this._otherProps._labels_above_angle ? 'bottom' : null,
this._otherProps._labels_above_angle ? (this._otherProps._labels_above_angle > 0 ? 'right' : 'left') : 'center',
null,
this._otherProps._labels_above_angle);
this._otherProps._labels_above_angle,
null,
bold,
options);
// Turn any shadow back on
if (shadow) {
......@@ -1343,7 +1348,7 @@
this.context.fillStyle = this._otherProps._text_color;
OfficeExcel.Text(this.context,
this._otherProps._text_font,
this._otherProps._labels_above_font,
typeof(this._otherProps._labels_above_size) == 'number' ? this._otherProps._labels_above_size : this._otherProps._text_size - 3,startX + (individualBarWidth / 2),
startY - 2 - (this._otherProps._variant == '3d' ? 5 : 0),
//OfficeExcel.number_format(this, OfficeExcel.num_round(this.data[i][j]),this._otherProps._units_pre,this._otherProps._units_post),
......@@ -1351,7 +1356,11 @@
null,
this._otherProps._labels_above_angle ? (this._otherProps._labels_above_angle > 0 ? 'right' : 'left') : 'center',
null,
this._otherProps._labels_above_angle);
this._otherProps._labels_above_angle,
null,
bold,
null,
options);
// Turn any shadow back on
if (shadow) {
......@@ -1419,7 +1428,6 @@
{
var context = this.context;
var text_angle = this._otherProps._text_angle;
var text_size = this._otherProps._text_size;
var labels = this._otherProps._labels;
......@@ -1465,8 +1473,16 @@
// Draw the X tickmarks
var i=0;
var font = this._otherProps._text_font;
var font = this._otherProps._xlabels_font;
var bold = this._otherProps._xlabels_bold;
var textOptions =
{
color: this._otherProps._xlabels_color,
italic: this._otherProps._xlabels_italic,
underline: this._otherProps._xlabels_underline
}
var text_size = this._otherProps._xlabels_size;
if('auto' == this._otherProps._ylabels_count)
yOffset =+ 23;
for (x=this._chartGutter._left + (xTickGap / 2); x<=OfficeExcel.GetWidth(this) - this._chartGutter._right; x+=xTickGap) {
......@@ -1480,7 +1496,11 @@
(this._otherProps._text_angle == 90 ? 'center' : null),
halign,
null,
angle);
angle,
null,
bold,
null,
textOptions);
}
else
{
......@@ -1492,7 +1512,11 @@
(this._otherProps._text_angle == 90 ? 'center' : null),
halign,
null,
angle);
angle,
null,
bold,
null,
textOptions);
}
}
......@@ -1512,12 +1536,19 @@
var context = this.context;
var interval = (this.grapharea * (1/5) );
var text_size = this._otherProps._text_size;
var text_size = this._otherProps._ylabels_size;
var units_pre = this._otherProps._units_pre;
var units_post = this._otherProps._units_post;
var align = this._otherProps._yaxispos == 'left' ? 'right' : 'left';
var font = this._otherProps._text_font;
var font = this._otherProps._ylabels_font;
var numYLabels = this._otherProps._ylabels_count;
var bold = this._otherProps._ylabels_bold;
var textOptions =
{
color: this._otherProps._ylabels_color,
italic: this._otherProps._ylabels_italic,
underline: this._otherProps._ylabels_underline,
}
if (this._otherProps._ylabels_inside == true) {
var xpos = this._otherProps._yaxispos == 'left' ? this._chartGutter._left + 5 : OfficeExcel.GetWidth(this) - this._chartGutter._right - 5;
......@@ -1547,9 +1578,9 @@
elemArr = Math.round(OfficeExcel.array_exp(scale[scale.length - 1] - (scale[scale.length - 2] - scale[scale.length - 1]))*floatKoff)/floatKoff ;
}
if(elemArr == 0)
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText(elemArr.toString(),isFormatCell),null, align, boxed);
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText(elemArr.toString(),isFormatCell),null, align, boxed, null, null, bold, null, textOptions);
else
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText("-" + elemArr.toString(),isFormatCell),null, align, boxed);
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText("-" + elemArr.toString(),isFormatCell),null, align, boxed, null, null, bold, null, textOptions);
}
}
else
......@@ -1566,7 +1597,7 @@
var y = this._chartGutter._top + (grapharea * (i / labels.length)) + (grapharea / labels.length);
OfficeExcel.Text(context, font, text_size, xpos, y, labels[i], 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, y, labels[i], 'center', align, boxed, null, null, bold, null, textOptions);
}
return;
......@@ -1577,18 +1608,18 @@
// 1(ish) label
if (numYLabels == 3 || numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
// 5 labels
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, (1*interval) + this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (3*interval) + this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (1*interval) + this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, (3*interval) + this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
}
// 3 labels
if (numYLabels == 3 || numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, (2*interval) + this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (4*interval) + this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (2*interval) + this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, (4*interval) + this._chartGutter._top + this.halfTextHeight + interval, '-' + OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
}
}
......@@ -1598,7 +1629,7 @@
interval = (this.grapharea / numYLabels );
for (var i=10; i>0; --i) {
OfficeExcel.Text(context, font, text_size, xpos,this._chartGutter._top + ((this.grapharea / numYLabels) * i),'-' + OfficeExcel.number_format(this,((this.scale[4] / numYLabels) * i).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xpos,this._chartGutter._top + ((this.grapharea / numYLabels) * i),'-' + OfficeExcel.number_format(this,((this.scale[4] / numYLabels) * i).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed, null, null, bold, null, textOptions);
}
}
......@@ -1614,7 +1645,7 @@
'-' + OfficeExcel.number_format(this,(this.min.toFixed((this._otherProps._scale_decimals))), units_pre, units_post),
'center',
align,
boxed);
boxed, null, null, bold, null, textOptions);
}
}
......@@ -1630,8 +1661,15 @@
*/
OfficeExcel.Bar.prototype.Drawlabels_center = function (isFormatCell)
{
var font = this._otherProps._text_font;
var font = this._otherProps._xlabels_font;
var numYLabels = this._otherProps._ylabels_count;
var bold = this._otherProps._xlabels_bold;
var textOptions =
{
color: this._otherProps._xlabels_color,
italic: this._otherProps._xlabels_italic,
underline: this._otherProps._xlabels_underline
}
this.context.fillStyle = this._otherProps._text_color;
......@@ -1641,7 +1679,7 @@
* Draw the top labels
*/
var interval = (this.grapharea * (1/10) );
var text_size = this._otherProps._text_size;
var text_size = this._otherProps._xlabels_size;
var units_pre = this._otherProps._units_pre;
var units_post = this._otherProps._units_post;
var context = this.context;
......@@ -1663,16 +1701,6 @@
}
/**
* Draw specific Y labels here so that the local variables can be reused
*/
......@@ -1686,14 +1714,14 @@
var y = this._chartGutter._top + ((grapharea / 2) / labels.length) * i;
OfficeExcel.Text(context, font, text_size, xpos, y, String(labels[i]), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, y, String(labels[i]), 'center', align, boxed, null, null, bold, null, textOptions);
}
// Draw the bottom halves labels
for (var i=labels.length-1; i>=0; --i) {
var y = this._chartGutter._top + (grapharea * ( (i+1) / (labels.length * 2) )) + (grapharea / 2);
OfficeExcel.Text(context, font, text_size, xpos, y, labels[labels.length - i - 1], 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, y, labels[labels.length - i - 1], 'center', align, boxed, null, null, bold, null, textOptions);
}
return;
......@@ -1714,20 +1742,20 @@
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed);
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, (1*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (1*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, (3*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed);
}
if (numYLabels == 3 || numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, (4*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (2*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (4*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, (2*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
}
} else if (numYLabels == 10) {
// 10Y labels
interval = (this.grapharea / numYLabels) / 2;
for (var i=0; i<numYLabels; ++i) {
OfficeExcel.Text(context, font, text_size, xpos,this._chartGutter._top + ((this.grapharea / (numYLabels * 2)) * i),OfficeExcel.number_format(this, ((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xpos,this._chartGutter._top + ((this.grapharea / (numYLabels * 2)) * i),OfficeExcel.number_format(this, ((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed, null, null, bold, null, textOptions);
}
}
///////////////////////////////////////////////////////////////////////////////////
......@@ -1739,16 +1767,16 @@
if (numYLabels == 3 || numYLabels == 5) {
if (numYLabels == 3 || numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, (this.grapharea + this._chartGutter._top + this.halfTextHeight) - (4 * interval), '-' + OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (this.grapharea + this._chartGutter._top + this.halfTextHeight) - (4 * interval), '-' + OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, (this.grapharea + this._chartGutter._top + this.halfTextHeight) - (2 * interval), '-' + OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed);
}
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, (this.grapharea + this._chartGutter._top + this.halfTextHeight) - (3 * interval), '-' + OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (this.grapharea + this._chartGutter._top + this.halfTextHeight) - interval, '-' + OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (this.grapharea + this._chartGutter._top + this.halfTextHeight) - (3 * interval), '-' + OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, (this.grapharea + this._chartGutter._top + this.halfTextHeight) - interval, '-' + OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
}
OfficeExcel.Text(context, font, text_size, xpos, this.grapharea + this._chartGutter._top + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, this.grapharea + this._chartGutter._top + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
} else if (numYLabels == 10) {
......@@ -1756,7 +1784,7 @@
interval = (this.grapharea / numYLabels) / 2;
for (var i=0; i<numYLabels; ++i) {
OfficeExcel.Text(context, font, text_size, xpos,this._chartGutter._top + (this.grapharea / 2) + ((this.grapharea / (numYLabels * 2)) * i) + (this.grapharea / (numYLabels * 2)),OfficeExcel.number_format(this, ((this.scale[4] / numYLabels) * (i+1)).toFixed((this._otherProps._scale_decimals)), '-' + units_pre, units_post),'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xpos,this._chartGutter._top + (this.grapharea / 2) + ((this.grapharea / (numYLabels * 2)) * i) + (this.grapharea / (numYLabels * 2)),OfficeExcel.number_format(this, ((this.scale[4] / numYLabels) * (i+1)).toFixed((this._otherProps._scale_decimals)), '-' + units_pre, units_post),'center', align, boxed, null, null, bold, null, textOptions);
}
}
......@@ -1774,7 +1802,7 @@
OfficeExcel.number_format(this,(this.min.toFixed((this._otherProps._scale_decimals))), units_pre, units_post),
'center',
align,
boxed);
boxed, null, null, bold, null, textOptions);
}
}
}
......@@ -1792,13 +1820,20 @@
if (this._otherProps._xaxispos != 'center' && this._otherProps._xaxispos != 'top') {
var interval = (this.grapharea * (1/5) );
var text_size = this._otherProps._text_size;
var text_size = this._otherProps._xlabels_size;
var units_pre = this._otherProps._units_pre;
var units_post = this._otherProps._units_post;
var context = this.context;
var align = this._otherProps._yaxispos == 'left' ? 'right' : 'left';
var font = this._otherProps._text_font;
var font = this._otherProps._xlabels_font;
var numYLabels = this._otherProps._ylabels_count;
var bold = this._otherProps._xlabels_bold;
var textOptions =
{
color: this._otherProps._xlabels_color,
italic: this._otherProps._xlabels_italic,
underline: this._otherProps._xlabels_underline
}
if (this._otherProps._ylabels_inside == true) {
var xpos = this._otherProps._yaxispos == 'left' ? this._chartGutter._left + 5 : OfficeExcel.GetWidth(this) - this._chartGutter._right - 5;
......@@ -1820,7 +1855,7 @@
for (var i=0; i<labels.length; ++i) {
var y = this._chartGutter._top + (grapharea * (i / labels.length));
OfficeExcel.Text(context, font, text_size, xpos, y, labels[i], 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, y, labels[i], 'center', align, boxed, null, null, bold, null, textOptions);
}
return;
......@@ -1835,24 +1870,24 @@
stepY = this._otherProps._ymin;
else*/
stepY = this.scale[this.scale.length -1 - i]
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText(stepY.toString(),isFormatCell) + units_post,null,align,boxed);
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText(stepY.toString(),isFormatCell) + units_post,null,align,boxed, null, null, bold, null, textOptions);
//OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.number_format(this, stepY, units_pre, units_post),null,align,boxed);
}
}
else if (numYLabels == 3 || numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
// 5 labels
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, (1*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (3*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (1*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, (3*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
}
// 3 labels
if (numYLabels == 3 || numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, (2*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (4*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, (2*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, (4*interval) + this._chartGutter._top + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed, null, null, bold, null, textOptions);
}
}
......@@ -1862,7 +1897,7 @@
interval = (this.grapharea / numYLabels );
for (var i=0; i<numYLabels; ++i) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ((this.grapharea / numYLabels) * i), OfficeExcel.number_format(this,((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ((this.grapharea / numYLabels) * i), OfficeExcel.number_format(this,((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed, null, null, bold, null, textOptions);
}
}
......@@ -1880,7 +1915,7 @@
this.min + units_post,
'center',
align,
boxed);
boxed, null, null, bold, null, textOptions);
}
else{
OfficeExcel.Text(context,
......@@ -1892,7 +1927,7 @@
//OfficeExcel.number_format(this,(this.min.toFixed((this._otherProps._scale_decimals))), units_pre, units_post),
'center',
align,
boxed);
boxed, null, null, bold, null, textOptions);
}
}
}
......
......@@ -1496,11 +1496,169 @@
* @param bool Whether the text is bold or not
* @param bool Whether the bounding box has a placement indicator
*/
OfficeExcel.Text = function (context, font, size, x, y, text)
OfficeExcel.getFmgrGraphics = function()
{
if(!this.fmgrGraphics)
{
if(!OfficeExcel.fontManager)
OfficeExcel.fontManager = new CFontManager();
this.fmgrGraphics = [];
this.fmgrGraphics.push(OfficeExcel.fontManager);
this.fmgrGraphics.push(OfficeExcel.fontManager);
this.fmgrGraphics[0].Initialize(true);
this.fmgrGraphics[1].Initialize(true);
}
}
OfficeExcel.getDrwContext = function(canvas)
{
if(!this.fmgrGraphics)
{
this.getFmgrGraphics();
this.drwContext = Asc.DrawingContext({canvas: canvas, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics});
}
else if(!this.drwContext)
this.drwContext = Asc.DrawingContext({canvas: canvas, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics});
else// canvas(setCanvas)
this.drwContext = Asc.DrawingContext({canvas: canvas, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics});
return this.drwContext;
}
OfficeExcel.Text = function (context, font, size, x, y, text)
{
var context = OfficeExcel.getDrwContext(bar.canvas);
// Need these now the angle can be specified, ie defaults for the former two args
if (typeof(arguments[6]) == null) arguments[6] = 'bottom'; // Vertical alignment. Default to bottom/baseline
if (typeof(arguments[7]) == null) arguments[7] = 'left'; // Horizontal alignment. Default to left
if (typeof(arguments[8]) == null) arguments[8] = null; // Show a bounding box. Useful for positioning during development. Defaults to false
if (typeof(arguments[9]) == null) arguments[9] = 0; // Angle (IN DEGREES) that the text should be drawn at. 0 is middle right, and it goes clockwise
if (typeof(arguments[12]) == null) arguments[12] = true; // Whether the bounding box has the placement indicator
// The alignment is recorded here for purposes of Opera compatibility
if (navigator.userAgent.indexOf('Opera') != -1) {
context.canvas.__OfficeExcel_valign__ = arguments[6];
context.canvas.__OfficeExcel_halign__ = arguments[7];
}
// First, translate to x/y coords
context.save();
context.canvas.__OfficeExcel_originalx__ = x;
context.canvas.__OfficeExcel_originaly__ = y;
context.translate(x, y);
var italic = arguments[13] && arguments[13].italic ? arguments[13].italic : false;
var underline = arguments[13] && arguments[13].underline ? arguments[13].underline : false;
var ascFont = new Asc.FontProperties(font, size, arguments[11], italic, underline);
context.setFont(ascFont);
var width;
var textSize;
if(typeof text != 'string')
text = text.toString();
if(text != "")
textSize = context.measureText(text,1);
// Vertical alignment - defaults to bottom
if (arguments[6]) {
var vAlign = arguments[6];
if(textSize)
size1 = textSize.height/0.75;
else
size1 = size;
if (vAlign == 'center') {
y = y + size1 / 2;
//context.translate(0, size / 2);
} else if (vAlign == 'top') {
y = y + size1;
//context.translate(0, size);
}
}
// Hoeizontal alignment - defaults to left
if (arguments[7] && textSize) {
var hAlign = arguments[7];
width = textSize.width/0.75;
if (hAlign) {
if (hAlign == 'center') {
//context.translate(-1 * (width / 2), 0)
x = x - width/2;
} else if (hAlign == 'right') {
x = x - width;
//context.translate(-1 * width, 0)
}
}
}
if(arguments[13] && arguments[13].color)
context.setFillStyle(arguments[13].color);
else
context.setFillStyle("#000000");
// Rotate the canvas if need be
if (arguments[9] && textSize) {
var textOptions =
{
font: ascFont,
width: textSize.width,
height: textSize.height,
x: x*0.75,
y: y*0.75,
};
OfficeExcel.drawTurnedText(context,textOptions, text, 90);
}
if(!arguments[9])
{
context.fillText(text, x*0.75, y*0.75, undefined, [6.36474609375]);
context.lineWidth = 1;
}
context.restore();
}
OfficeExcel.drawTurnedText = function(drawingCtx,textOptions, text, angle)
{
var cx = textOptions.x; // center offset x
var cy = textOptions.y; // center offset y
var textWidth = textOptions.width; // NOTE: measure text (width * 0.5)
var textHeight = textOptions.height; // NOTE: measure text (height * 0.5)
var font = textOptions.font;
var size = textOptions.size;
var asc = Asc;
if(!angle)
angle = 90;
var m = new asc.Matrix();
m.rotate(angle, 0);
var mbt = new asc.Matrix();
mbt.translate(cx + textWidth, cy + textHeight);
drawingCtx.setFont(font, angle);
drawingCtx.setTextTransform(m.sx, m.shy, m.shx, m.sy, m.tx, m.ty);
drawingCtx.setTransform(mbt.sx, mbt.shy, mbt.shx, mbt.sy, mbt.tx, mbt.ty);
drawingCtx.updateTransforms();
drawingCtx.fillText(text, 0, 0, 0, 0, angle);
drawingCtx.resetTransforms();
}
OfficeExcel.TextWithoutFonts = function (context, font, size, x, y, text)
{
/**
* This calls the text function recursively to accommodate multi-line text
*/
if (typeof(text) == 'string' && text.match(/\r\n/)) {
var arr = text.split('\r\n');
......@@ -1512,8 +1670,7 @@
OfficeExcel.Text(context, font, size, arguments[9] == -90 ? (x + (size * 1.5)) : x, y + (size * 1.5), nextline, arguments[6] ? arguments[6] : null, 'center', arguments[8], arguments[9], arguments[10], arguments[11], arguments[12]);
}
// Accommodate MSIE
if (OfficeExcel.isOld()) {
y += 2;
......@@ -1701,6 +1858,13 @@
var vpos = obj._chartTitle._vpos;
var hpos = obj._chartTitle._hpos;
var bgcolor = obj._chartTitle._background;
var textOptions =
{
color: obj._chartTitle._color,
underline: obj._chartTitle._underline,
italic: obj._chartTitle._italic
}
// Account for 3D effect by faking the key position
if (obj.type == 'bar' && obj._otherProps._variant == '3d') {
......@@ -1766,7 +1930,7 @@
vpos = obj._chartTitle._vpos;
vCenter = 'bottom';
}
OfficeExcel.Text(context, font, size, centerx, vpos, text, vCenter, 'center', bgcolor != null, null, bgcolor, bold);
OfficeExcel.Text(context, font, size, centerx, vpos, text, vCenter, 'center', bgcolor != null, null, bgcolor, bold, null, textOptions);
// Reset the fill colour
context.fillStyle = oldColor;
......@@ -1995,7 +2159,13 @@
var size = obj._otherProps._text_size + 2;
var font = obj._otherProps._text_font;
var bold = obj._xAxisTitle._bold;
var textOptions =
{
color: obj._xAxisTitle._color,
underline: obj._xAxisTitle._underline,
italic: obj._xAxisTitle._italic
}
if (typeof(obj._xAxisTitle._size) == 'number')
size = obj._xAxisTitle._size;
......@@ -2024,7 +2194,9 @@
false,
false,
false,
bold);
bold,
null,
textOptions);
context.fill();
}
......@@ -2035,7 +2207,13 @@
var font = obj._otherProps._text_font;
var angle = 270;
var bold = obj._yAxisTitle._bold;
var textOptions =
{
color: obj._yAxisTitle._color,
underline: obj._yAxisTitle._underline,
italic: obj._yAxisTitle._italic
}
var hpos;
var vpos = ((obj.canvas.height - obj._chartGutter._top - obj._chartGutter._bottom) / 2) + obj._chartGutter._top;
......@@ -2072,11 +2250,13 @@
vpos,
obj._yAxisTitle._text,
'center',
'center',
'right',//change with center
false,
angle,
false,
bold);
bold,
null,
textOptions);
context.fill();
}
......@@ -2550,6 +2730,13 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
var fgcolor = 'black';
var bgcolor = 'white';
var direction = 1;
var bold = bar._otherProps._labels_above_bold;
var textOptions =
{
color: bar._otherProps._labels_above_color,
italic: bar._otherProps._labels_above_italic,
underline: bar._otherProps._labels_above_underline
}
if (!labels) {
return;
......@@ -2692,7 +2879,10 @@ if (typeof(obj._otherProps._scale_formatter) == 'function') {
'center',
true,
null,
(typeof(labels_processed[i]) == 'object' && typeof(labels_processed[i][2]) == 'string') ? labels_processed[i][2] : 'white');
(typeof(labels_processed[i]) == 'object' && typeof(labels_processed[i][2]) == 'string') ? labels_processed[i][2] : 'white',
bold,
null,
textOptions);
context.fill();
}
}
......
......@@ -62,7 +62,7 @@
var canvas = obj.canvas;
var context = obj.context;
var text_size = typeof(obj._otherProps._key_text_size) == 'number' ? obj._otherProps._key_text_size : obj._otherProps._text_size;
var text_font = obj._otherProps._text_font;
var text_font = obj._otherProps._key_text_font;
var gutterLeft = obj._chartGutter._left;
var gutterRight = obj._chartGutter._right;
......
......@@ -523,8 +523,8 @@
var canvas = this.canvas;
var units_pre = this._otherProps._units_pre;
var units_post = this._otherProps._units_post;
var text_size = this._otherProps._text_size;
var font = this._otherProps._text_font;
var text_size = this._otherProps._xlabels_size;
var font = this._otherProps._xlabels_font;
/**
......@@ -545,6 +545,13 @@
this.context.beginPath();
this.context.fillStyle = this._otherProps._text_color;
var bold = this._otherProps._xlabels_bold;
var textOptions =
{
color: this._otherProps._xlabels_color,
underline: this._otherProps._xlabels_underline,
italic: this._otherProps._xlabels_italic
}
if('auto' == this._otherProps._ylabels_count)
{
......@@ -593,9 +600,9 @@
//OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (i/xRevScale.length)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, - OfficeExcel.number_format(this, elemArr, units_pre, units_post), 'center', 'center');
if(elemArr == 0)
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (i/xRevScale.length)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.numToFormatText(elemArr.toString(),isFormatCell) + units_post, 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (i/xRevScale.length)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.numToFormatText(elemArr.toString(),isFormatCell) + units_post, 'center', 'center', false, null, null, bold, null,textOptions);
else
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (i/xRevScale.length)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap,OfficeExcel.numToFormatText("-" + elemArr.toString(),isFormatCell) + units_post, 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (i/xRevScale.length)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap,OfficeExcel.numToFormatText("-" + elemArr.toString(),isFormatCell) + units_post, 'center', 'center', false, null, null, bold, null,textOptions);
}
this._otherProps._background_grid_autofit_numvlines = xRevScale.length;
this._otherProps._numxticks = xRevScale.length;
......@@ -610,7 +617,7 @@
elemArr = Math.round(OfficeExcel.array_exp(this.scale[0] - (this.scale[1] - this.scale[0]))*floatKoff)/floatKoff ;
}
//OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (i/this.scale.length)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, elemArr, units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (i/this.scale.length)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, (OfficeExcel.numToFormatText(elemArr.toString(),isFormatCell) + units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (i/this.scale.length)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, (OfficeExcel.numToFormatText(elemArr.toString(),isFormatCell) + units_post), 'center', 'center', false, null, null, bold, null,textOptions);
}
this._otherProps._background_grid_autofit_numvlines = this.scale.length;
this._otherProps._numxticks = this.scale.length;
......@@ -618,28 +625,28 @@
}
else if (this._otherProps._yaxispos == 'center') {
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (10/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[4]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (9/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[3]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (8/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[2]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (7/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[1]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (6/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[0]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (4/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[0]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (3/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[1]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (2/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[2]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (1/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[3]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (0)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[4]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (10/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[4]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (9/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[3]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (8/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[2]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (7/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[1]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (6/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[0]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (4/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[0]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (3/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[1]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (2/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[2]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (1/10)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[3]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (0)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, '-' + OfficeExcel.number_format(this, Number(this.scale[4]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
} else {
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (5/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[4]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (4/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[3]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (3/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[2]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (2/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[1]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (1/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[0]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center');
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (5/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[4]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (4/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[3]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (3/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[2]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (2/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[1]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
OfficeExcel.Text(context, font, text_size, this._chartGutter._left + (this.graphwidth * (1/5)), this._chartGutter._top + this.halfTextHeight + this.graphheight + gap, OfficeExcel.number_format(this, Number(this.scale[0]).toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', 'center', false, null, null, bold, null,textOptions);
if (this._otherProps._xmin > 0) {
OfficeExcel.Text(context,font,text_size,this._chartGutter._left,this._chartGutter._top + this.halfTextHeight + this.graphheight + 2,OfficeExcel.number_format(this, this._otherProps._xmin, units_pre, units_post),'center','center');
OfficeExcel.Text(context,font,text_size,this._chartGutter._left,this._chartGutter._top + this.halfTextHeight + this.graphheight + 2,OfficeExcel.number_format(this, this._otherProps._xmin, units_pre, units_post),'center','center', false, null, null, bold, null,textOptions);
}
}
......@@ -653,8 +660,16 @@
if (typeof(this._otherProps._labels) == 'object' && this._otherProps._ylabels) {
var xOffset = 11;
var font = this._otherProps._text_font;
text_size = this._otherProps._ylabels_size;
font = this._otherProps._ylabels_font;
var bold = this._otherProps._ylabels_bold;
var textOptions =
{
color: this._otherProps._ylabels_color,
underline: this._otherProps._ylabels_underline,
italic: this._otherProps._ylabels_italic
}
// Draw the X axis labels
this.context.fillStyle = this._otherProps._text_color;
......@@ -669,13 +684,13 @@
if('auto' == this._otherProps._ylabels_count)
{
for (y=this._chartGutter._top + (yTickGap / 2); y<=OfficeExcel.GetHeight(this) - this._chartGutter._bottom; y+=yTickGap) {
OfficeExcel.Text(this.context, font,this._otherProps._text_size, this.nullPositionOX - xOffset,y,String(this._otherProps._labels[i++]),'center','right');
OfficeExcel.Text(this.context, font,text_size, this.nullPositionOX - xOffset,y,String(this._otherProps._labels[i++]),'center','right', false, null, null, bold, null,textOptions);
}
}
else
{
for (y=this._chartGutter._top + (yTickGap / 2); y<=OfficeExcel.GetHeight(this) - this._chartGutter._bottom; y+=yTickGap) {
OfficeExcel.Text(this.context, font,this._otherProps._text_size,this._chartGutter._left - xOffset,y,String(this._otherProps._labels[i++]),'center','right');
OfficeExcel.Text(this.context, font,text_size,this._chartGutter._left - xOffset,y,String(this._otherProps._labels[i++]),'center','right', false, null, null, bold, null,textOptions);
}
}
}
......@@ -717,19 +732,6 @@
}
} else {
/*var grouping = this._otherProps._grouping;
for (i=0; i<this.data.length; ++i) {
if (typeof(this.data[i]) == 'object') {
var value = grouping == 'grouped' ? Number(OfficeExcel.array_max(this.data[i], true)) : Number(OfficeExcel.array_sum(this.data[i])) ;
} else {
var value = Number(Math.abs(this.data[i]));
}
this.max = Math.max(Math.abs(this.max), Math.abs(value));
}
this.scale = OfficeExcel.getScale(this.max, this);*/
if('auto' == this._otherProps._ylabels_count)
{
var lengSc = this.scale.length;
......@@ -1055,9 +1057,16 @@
var coords = this.coords;
var font = this._otherProps._text_font;
var size = this._otherProps._text_size;
var font = this._otherProps._labels_above_font;
var size = this._otherProps._labels_above_size;
var color = this._otherProps._text_color;
var bold = this._otherProps._labels_above_bold;
var textOptions =
{
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;
......@@ -1097,7 +1106,7 @@
border ? 'right' : 'left',
null,
null,
border ? 'rgba(255,255,255,0.9)' : null);
border ? 'rgba(255,255,255,0.9)' : null, bold, null, textOptions);
}
}
}
......
if (typeof(OfficeExcel) == 'undefined') OfficeExcel = {};
OfficeExcel.Line = function (chartCanvas)
OfficeExcel.Line = function (chartCanvas, data)
{
// Get the canvas and context objects
this.id = null;
......@@ -14,7 +14,7 @@
this.coordsKey = [];
this.hasnegativevalues = false;
this.isOfficeExcel = true;
this.data = data;
// Check for support
if (!this.canvas) {
alert('[LINE] Fatal error: no canvas support');
......@@ -125,7 +125,7 @@
// Max y
//if('auto' != this._otherProps._ylabels_count)
if (this._otherProps._ymax) {
if (this._otherProps._ymax && this.scale) {
this.max = this._otherProps._ymax;
this.min = this._otherProps._ymin ? this._otherProps._ymin : 0;
......@@ -744,10 +744,17 @@
OfficeExcel.NoShadow(this);
// This needs to be here
var font = this._otherProps._text_font;
var text_size = this._otherProps._text_size;
var font = this._otherProps._ylabels_font;
var text_size = this._otherProps._ylabels_size;
var context = this.context;
var canvas = this.canvas;
var bold = this._otherProps._ylabels_bold;
var textOptions =
{
color: this._otherProps._ylabels_color,
underline:this._otherProps._ylabels_underline,
italic: this._otherProps._ylabels_italic
}
// Draw the Y axis labels
if (this._otherProps._ylabels && this._otherProps._ylabels_specific == null) {
......@@ -759,7 +766,7 @@
var numYLabels = this._otherProps._ylabels_count;
var bounding = false;
var bgcolor = this._otherProps._ylabels_inside ? this._otherProps._ylabels_inside_color : null;
var bgcolor = this._otherProps._ylabels_inside ? this._otherProps._ylabels_inside_color : null;
/**
......@@ -784,37 +791,37 @@
if('auto' == numYLabels)
{
for (var i=0; i<this.scale.length; ++i) {
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),this.scale[this.scale.length -1 - i],null,align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),this.scale[this.scale.length -1 - i],null,align,bounding,null,bgcolor, bold, null, textOptions);
}
}
else
{
if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
// Draw the upper halves labels
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (0/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (0/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (1/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (3/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (1/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (3/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
if (numYLabels >= 3) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (2/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (4/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (2/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (4/5) * half ) + this.halfTextHeight, OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
// Draw the lower halves labels
if (numYLabels >= 3) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (6/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (8/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (6/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (8/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (7/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (9/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (7/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (9/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (10/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, (this.scale[4] == '1.0' ? '1.0' : this.scale[4]), units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + ( (10/5) * half ) + this.halfTextHeight, '-' + OfficeExcel.number_format(this, (this.scale[4] == '1.0' ? '1.0' : this.scale[4]), units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
} else if (numYLabels == 10) {
......@@ -823,26 +830,26 @@
for (var i=0; i<numYLabels; ++i) {
// This draws the upper halves labels
OfficeExcel.Text(context,font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((i/20) * (this.grapharea) ), OfficeExcel.number_format(this, ((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this._otherProps._scale_decimals)),units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context,font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((i/20) * (this.grapharea) ), OfficeExcel.number_format(this, ((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this._otherProps._scale_decimals)),units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
// And this draws the lower halves labels
OfficeExcel.Text(context, font, text_size, xpos,
this._chartGutter._top + this.halfTextHeight + ((i/20) * this.grapharea) + (this.grapharea / 2) + (this.grapharea / 20),
'-' + OfficeExcel.number_format(this, (this.scale[4] - ((this.scale[4] / numYLabels) * (numYLabels - i - 1))).toFixed((this._otherProps._scale_decimals)),units_pre, units_post), null, align, bounding, null, bgcolor);
'-' + OfficeExcel.number_format(this, (this.scale[4] - ((this.scale[4] / numYLabels) * (numYLabels - i - 1))).toFixed((this._otherProps._scale_decimals)),units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
} else {
alert('[LINE SCALE] The number of Y labels must be 1/3/5/10');
}
if (typeof(this._otherProps._ymin) == 'number') {
OfficeExcel.Text(context, font, text_size, xpos, this.canvas.height / 2, OfficeExcel.number_format(this, this._otherProps._ymin.toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this.canvas.height / 2, OfficeExcel.number_format(this, this._otherProps._ymin.toFixed(this._otherProps._scale_decimals), units_pre, units_post), 'center', align, bounding, null, bgcolor, bold, null, textOptions);
}
// No X axis - so draw 0
if (this._otherProps._noxaxis == true) {
OfficeExcel.Text(context,font,text_size,xpos,this._chartGutter._top + ( (5/5) * half ) + this.halfTextHeight,this._otherProps._units_pre + '0' + this._otherProps._units_post,null, align, bounding, null, bgcolor);
OfficeExcel.Text(context,font,text_size,xpos,this._chartGutter._top + ( (5/5) * half ) + this.halfTextHeight,this._otherProps._units_pre + '0' + this._otherProps._units_post,null, align, bounding, null, bgcolor, bold, null, textOptions);
}
}
......@@ -871,9 +878,9 @@
elemArr = Math.round(OfficeExcel.array_exp(scale[scale.length - 1] - (scale[scale.length - 2] - scale[scale.length - 1]))*floatKoff)/floatKoff ;
}
if(elemArr == 0)
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText(elemArr.toString(),isFormatCell),null,align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText(elemArr.toString(),isFormatCell),null,align,bounding,null,bgcolor, bold, null, textOptions);
else
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText("-" + elemArr.toString(),isFormatCell),null,align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText("-" + elemArr.toString(),isFormatCell),null,align,bounding,null,bgcolor, bold, null, textOptions);
}
}
else
......@@ -894,16 +901,16 @@
}
if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((1/5) * (this.grapharea ) ), '-' + OfficeExcel.number_format(this, scale[4], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((1/5) * (this.grapharea ) ), '-' + OfficeExcel.number_format(this, scale[4], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((4/5) * (this.grapharea) ), '-' + OfficeExcel.number_format(this, scale[1], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((2/5) * (this.grapharea) ), '-' + OfficeExcel.number_format(this, scale[3], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((4/5) * (this.grapharea) ), '-' + OfficeExcel.number_format(this, scale[1], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((2/5) * (this.grapharea) ), '-' + OfficeExcel.number_format(this, scale[3], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
if (numYLabels >= 3) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((3/5) * (this.grapharea ) ), '-' + OfficeExcel.number_format(this, scale[2], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((5/5) * (this.grapharea) ), '-' + OfficeExcel.number_format(this, scale[0], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((3/5) * (this.grapharea ) ), '-' + OfficeExcel.number_format(this, scale[2], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((5/5) * (this.grapharea) ), '-' + OfficeExcel.number_format(this, scale[0], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
} else if (numYLabels == 10) {
......@@ -913,7 +920,7 @@
for (var i=0; i<numYLabels; ++i) {
OfficeExcel.Text(context,font,text_size,xpos,(2 * interval) + this._chartGutter._top + this.halfTextHeight + ((i/10) * (this.grapharea) ),'-' + OfficeExcel.number_format(this,(scale[0] - (((scale[0] - this.min) / numYLabels) * (numYLabels - i - 1))).toFixed((this._otherProps._scale_decimals)),units_pre,units_post),null,align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,xpos,(2 * interval) + this._chartGutter._top + this.halfTextHeight + ((i/10) * (this.grapharea) ),'-' + OfficeExcel.number_format(this,(scale[0] - (((scale[0] - this.min) / numYLabels) * (numYLabels - i - 1))).toFixed((this._otherProps._scale_decimals)),units_pre,units_post),null,align,bounding,null,bgcolor, bold, null, textOptions);
}
} else {
......@@ -929,7 +936,7 @@
}
if (typeof(this._otherProps._ymin) == 'number') {
OfficeExcel.Text(context,font,text_size,xpos,this._otherProps._ylabels_invert ? this.canvas.height - this._chartGutter._bottom : this._chartGutter._top,'-' + OfficeExcel.number_format(this, this._otherProps._ymin.toFixed(this._otherProps._scale_decimals), units_pre, units_post),'center',align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,xpos,this._otherProps._ylabels_invert ? this.canvas.height - this._chartGutter._bottom : this._chartGutter._top,'-' + OfficeExcel.number_format(this, this._otherProps._ymin.toFixed(this._otherProps._scale_decimals), units_pre, units_post),'center',align,bounding,null,bgcolor, bold, null, textOptions);
}
}
......@@ -952,7 +959,7 @@
{
for (var i=0; i<this.scale.length; ++i) {
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText((this.scale[this.scale.length -1 - i]).toString(),isFormatCell) + units_post,null,align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText((this.scale[this.scale.length -1 - i]).toString(),isFormatCell) + units_post,null,align,bounding,null,bgcolor, bold, null, textOptions);
//OfficeExcel.Text(context,font,text_size,xpos - 5,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.number_format(this, (this.scale[this.scale.length -1 - i]).toString().replace('.',','), units_pre, units_post),null,align,bounding,null,bgcolor);
......@@ -961,16 +968,16 @@
}
}
else if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((0/5) * (this.grapharea ) ), OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((0/5) * (this.grapharea ) ), OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((3/5) * (this.grapharea) ), OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((1/5) * (this.grapharea) ), OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((3/5) * (this.grapharea) ), OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((1/5) * (this.grapharea) ), OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
if (numYLabels >= 3) {
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((2/5) * (this.grapharea ) ), OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((4/5) * (this.grapharea) ), OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((2/5) * (this.grapharea ) ), OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xpos, this._chartGutter._top + this.halfTextHeight + ((4/5) * (this.grapharea) ), OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor, bold, null, textOptions);
}
} else if (numYLabels == 10) {
......@@ -979,7 +986,7 @@
var interval = (this.grapharea / numYLabels) / 2;
for (var i=0; i<numYLabels; ++i) {
OfficeExcel.Text(context,font,text_size,xpos,this._chartGutter._top + this.halfTextHeight + ((i/10) * (this.grapharea) ),OfficeExcel.number_format(this,((((this.scale[4] - this.min) / numYLabels) * (numYLabels - i)) + this.min).toFixed((this._otherProps._scale_decimals)),units_pre,units_post),null,align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,xpos,this._chartGutter._top + this.halfTextHeight + ((i/10) * (this.grapharea) ),OfficeExcel.number_format(this,((((this.scale[4] - this.min) / numYLabels) * (numYLabels - i)) + this.min).toFixed((this._otherProps._scale_decimals)),units_pre,units_post),null,align,bounding,null,bgcolor, bold, null, textOptions);
}
} else {
......@@ -995,7 +1002,7 @@
}
if (typeof(this._otherProps._ymin) == 'number' || typeof(this._otherProps._ymin) == 'string' && this._otherProps._ymin.search('E') != -1) {
OfficeExcel.Text(context,font,text_size,xpos - 5,this._otherProps._ylabels_invert ? this._chartGutter._top : this.canvas.height - this._chartGutter._bottom,OfficeExcel.numToFormatText(this._otherProps._ymin.toString(),isFormatCell) + units_post,'center',align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,xpos - 5,this._otherProps._ylabels_invert ? this._chartGutter._top : this.canvas.height - this._chartGutter._bottom,OfficeExcel.numToFormatText(this._otherProps._ymin.toString(),isFormatCell) + units_post,'center',align,bounding,null,bgcolor, bold, null, textOptions);
//OfficeExcel.Text(context,font,text_size,xpos - 5,this._otherProps._ylabels_invert ? this._chartGutter._top : this.canvas.height - this._chartGutter._bottom,OfficeExcel.number_format(this, this._otherProps._ymin, units_pre, units_post),'center',align,bounding,null,bgcolor);
//OfficeExcel.Text(context,font,text_size,xpos - 5,this._otherProps._ylabels_invert ? this._chartGutter._top : this.canvas.height - this._chartGutter._bottom,OfficeExcel.number_format(this, this._otherProps._ymin.toFixed(this._otherProps._scale_decimals), units_pre, units_post),'center',align,bounding,null,bgcolor);
}
......@@ -1007,7 +1014,7 @@
&& this._otherProps._xaxispos != 'center'
) {
OfficeExcel.Text(context,font,text_size,xpos,this._otherProps._xaxispos == 'top' ? this._chartGutter._top + this.halfTextHeight: (this.canvas.height - this._chartGutter._bottom + this.halfTextHeight),this._otherProps._units_pre + '0' + this._otherProps._units_post,null, align, bounding, null, bgcolor);
OfficeExcel.Text(context,font,text_size,xpos,this._otherProps._xaxispos == 'top' ? this._chartGutter._top + this.halfTextHeight: (this.canvas.height - this._chartGutter._bottom + this.halfTextHeight),this._otherProps._units_pre + '0' + this._otherProps._units_post,null, align, bounding, null, bgcolor, bold, null, textOptions);
}
} else if (this._otherProps._ylabels && typeof(this._otherProps._ylabels_specific) == 'object') {
......@@ -1054,7 +1061,7 @@
y += this._chartGutter._top;
}
OfficeExcel.Text(context, font, text_size,x,y,String(this._otherProps._ylabels_specific[i]), 'center', halign, bounding, 0, bgcolor);
OfficeExcel.Text(context, font, text_size,x,y,String(this._otherProps._ylabels_specific[i]), 'center', halign, bounding, 0, bgcolor, bold, null, textOptions);
}
// Now reverse the labels and draw the bottom half
......@@ -1070,7 +1077,7 @@
y += (this.grapharea / 2);
}
OfficeExcel.Text(context, font, text_size,x,y,String(reversed_labels[i]), 'center', halign, bounding, 0, bgcolor);
OfficeExcel.Text(context, font, text_size,x,y,String(reversed_labels[i]), 'center', halign, bounding, 0, bgcolor, bold, null, textOptions);
}
} else if (this._otherProps._xaxispos == 'top') {
......@@ -1084,13 +1091,13 @@
var y = ((this.grapharea / (reversed_labels.length - (ymin ? 1 : 0)) ) * (i + (ymin ? 0 : 1)));
y = y + this._chartGutter._top;
OfficeExcel.Text(context, font, text_size,x,y,String(reversed_labels[i]), 'center', halign, bounding, 0, bgcolor);
OfficeExcel.Text(context, font, text_size,x,y,String(reversed_labels[i]), 'center', halign, bounding, 0, bgcolor, bold, null, textOptions);
}
} else {
for (var i=0; i<this._otherProps._ylabels_specific.length; ++i) {
var y = this._chartGutter._top + ((this.grapharea / (this._otherProps._ylabels_specific.length - (ymin ? 1 : 0) )) * i);
OfficeExcel.Text(context, font, text_size,x,y,String(this._otherProps._ylabels_specific[i]), 'center', halign, bounding, 0, bgcolor);
OfficeExcel.Text(context, font, text_size,x,y,String(this._otherProps._ylabels_specific[i]), 'center', halign, bounding, 0, bgcolor, bold, null, textOptions);
}
}
}
......@@ -1101,7 +1108,14 @@
var yOffset = 5;
var bordered = false;
var bgcolor = null;
font = this._otherProps._xlabels_font;
bold = this._otherProps._xlabels_bold;
textOptions =
{
color: this._otherProps._xlabels_color,
underline: this._otherProps._xlabels_underline,
italic: this._otherProps._xlabels_italic
}
/**
* Text angle
*/
......@@ -1177,7 +1191,7 @@
halign,
bordered,
angle,
bgcolor);
bgcolor, bold, null, textOptions);
}
else
{
......@@ -1192,7 +1206,7 @@
halign,
bordered,
angle,
bgcolor);
bgcolor, bold, null, textOptions);
}
}
......@@ -1986,10 +2000,16 @@
{
var context = this.context;
var size = this._otherProps._labels_above_size;
var font = this._otherProps._text_font;
var font = this._otherProps._labels_above_font;
var units_pre = this._otherProps._units_pre;
var units_post = this._otherProps._units_post;
var bold = this._otherProps._labels_above_bold;
var textOptions =
{
color: this._otherProps._labels_above_color,
underline: this._otherProps._labels_above_underline,
italic: this._otherProps._labels_above_italic
}
context.beginPath();
var tempData = [];
n = 0;
......@@ -2000,7 +2020,7 @@
}
for (var i = 0; i < this.coords.length; ++i) {
var coords = this.coords[i];
OfficeExcel.Text(context, font, size, coords[0], coords[1] - 5 - size,OfficeExcel.numToFormatText( OfficeExcel.num_round(tempData[i]),format), 'center', 'center', false, null, 'rgba(255, 255, 255, 0.7)');
OfficeExcel.Text(context, font, size, coords[0], coords[1] - 5 - size,OfficeExcel.numToFormatText( OfficeExcel.num_round(tempData[i]),format), 'center', 'center', false, null, 'rgba(255, 255, 255, 0.7)', bold, null, textOptions);
// OfficeExcel.Text(context, font, size, coords[0], coords[1] - 5 - size, OfficeExcel.number_format(this, OfficeExcel.num_round(tempData[i]), units_pre, units_post), 'center', 'center', false, null, 'rgba(255, 255, 255, 0.7)');
}
......
......@@ -641,7 +641,14 @@
var vAlignment = 'center';
var labels = this._otherProps._labels;
var context = this.context;
var bold = this._otherProps._labels_above_bold;
var textOptions =
{
color: this._otherProps._labels_above_color,
underline: this._otherProps._labels_above_underline,
italic: this._otherProps._labels_above_italic
}
/**
* Turn the shadow off
*/
......@@ -724,7 +731,7 @@
this.centery + explosion_offsety + (((this.radius + 10) * Math.sin(a))),
labels[i],
vAlignment,
hAlignment);
hAlignment, false, null,null, bolf, null, textOptions);
}
context.fill();
......
......@@ -721,12 +721,12 @@
OfficeExcel.Scatter.prototype.DrawLabels = function (xScale,isFormatCell,isformatCellScOy)
{
this.context.fillStyle = this._otherProps._text_color;
var font = this._otherProps._text_font;
var font = this._otherProps._ylabels_font;
var xMin = this._otherProps._xmin;
var xMax = this._otherProps._xmax;
var yMax = this.scale[this.scale.length - 1];
var yMin = this._otherProps._ymin;
var text_size = this._otherProps._text_size;
var text_size = this._otherProps._ylabels_size;
var units_pre = this._otherProps._units_pre;
var units_post = this._otherProps._units_post;
var numYLabels = this._otherProps._ylabels_count;
......@@ -748,7 +748,14 @@
var xPos = this._otherProps._yaxispos == 'left' ? this._chartGutter._left - 5 : OfficeExcel.GetWidth(this) - this._chartGutter._right + 5;
var align = this._otherProps._yaxispos == 'right' ? 'left' : 'right';
var bold = this._otherProps._ylabels_bold;
var textOptions =
{
color: this._otherProps._ylabels_color,
underline: this._otherProps._ylabels_underline,
italic: this._otherProps._ylabels_italic
}
if (inside) {
if (this._otherProps._yaxispos == 'left') {
xPos = this._chartGutter._left + 5;
......@@ -770,7 +777,7 @@
if('auto' == numYLabels)
{
for (var i=0; i<this.scale.length; ++i) {
OfficeExcel.Text(context,font,text_size,this.nullPositionOX - 10,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText(this.scale[this.scale.length -1 - i],isformatCellScOy),null,align,bounding,null,bgcolor);
OfficeExcel.Text(context,font,text_size,this.nullPositionOX - 10,this._chartGutter._top + this.halfTextHeight + ((i/this.scale.length) * (this.grapharea) ),OfficeExcel.numToFormatText(this.scale[this.scale.length -1 - i],isformatCellScOy),null,align,bounding,null,bgcolor, bold, null, textOptions);
}
}
else
......@@ -788,18 +795,18 @@
for (var i=0; i<labels.length; ++i) {
var y = this._chartGutter._top + (i * (this.grapharea / (labels.length * 2) ) );
OfficeExcel.Text(context, font, text_size, xPos, y, labels[i], 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, y, labels[i], 'center', align, boxed, null, null, bold, null, textOptions);
}
var reversed_labels = OfficeExcel.array_reverse(labels);
for (var i=0; i<reversed_labels.length; ++i) {
var y = this._chartGutter._top + (this.grapharea / 2) + ((i+1) * (this.grapharea / (labels.length * 2) ) );
OfficeExcel.Text(context,font, text_size, xPos, y, reversed_labels[i], 'center', align, boxed);
OfficeExcel.Text(context,font, text_size, xPos, y, reversed_labels[i], 'center', align, boxed, null, null, bold, null, textOptions);
}
if (this._otherProps._ymin > 0) {
OfficeExcel.Text(context, font, text_size, xPos, (this.grapharea / 2) + this._chartGutter._top, this._otherProps._ylabels_specific[this._otherProps._ylabels_specific.length - 1], 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, (this.grapharea / 2) + this._chartGutter._top, this._otherProps._ylabels_specific[this._otherProps._ylabels_specific.length - 1], 'center', align, boxed, null, bold, null, textOptions);
}
return;
......@@ -808,39 +815,39 @@
if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
// Draw the top halves labels
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
if (numYLabels >= 5) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (1/10) ), OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (3/10) ), OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (1/10) ), OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (3/10) ), OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), 'center', align, boxed, null, null, bold, null, textOptions);
}
if (numYLabels >= 3) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (2/10) ), OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (4/10) ), OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (2/10) ), OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (4/10) ), OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
// Draw the bottom halves labels
if (numYLabels >= 3) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (1/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (3/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (1/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (3/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
if (numYLabels == 5) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (2/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (4/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (2/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (4/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (5/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (5/10) ) + this.halfGraphHeight, '-' + OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
} else if (numYLabels == 10) {
// 10 Y labels
var interval = (this.grapharea / numYLabels) / 2;
for (var i=0; i<numYLabels; ++i) {
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (i/20) ),OfficeExcel.number_format(this,(this.max - (this.max * (i/10))).toFixed(this._otherProps._scale_decimals),units_pre, units_post),'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (i/20) ) + (this.grapharea / 2) + (this.grapharea / 20),'-' + OfficeExcel.number_format(this, ((this.max * (i/10)) + (this.max * (1/10))).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (i/20) ),OfficeExcel.number_format(this,(this.max - (this.max * (i/10))).toFixed(this._otherProps._scale_decimals),units_pre, units_post),'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (i/20) ) + (this.grapharea / 2) + (this.grapharea / 20),'-' + OfficeExcel.number_format(this, ((this.max * (i/10)) + (this.max * (1/10))).toFixed((this._otherProps._scale_decimals)), units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
} else {
......@@ -870,9 +877,9 @@
//if(0 == i)
//elemArr = scale[scale.length - 1] - (scale[scale.length - 2] - scale[scale.length - 1])
if(elemArr == 0)
OfficeExcel.Text(context,font,text_size,this.nullPositionOX - xpos,this._chartGutter._top + this.halfTextHeight + ((i/(this.scale.length - 1)) * (this.grapharea) ),OfficeExcel.numToFormatText(elemArr.toString(),isformatCellScOy),null,align,null, boxed);
OfficeExcel.Text(context,font,text_size,this.nullPositionOX - xpos,this._chartGutter._top + this.halfTextHeight + ((i/(this.scale.length - 1)) * (this.grapharea) ),OfficeExcel.numToFormatText(elemArr.toString(),isformatCellScOy),null,align,null, boxed, null, bold, null, textOptions);
else
OfficeExcel.Text(context,font,text_size,this.nullPositionOX - xpos,this._chartGutter._top + this.halfTextHeight + ((i/(this.scale.length - 1)) * (this.grapharea) ),OfficeExcel.numToFormatText("-" + elemArr.toString(),isformatCellScOy),null,align,null, boxed);
OfficeExcel.Text(context,font,text_size,this.nullPositionOX - xpos,this._chartGutter._top + this.halfTextHeight + ((i/(this.scale.length - 1)) * (this.grapharea) ),OfficeExcel.numToFormatText("-" + elemArr.toString(),isformatCellScOy),null,align,null, boxed, null, bold, null, textOptions);
}
}
else {
......@@ -901,7 +908,7 @@
{
align = 'right';
for (var i=0; i<this.scale.length; ++i) {
OfficeExcel.Text(context,font,text_size,this.nullPositionOX - 10,this._chartGutter._top + this.halfTextHeight + ((i/(this.scale.length - 1)) * (this.grapharea) ),OfficeExcel.numToFormatText(this.scale[this.scale.length -1 - i],isformatCellScOy),null,align,null,boxed);
OfficeExcel.Text(context,font,text_size,this.nullPositionOX - 10,this._chartGutter._top + this.halfTextHeight + ((i/(this.scale.length - 1)) * (this.grapharea) ),OfficeExcel.numToFormatText(this.scale[this.scale.length -1 - i],isformatCellScOy),null,align,null,boxed, null, bold, null, textOptions);
//OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (4/5) ), this.scale[this.scale.length -1 - i], 'center', align, boxed);
}
}
......@@ -922,11 +929,11 @@
for (var i=0; i<labels.length; ++i) {
var y = this._chartGutter._top + (i * (this.grapharea / labels.length) );
OfficeExcel.Text(context, font, text_size, xPos, y, labels[i], 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, y, labels[i], 'center', align, boxed, null, bold, null, textOptions);
}
if (this._otherProps._ymin > 0) {
OfficeExcel.Text(context, font, text_size, xPos, this.canvas.height - this._chartGutter._bottom, this._otherProps._ylabels_specific[this._otherProps._ylabels_specific.length - 1], 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this.canvas.height - this._chartGutter._bottom, this._otherProps._ylabels_specific[this._otherProps._ylabels_specific.length - 1], 'center', align, boxed, null,bold, null, textOptions);
}
return;
......@@ -934,42 +941,42 @@
if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
if (invert) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top, OfficeExcel.number_format(this, 0, units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (5/5) ), OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top, OfficeExcel.number_format(this, 0, units_pre, units_post), 'center', align, boxed, null, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((OfficeExcel.GetHeight(this) - this._chartGutter._top - this._chartGutter._bottom) * (5/5) ), OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
if (numYLabels >= 5) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (2/5) ), OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (4/5) ), OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (2/5) ), OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (4/5) ), OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
if (numYLabels >= 3) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (3/5) ), OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (1/5) ), OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (3/5) ), OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (1/5) ), OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
} else {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top, OfficeExcel.number_format(this, this.scale[4], units_pre, units_post), 'center', align, boxed, null, null, bold, null, textOptions);
if (numYLabels >= 5) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (1/5) ), OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (3/5) ), OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (1/5) ), OfficeExcel.number_format(this, this.scale[3], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (3/5) ), OfficeExcel.number_format(this, this.scale[1], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
if (numYLabels >= 3) {
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (2/5) ), OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (4/5) ), OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), 'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (2/5) ), OfficeExcel.number_format(this, this.scale[2], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
OfficeExcel.Text(context, font, text_size, xPos, this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (4/5) ), OfficeExcel.number_format(this, this.scale[0], units_pre, units_post), 'center', align, boxed, null, bold, null, textOptions);
}
}
} else if (numYLabels == 10) {
var interval = (this.grapharea / numYLabels) / 2;
if (invert) {
for (var i=numYLabels; i>=0; --i) {
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * ((10-i)/10) ),OfficeExcel.number_format(this,(this.max - (this.max * (i/10))).toFixed((this._otherProps._scale_decimals)), units_pre, units_post),'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * ((10-i)/10) ),OfficeExcel.number_format(this,(this.max - (this.max * (i/10))).toFixed((this._otherProps._scale_decimals)), units_pre, units_post),'center', align, boxed, null, bold, null, textOptions);
}
} else {
// 10 Y labels
for (var i=0; i<numYLabels; ++i) {
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (i/10) ),OfficeExcel.number_format(this, (this.max - ((this.max - this.min) * (i/10))).toFixed((this._otherProps._scale_decimals)), units_pre, units_post),'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos,this._chartGutter._top + ((this.canvas.height - this._chartGutter._top - this._chartGutter._bottom) * (i/10) ),OfficeExcel.number_format(this, (this.max - ((this.max - this.min) * (i/10))).toFixed((this._otherProps._scale_decimals)), units_pre, units_post),'center', align, boxed, null, bold, null, textOptions);
}
}
} else {
......@@ -977,7 +984,7 @@
}
if (this._otherProps._ymin) {
OfficeExcel.Text(context, font, text_size, xPos, this.canvas.height - this._chartGutter._bottom,OfficeExcel.number_format(this, this._otherProps._ymin.toFixed(this._otherProps._scale_decimals), units_pre, units_post),'center', align, boxed);
OfficeExcel.Text(context, font, text_size, xPos, this.canvas.height - this._chartGutter._bottom,OfficeExcel.number_format(this, this._otherProps._ymin.toFixed(this._otherProps._scale_decimals), units_pre, units_post),'center', align, boxed, null, bold, null, textOptions);
}
}
......@@ -990,6 +997,15 @@
/**
* Draw an X scale
*/
var bold = this._otherProps._xlabels_bold;
var textOptions =
{
color: this._otherProps._xlabels_color,
underline: this._otherProps._xlabels_underline,
italic: this._otherProps._xlabels_italic
}
font = this._otherProps._xlabels_font;
text_size = this._otherProps._xlabels_size;
if('auto' == this._otherProps._ylabels_count && this._otherProps._xlabels)
{
if(this._otherProps._yaxispos == 'right')
......@@ -1027,9 +1043,9 @@
var text = scale[i];
}
if(text == 0)
OfficeExcel.Text(context, font, text_size, x, this.nullPositionOY + 15,OfficeExcel.numToFormatText(text.toString(),isFormatCell), 'center', 'center');
OfficeExcel.Text(context, font, text_size, x, this.nullPositionOY + 15,OfficeExcel.numToFormatText(text.toString(),isFormatCell), 'center', 'center', false, null, null, bold, null, textOptions);
else
OfficeExcel.Text(context, font, text_size, x, this.nullPositionOY + 15, "-" + OfficeExcel.numToFormatText(text.toString(),isFormatCell), 'center', 'center');
OfficeExcel.Text(context, font, text_size, x, this.nullPositionOY + 15, "-" + OfficeExcel.numToFormatText(text.toString(),isFormatCell), 'center', 'center', false, null, null, bold, null, textOptions);
}
......@@ -1075,7 +1091,7 @@
var text = xScale[i];
}
OfficeExcel.Text(context, font, text_size, x, this.nullPositionOY + 15, OfficeExcel.numToFormatText(text.toString(),isFormatCell), 'center', 'center');
OfficeExcel.Text(context, font, text_size, x, this.nullPositionOY + 15, OfficeExcel.numToFormatText(text.toString(),isFormatCell), 'center', 'center', false, null, null, bold, null, textOptions);
}
}
......@@ -1116,7 +1132,7 @@
units_post_x);
}
OfficeExcel.Text(context, font, text_size, x, y, text, 'center', 'center');
OfficeExcel.Text(context, font, text_size, x, y, text, 'center', 'center', false, null, null, bold, null, textOptions);
}
/**
......@@ -1173,7 +1189,7 @@
valign,
angle != 0 ? 'right' : (this._otherProps._labels_specific_align == 'center' ? 'center' : 'left'),
null,
angle
angle, null, bold, null, textOptions
);
/**
......@@ -1186,7 +1202,7 @@
this.context.stroke();
} else {
OfficeExcel.Text(context, font, this._otherProps._text_size, xPos + (this.xTickGap / 2), yPos, String(labels[i]), valign, halign, null, angle);
OfficeExcel.Text(context, font, this._otherProps._text_size, xPos + (this.xTickGap / 2), yPos, String(labels[i]), valign, halign, null, angle, null, bold, null, textOptions);
}
// Do this for the next time around
......@@ -1818,6 +1834,13 @@
var font = this._otherProps._text_font;
var units_pre = this._otherProps._units_pre;
var units_post = this._otherProps._units_post;
var bold = this._otherProps._labels_above_bold;
var textOptions =
{
color: this._otherProps._labels_above_color,
underline: this._otherProps._labels_above_underline,
italic: this._otherProps._labels_above_italic
}
context.strokeStyle = 'black';
context.fillStyle = 'black';
......@@ -1843,7 +1866,7 @@
'center',
false,//ðàìêà
null,
'rgba(255, 255, 255, 0.7)');
'rgba(255, 255, 255, 0.7)', bold, null, textOptions);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment