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

масштабирование текста внутри диаграммы

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47417 954022d7-b5bf-4e40-9824-e11837661b57
parent 6ff60e48
...@@ -12,6 +12,8 @@ function ChartRender() { ...@@ -12,6 +12,8 @@ function ChartRender() {
else else
g_bChartPreview = false; g_bChartPreview = false;
if (chart.worksheet && !OfficeExcel.drawingCtxCharts)//выставление контекста для отрисовки
OfficeExcel.drawingCtxCharts = chart.worksheet.getDrawingContextCharts();
chartCanvas = document.createElement('canvas'); chartCanvas = document.createElement('canvas');
$(chartCanvas).css('width', width); $(chartCanvas).css('width', width);
$(chartCanvas).css('height', height); $(chartCanvas).css('height', height);
...@@ -437,7 +439,7 @@ function calcGutter(axis,min,max,ymin,ymax,isSkip,isFormatCell) { ...@@ -437,7 +439,7 @@ function calcGutter(axis,min,max,ymin,ymax,isSkip,isFormatCell) {
} }
} }
} }
//ширины самих линий графика
function calcWidthGraph() { function calcWidthGraph() {
if ( !chartCanvas ) if ( !chartCanvas )
...@@ -630,10 +632,13 @@ function calcAllMargin(isFormatCell,isformatCellScOy,minX,maxX,minY,maxY, chart) ...@@ -630,10 +632,13 @@ function calcAllMargin(isFormatCell,isformatCellScOy,minX,maxX,minY,maxY, chart)
if(bar._xAxisTitle._text != '' && (min >= 0 || bar.type == 'hbar') && bar._otherProps._xlabels) if(bar._xAxisTitle._text != '' && (min >= 0 || bar.type == 'hbar') && bar._otherProps._xlabels)
bottom += 7; bottom += 7;
} }
bar._chartGutter._left = standartMargin + left; var scale = 1;
bar._chartGutter._right = standartMargin + right; if(OfficeExcel && OfficeExcel.drawingCtxCharts)
bar._chartGutter._top = standartMargin + top; scale = OfficeExcel.drawingCtxCharts.scaleFactor;
bar._chartGutter._bottom = bottom + standartMargin; bar._chartGutter._left = (standartMargin + left)*scale;
bar._chartGutter._right = (standartMargin + right)*scale;
bar._chartGutter._top = (standartMargin + top)*scale;
bar._chartGutter._bottom = (bottom + standartMargin)*scale;
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -2031,7 +2036,4 @@ function setFontChart(chart) ...@@ -2031,7 +2036,4 @@ function setFontChart(chart)
bar._otherProps._text_font = defaultFont; bar._otherProps._text_font = defaultFont;
bar._otherProps._text_size = defaultSize; bar._otherProps._text_size = defaultSize;
} }
if (chart.worksheet)//выставление контекста для отрисовки
bar.drawingCtxCharts = chart.worksheet.getDrawingContextCharts();
} }
...@@ -1498,7 +1498,7 @@ ...@@ -1498,7 +1498,7 @@
*/ */
OfficeExcel.Text = function (context, font, size, x, y, text) OfficeExcel.Text = function (context, font, size, x, y, text)
{ {
var drwContext = bar.drawingCtxCharts; var drwContext = OfficeExcel.drawingCtxCharts;
if(drwContext) if(drwContext)
{ {
drwContext.setCanvas(bar.canvas); drwContext.setCanvas(bar.canvas);
...@@ -1572,7 +1572,8 @@ ...@@ -1572,7 +1572,8 @@
context.setFillStyle(arguments[13].color); context.setFillStyle(arguments[13].color);
else else
context.setFillStyle("#000000"); context.setFillStyle("#000000");
x = x/(drwContext.scaleFactor);
y = y/(drwContext.scaleFactor);
// Rotate the canvas if need be // Rotate the canvas if need be
if (arguments[9] && textSize) { if (arguments[9] && textSize) {
var textOptions = var textOptions =
...@@ -1588,7 +1589,7 @@ ...@@ -1588,7 +1589,7 @@
if(!arguments[9]) if(!arguments[9])
{ {
context.fillText(text, x*0.75, y*0.75, undefined, [6.36474609375]); context.fillText(text, x*0.75, y*0.75);
context.lineWidth = 1; context.lineWidth = 1;
} }
context.restore(); context.restore();
......
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