Commit 2fe5d860 authored by Sergey Luzyanin's avatar Sergey Luzyanin

new methods for builder

parent 05c1961f
......@@ -126,10 +126,14 @@
* */
/**
*
* @typedef {("none" | "nextTo" | "low" | "high")} TickLabelPosition
* **/
/**
* @typedef {("cross" | "in" | "none" | "out")} TickMark
* */
/**
* Class representing a base class for color types
* @constructor
......@@ -913,30 +917,33 @@
* Specifies a chart title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
*/
ApiChart.prototype.SetTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetTitle = function (sTitle, nFontSize, bIsBold)
{
AscFormat.builder_SetChartTitle(this.Chart, sTitle, nFontSize);
AscFormat.builder_SetChartTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
/**
* Specifies a horizontal axis title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
* */
ApiChart.prototype.SetHorAxisTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetHorAxisTitle = function (sTitle, nFontSize, bIsBold)
{
AscFormat.builder_SetChartHorAxisTitle(this.Chart, sTitle, nFontSize);
AscFormat.builder_SetChartHorAxisTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
/**
* Specifies a vertical axis title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
* */
ApiChart.prototype.SetVerAxisTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetVerAxisTitle = function (sTitle, nFontSize, bIsBold)
{
AscFormat.builder_SetChartVertAxisTitle(this.Chart, sTitle, nFontSize);
AscFormat.builder_SetChartVertAxisTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
......@@ -948,6 +955,40 @@
AscFormat.builder_SetChartVertAxisOrientation(this.Chart, bIsMinMax);
};
/**
* Specifies major tick mark for horizontal axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetHorAxisMajorTickMark = function(sTickMark){
AscFormat.builder_SetChartHorAxisMajorTickMark(this.Chart, sTickMark);
};/**
* Specifies minor tick mark for horizontal axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetHorAxisMinorTickMark = function(sTickMark){
AscFormat.builder_SetChartHorAxisMinorTickMark(this.Chart, sTickMark);
};
/**
* Specifies major tick mark for vertical axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetVertAxisMajorTickMark = function(sTickMark){
AscFormat.builder_SetChartVerAxisMajorTickMark(this.Chart, sTickMark);
};
/**
* Specifies minor tick mark for vertical axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetVertAxisMinorTickMark = function(sTickMark){
AscFormat.builder_SetChartVerAxisMinorTickMark(this.Chart, sTickMark);
};
/**
* Specifies a horizontal axis orientation
* @param {bool} bIsMinMax
......@@ -1062,6 +1103,12 @@
ApiChart.prototype["SetVertAxisTickLabelPosition"] = ApiChart.prototype.SetVertAxisTickLabelPosition;
ApiChart.prototype["SetHorAxisTickLabelPosition"] = ApiChart.prototype.SetHorAxisTickLabelPosition;
ApiChart.prototype["SetHorAxisMajorTickMark"] = ApiChart.prototype.SetHorAxisMajorTickMark;
ApiChart.prototype["SetHorAxisMinorTickMark"] = ApiChart.prototype.SetHorAxisMinorTickMark;
ApiChart.prototype["SetVertAxisMajorTickMark"] = ApiChart.prototype.SetVertAxisMajorTickMark;
ApiChart.prototype["SetVertAxisMinorTickMark"] = ApiChart.prototype.SetVertAxisMinorTickMark;
ApiColor.prototype["GetClassType"] = ApiColor.prototype.GetClassType;
......
......@@ -12368,7 +12368,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
return oLn;
}
function builder_CreateChartTitle(sTitle, nFontSize, oDrawingDocument){
function builder_CreateChartTitle(sTitle, nFontSize, bIsBold, oDrawingDocument){
if(typeof sTitle === "string" && sTitle.length > 0){
var oTitle = new AscFormat.CTitle();
oTitle.setOverlay(false);
......@@ -12376,7 +12376,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
var oTextBody = AscFormat.CreateTextBodyFromString(sTitle, oDrawingDocument, oTitle.tx);
if(AscFormat.isRealNumber(nFontSize)){
oTextBody.content.Set_ApplyToAll(true);
oTextBody.content.Paragraph_Add(new ParaTextPr({ FontSize : nFontSize}));
oTextBody.content.Paragraph_Add(new ParaTextPr({ FontSize : nFontSize, Bold: bIsBold}));
oTextBody.content.Set_ApplyToAll(false);
}
oTitle.tx.setRich(oTextBody);
......@@ -12386,7 +12386,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
}
function builder_CreateTitle(sTitle, nFontSize, oChartSpace)
function builder_CreateTitle(sTitle, nFontSize, bIsBold, oChartSpace)
{
if(typeof sTitle === "string" && sTitle.length > 0){
var oTitle = new AscFormat.CTitle();
......@@ -12395,7 +12395,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
var oTextBody = AscFormat.CreateTextBodyFromString(sTitle, oChartSpace.getDrawingDocument(), oTitle.tx);
if(AscFormat.isRealNumber(nFontSize)){
oTextBody.content.Set_ApplyToAll(true);
oTextBody.content.Paragraph_Add(new ParaTextPr({ FontSize : nFontSize}));
oTextBody.content.Paragraph_Add(new ParaTextPr({ FontSize : nFontSize, Bold: bIsBold}));
oTextBody.content.Set_ApplyToAll(false);
}
oTitle.tx.setRich(oTextBody);
......@@ -12404,29 +12404,29 @@ function CorrectUniColor(asc_color, unicolor, flag)
return null;
}
function builder_SetChartTitle(oChartSpace, sTitle, nFontSize){
function builder_SetChartTitle(oChartSpace, sTitle, nFontSize, bIsBold){
if(oChartSpace){
oChartSpace.chart.setTitle(builder_CreateChartTitle(sTitle, nFontSize, oChartSpace.getDrawingDocument()));
oChartSpace.chart.setTitle(builder_CreateChartTitle(sTitle, nFontSize, bIsBold, oChartSpace.getDrawingDocument()));
}
}
function builder_SetChartHorAxisTitle(oChartSpace, sTitle, nFontSize){
function builder_SetChartHorAxisTitle(oChartSpace, sTitle, nFontSize, bIsBold){
if(oChartSpace){
var horAxis = oChartSpace.chart.plotArea.getHorizontalAxis();
if(horAxis){
horAxis.setTitle(builder_CreateTitle(sTitle, nFontSize, oChartSpace));
horAxis.setTitle(builder_CreateTitle(sTitle, nFontSize, bIsBold, oChartSpace));
}
}
}
function builder_SetChartVertAxisTitle(oChartSpace, sTitle, nFontSize){
function builder_SetChartVertAxisTitle(oChartSpace, sTitle, nFontSize, bIsBold){
if(oChartSpace){
var verAxis = oChartSpace.chart.plotArea.getVerticalAxis();
if(verAxis)
{
if(typeof sTitle === "string" && sTitle.length > 0)
{
verAxis.setTitle(builder_CreateTitle(sTitle, nFontSize, oChartSpace));
verAxis.setTitle(builder_CreateTitle(sTitle, nFontSize, bIsBold, oChartSpace));
if(verAxis.title){
var _body_pr = new AscFormat.CBodyPr();
_body_pr.reset();
......@@ -12607,6 +12607,76 @@ function CorrectUniColor(asc_color, unicolor, flag)
}
}
function builder_GetTickMark(sTickMark){
var nNewTickMark = null;
switch(sTickMark){
case 'cross':
{
nNewTickMark = Asc.c_oAscTickMark.TICK_MARK_CROSS;
break;
}
case 'in':
{
nNewTickMark = Asc.c_oAscTickMark.TICK_MARK_IN;
break;
}
case 'none':
{
nNewTickMark = Asc.c_oAscTickMark.TICK_MARK_NONE;
break;
}
case 'out':
{
nNewTickMark = Asc.c_oAscTickMark.TICK_MARK_OUT;
break;
}
}
return nNewTickMark;
}
function builder_SetChartAxisMajorTickMark(oAxis, sTickMark){
if(!oAxis){
return;
}
var nNewTickMark = builder_GetTickMark(sTickMark);
if(nNewTickMark !== null){
oAxis.setMajorTickMark(nNewTickMark);
}
}
function builder_SetChartAxisMinorTickMark(oAxis, sTickMark){
if(!oAxis){
return;
}
var nNewTickMark = builder_GetTickMark(sTickMark);
if(nNewTickMark !== null){
oAxis.setMinorTickMark(nNewTickMark);
}
}
function builder_SetChartHorAxisMajorTickMark(oChartSpace, sTickMark){
if(oChartSpace){
builder_SetChartAxisMajorTickMark(oChartSpace.chart.plotArea.getHorizontalAxis(), sTickMark);
}
}
function builder_SetChartHorAxisMinorTickMark(oChartSpace, sTickMark){
if(oChartSpace){
builder_SetChartAxisMinorTickMark(oChartSpace.chart.plotArea.getHorizontalAxis(), sTickMark);
}
}
function builder_SetChartVerAxisMajorTickMark(oChartSpace, sTickMark){
if(oChartSpace){
builder_SetChartAxisMajorTickMark(oChartSpace.chart.plotArea.getVerticalAxis(), sTickMark);
}
}
function builder_SetChartVerAxisMinorTickMark(oChartSpace, sTickMark){
if(oChartSpace){
builder_SetChartAxisMinorTickMark(oChartSpace.chart.plotArea.getVerticalAxis(), sTickMark);
}
}
//----------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].CreateFontRef = CreateFontRef;
......@@ -12729,6 +12799,13 @@ function CorrectUniColor(asc_color, unicolor, flag)
window['AscFormat'].builder_SetChartVertAxisTickLablePosition = builder_SetChartVertAxisTickLablePosition;
window['AscFormat'].builder_SetChartHorAxisTickLablePosition = builder_SetChartHorAxisTickLablePosition;
window['AscFormat'].builder_SetChartHorAxisMajorTickMark = builder_SetChartHorAxisMajorTickMark;
window['AscFormat'].builder_SetChartHorAxisMinorTickMark = builder_SetChartHorAxisMinorTickMark;
window['AscFormat'].builder_SetChartVerAxisMajorTickMark = builder_SetChartVerAxisMajorTickMark;
window['AscFormat'].builder_SetChartVerAxisMinorTickMark = builder_SetChartVerAxisMinorTickMark;
window['AscFormat'].Ax_Counter = Ax_Counter;
window['AscFormat'].TYPE_TRACK = TYPE_TRACK;
window['AscFormat'].TYPE_KIND = TYPE_KIND;
......
......@@ -196,6 +196,13 @@
/**
* @typedef {"cross" | "dashDnDiag" | "dashHorz" | "dashUpDiag" | "dashVert" | "diagBrick" | "diagCross" | "divot" | "dkDnDiag" | "dkHorz" | "dkUpDiag" | "dkVert" | "dnDiag" | "dotDmnd" | "dotGrid" | "horz" | "horzBrick" | "lgCheck" | "lgConfetti" | "lgGrid" | "ltDnDiag" | "ltHorz" | "ltUpDiag" | "ltVert" | "narHorz" | "narVert" | "openDmnd" | "pct10" | "pct20" | "pct25" | "pct30" | "pct40" | "pct5" | "pct50" | "pct60" | "pct70" | "pct75" | "pct80" | "pct90" | "plaid" | "shingle" | "smCheck" | "smConfetti" | "smGrid" | "solidDmnd" | "sphere" | "trellis" | "upDiag" | "vert" | "wave" | "wdDnDiag" | "wdUpDiag" | "weave" | "zigZag"} PatternType
* */
/**
* @typedef {("cross" | "in" | "none" | "out")} TickMark
* */
//------------------------------------------------------------------------------------------------------------------
//
// Base Api
......@@ -627,30 +634,33 @@
* Specifies a chart title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
*/
ApiChart.prototype.SetTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetTitle = function (sTitle, nFontSize, bIsBold)
{
AscFormat.builder_SetChartTitle(this.Chart, sTitle, nFontSize);
AscFormat.builder_SetChartTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
/**
* Specifies a horizontal axis title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
* */
ApiChart.prototype.SetHorAxisTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetHorAxisTitle = function (sTitle, nFontSize, bIsBold)
{
AscFormat.builder_SetChartHorAxisTitle(this.Chart, sTitle, nFontSize);
AscFormat.builder_SetChartHorAxisTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
/**
* Specifies a vertical axis title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
* */
ApiChart.prototype.SetVerAxisTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetVerAxisTitle = function (sTitle, nFontSize, bIsBold)
{
AscFormat.builder_SetChartVertAxisTitle(this.Chart, sTitle, nFontSize);
AscFormat.builder_SetChartVertAxisTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
/**
......@@ -709,6 +719,44 @@
};
/**
* Specifies major tick mark for horizontal axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetHorAxisMajorTickMark = function(sTickMark){
AscFormat.builder_SetChartHorAxisMajorTickMark(this.Chart, sTickMark);
};
/**
* Specifies minor tick mark for horizontal axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetHorAxisMinorTickMark = function(sTickMark){
AscFormat.builder_SetChartHorAxisMinorTickMark(this.Chart, sTickMark);
};
/**
* Specifies major tick mark for vertical axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetVertAxisMajorTickMark = function(sTickMark){
AscFormat.builder_SetChartVerAxisMajorTickMark(this.Chart, sTickMark);
};
/**
* Specifies minor tick mark for vertical axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetVertAxisMinorTickMark = function(sTickMark){
AscFormat.builder_SetChartVerAxisMinorTickMark(this.Chart, sTickMark);
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Export
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -745,17 +793,22 @@
ApiShape.prototype["GetDocContent"] = ApiShape.prototype.GetDocContent;
ApiShape.prototype["SetVerticalTextAlign"] = ApiShape.prototype.SetVerticalTextAlign;
ApiChart.prototype["GetClassType"] = ApiChart.prototype.GetClassType;
ApiChart.prototype["SetTitle"] = ApiChart.prototype.SetTitle;
ApiChart.prototype["SetHorAxisTitle"] = ApiChart.prototype.SetHorAxisTitle;
ApiChart.prototype["SetVerAxisTitle"] = ApiChart.prototype.SetVerAxisTitle;
ApiChart.prototype["SetVerAxisOrientation"] = ApiChart.prototype.SetVerAxisOrientation;
ApiChart.prototype["SetHorAxisOrientation"] = ApiChart.prototype.SetHorAxisOrientation;
ApiChart.prototype["SetLegendPos"] = ApiChart.prototype.SetLegendPos;
ApiChart.prototype["SetShowDataLabels"] = ApiChart.prototype.SetShowDataLabels;
ApiChart.prototype["GetClassType"] = ApiChart.prototype.GetClassType;
ApiChart.prototype["SetTitle"] = ApiChart.prototype.SetTitle;
ApiChart.prototype["SetHorAxisTitle"] = ApiChart.prototype.SetHorAxisTitle;
ApiChart.prototype["SetVerAxisTitle"] = ApiChart.prototype.SetVerAxisTitle;
ApiChart.prototype["SetVerAxisOrientation"] = ApiChart.prototype.SetVerAxisOrientation;
ApiChart.prototype["SetHorAxisOrientation"] = ApiChart.prototype.SetHorAxisOrientation;
ApiChart.prototype["SetLegendPos"] = ApiChart.prototype.SetLegendPos;
ApiChart.prototype["SetShowDataLabels"] = ApiChart.prototype.SetShowDataLabels;
ApiChart.prototype["SetVertAxisTickLabelPosition"] = ApiChart.prototype.SetVertAxisTickLabelPosition;
ApiChart.prototype["SetHorAxisTickLabelPosition"] = ApiChart.prototype.SetHorAxisTickLabelPosition;
ApiChart.prototype["SetHorAxisMajorTickMark"] = ApiChart.prototype.SetHorAxisMajorTickMark;
ApiChart.prototype["SetHorAxisMinorTickMark"] = ApiChart.prototype.SetHorAxisMinorTickMark;
ApiChart.prototype["SetVertAxisMajorTickMark"] = ApiChart.prototype.SetVertAxisMajorTickMark;
ApiChart.prototype["SetVertAxisMinorTickMark"] = ApiChart.prototype.SetVertAxisMinorTickMark;
function private_GetCurrentSlide(){
var oApiPresentation = editor.GetPresentation();
if(oApiPresentation){
......
......@@ -566,6 +566,12 @@
* @memberof Api
* @returns {ApiDocument}
*/
/**
* @typedef {("cross" | "in" | "none" | "out")} TickMark
* */
Api.prototype.GetDocument = function()
{
return new ApiDocument(this.WordControl.m_oLogicDocument);
......@@ -3943,68 +3949,35 @@
* Specifies a chart title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
*/
ApiChart.prototype.SetTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetTitle = function (sTitle, nFontSize, bIsBold)
{
if(this.Chart)
{
this.Chart.chart.setTitle(this.CreateTitle(sTitle, nFontSize));
}
AscFormat.builder_SetChartTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
/**
* Specifies a horizontal axis title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
* */
ApiChart.prototype.SetHorAxisTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetHorAxisTitle = function (sTitle, nFontSize, bIsBold)
{
if(this.Chart)
{
var horAxis = this.Chart.chart.plotArea.getHorizontalAxis();
if(horAxis)
{
horAxis.setTitle(this.CreateTitle(sTitle, nFontSize));
}
}
AscFormat.builder_SetChartHorAxisTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
/**
* Specifies a vertical axis title
* @param {string} sTitle
* @param {hps} nFontSize
* @param {?bool} bIsBold
* */
ApiChart.prototype.SetVerAxisTitle = function (sTitle, nFontSize)
ApiChart.prototype.SetVerAxisTitle = function (sTitle, nFontSize, bIsBold)
{
if(this.Chart)
{
var verAxis = this.Chart.chart.plotArea.getVerticalAxis();
if(verAxis)
{
if(typeof sTitle === "string" && sTitle.length > 0)
{
verAxis.setTitle(this.CreateTitle(sTitle, nFontSize));
if(verAxis.title){
var _body_pr = new AscFormat.CBodyPr();
_body_pr.reset();
if(!verAxis.title.txPr)
{
verAxis.title.setTxPr(AscFormat.CreateTextBodyFromString("", this.Chart.getDrawingDocument(), verAxis.title));
}
var _text_body = verAxis.title.txPr;
_text_body.setBodyPr(_body_pr);
verAxis.title.setOverlay(false);
}
}
else
{
verAxis.setTitle(null);
}
}
}
AscFormat.builder_SetChartVertAxisTitle(this.Chart, sTitle, nFontSize, bIsBold);
};
/**
* Specifies a vertical axis orientation
* @param {bool} bIsMinMax
......@@ -4110,6 +4083,41 @@
};
/**
* Specifies major tick mark for horizontal axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetHorAxisMajorTickMark = function(sTickMark){
AscFormat.builder_SetChartHorAxisMajorTickMark(this.Chart, sTickMark);
};
/**
* Specifies minor tick mark for horizontal axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetHorAxisMinorTickMark = function(sTickMark){
AscFormat.builder_SetChartHorAxisMinorTickMark(this.Chart, sTickMark);
};
/**
* Specifies major tick mark for vertical axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetVertAxisMajorTickMark = function(sTickMark){
AscFormat.builder_SetChartVerAxisMajorTickMark(this.Chart, sTickMark);
};
/**
* Specifies minor tick mark for vertical axis
* @param {TickMark} sTickMark
* */
ApiChart.prototype.SetVertAxisMinorTickMark = function(sTickMark){
AscFormat.builder_SetChartVerAxisMinorTickMark(this.Chart, sTickMark);
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiFill
......@@ -4469,6 +4477,11 @@
ApiChart.prototype["SetVertAxisTickLabelPosition"] = ApiChart.prototype.SetVertAxisTickLabelPosition;
ApiChart.prototype["SetHorAxisTickLabelPosition"] = ApiChart.prototype.SetHorAxisTickLabelPosition;
ApiChart.prototype["SetHorAxisMajorTickMark"] = ApiChart.prototype.SetHorAxisMajorTickMark;
ApiChart.prototype["SetHorAxisMinorTickMark"] = ApiChart.prototype.SetHorAxisMinorTickMark;
ApiChart.prototype["SetVertAxisMajorTickMark"] = ApiChart.prototype.SetVertAxisMajorTickMark;
ApiChart.prototype["SetVertAxisMinorTickMark"] = ApiChart.prototype.SetVertAxisMinorTickMark;
ApiFill.prototype["GetClassType"] = ApiFill.prototype.GetClassType;
ApiStroke.prototype["GetClassType"] = ApiStroke.prototype.GetClassType;
......
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