Commit 7e9127a6 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Меню для выставления настроек для осей

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54888 954022d7-b5bf-4e40-9824-e11837661b57
parent ffec1835
......@@ -173,6 +173,8 @@
<script src="../Word/Editor/Styles.js"></script>
<script src="../Word/Editor/Numbering.js"></script>
<script src="../Word/Editor/ParagraphContent.js"></script>
<script src="../Word/Editor/Run.js"></script>
<script src="../Word/Editor/Hyperlink.js"></script>
<script src="../Word/Editor/Comments.js"></script>
<script src="../Word/Editor/FlowObjects.js"></script>
......@@ -487,6 +489,17 @@
{
background: #303030;
}
.left_panel_chart_props_no_select
{
background-color: #ffffff;
}
.left_panel_chart_props_select
{
background-color: #8bb9f0;
}
.right_panel_drawing_props
{
position: absolute;
......@@ -2230,6 +2243,7 @@ Format
<option value='Scatter'>Scatter</option>
<option value='Stock'>Stock</option>
<option value='Doughnut'>Doughnut</option>
<option value='Radar'>Radar</option>
</select>
<select id='chartSubType' style='width: 320px; margin: 10px;'>
<option value='Normal' selected>Normal</option>
......@@ -2290,17 +2304,17 @@ Format
<div id="chartPropsMenuDiv" style="background: #ece9d8; z-index:500; width: 619px; height: 515px; position: absolute; left:100px; top:100px; font-family: Tahoma; display: none">
<div id="leftPanelChartPropsDiv" style="position:absolute; left: 7px; top: 7px; height: 470px; width: 150px; background: #ffffff;border: 1px solid rgb(127,157,185)">
<div class="leftPanelCharPropsItemDiv" id="designChartLeft">
<div class="leftPanelCharPropsItemDiv left_panel_chart_props_select" id="designChartLeft">
<p>Design</p>
</div>
<div class="leftPanelCharPropsItemDiv" id="valAxisProps">
<div class="leftPanelCharPropsItemDiv left_panel_chart_props_no_select" id="valAxisProps">
<p>Value Axis Props</p>
</div>
<div class="leftPanelCharPropsItemDiv" id="catAxisProps">
<div class="leftPanelCharPropsItemDiv left_panel_chart_props_no_select" id="catAxisProps">
<p>Cat Axis Props</p>
</div>
</div>
<div id="rightPanelChartPropsDiv" class="right_panel_drawing_props" >
<div id="rightPanelChartPropsDiv" class="right_panel_drawing_props">
<div><p style="font-size: 14pt">Design</p></div>
<!--<button id="chageChartTypeButton">Change Type</button> -->
<select id="changeChartTypeSelect">
......@@ -2370,22 +2384,22 @@ Format
<br>
<label style="font-size: 11pt">Data Labels</label>
<br>
<select id="chartDataLabels">
<option value="none">None</option>
<option value="center">Center</option>
<option value="inner_top">Inner Top</option>
<option value="in_base">In Base</option>
<option value="out_end">Out End</option>
<option value="right_overlay">Right Overlay</option>
<option value="left_overlay">Left Overlay</option>
</select>
<div id="labelsOptionsDiv">
<input type="checkbox" class="dataLabelsCheckBox" value="serName"><label style="font-size: 10pt">Series Name</label>
<br><input type="checkbox" class="dataLabelsCheckBox" value="catName"><label style="font-size: 10pt">Cat Name</label>
<br><input type="checkbox" class="dataLabelsCheckBox" value="val"><label style="font-size: 10pt">Value</label>
</div>
<label style="font-size: 10pt">Data Labels Separator</label><input type="text" id="dataLabelsSeparatorInput">
<br><button id="dataLblsPrApplyButton">Apply</button>
<select id="chartDataLabels">
<option value="none">None</option>
<option value="center">Center</option>
<option value="inner_top">Inner Top</option>
<option value="in_base">In Base</option>
<option value="out_end">Out End</option>
<option value="right_overlay">Right Overlay</option>
<option value="left_overlay">Left Overlay</option>
</select>
<div id="labelsOptionsDiv">
<input type="checkbox" class="dataLabelsCheckBox" value="serName"><label style="font-size: 10pt">Series Name</label>
<br><input type="checkbox" class="dataLabelsCheckBox" value="catName"><label style="font-size: 10pt">Cat Name</label>
<br><input type="checkbox" class="dataLabelsCheckBox" value="val"><label style="font-size: 10pt">Value</label>
</div>
<label style="font-size: 10pt">Data Labels Separator</label><input type="text" id="dataLabelsSeparatorInput">
<br><button id="dataLblsPrApplyButton">Apply</button>
<br>
<label style="font-size: 11pt">Hor Axis</label>
<select id="chartHorAxis">
......@@ -2401,9 +2415,6 @@ Format
<option value="byDefault">By Default</option>
<option value="log">Log</option>
</select>
<br>
<label style="font-size: 11pt">Hor Grid Lines</label>
<select id="chartHorGridLines">
......@@ -2422,15 +2433,15 @@ Format
<option value="minor_major">Major&Minor</option>
</select>
</div>
<div id="rightPanelValAxisProps" class="right_panel_drawing_props" style="display: none">
<div id="rightPanelValAxisProps" class="right_panel_drawing_props" style="display: none" >
<label style="font-weight: bold">min value</label><br>
<label>auto</label><input type="radio" name="min_value" value="auto" checked="checked">
<label>fixed</label><input type="radio" name="min_value" value="fixed">
<label>auto</label><input type="radio" name="min_value" value="auto" checked="checked" id="autoMinValValAxisCheckBox">
<label>fixed</label><input type="radio" name="min_value" value="fixed" id="fixedMinValValAxisCheckBox">
<input id="minValueAxisInput" type="text" disabled="disabled">
<br>
<label style="font-weight: bold">max value</label><br>
<label>auto</label><input type="radio" name="max_value" value="auto" checked="checked">
<label>fixed</label><input type="radio" name="max_value" value="fixed">
<label>auto</label><input type="radio" name="max_value" value="auto" checked="checked" id="autoMaxValValAxisCheckBox">
<label>fixed</label><input type="radio" name="max_value" value="fixed" id="fixedMaxValValAxisCheckBox">
<input id="maxValueAxisInput" type="text" disabled="disabled">
<br>
<label>invert val order</label> <input type="checkbox" id="invertValOrderValAxisInput">
......@@ -2441,8 +2452,7 @@ Format
<select id="unitsSelect">
<option value="none">None</option>
<option value="BILLIONS">BILLIONS</option>
<option value="BILLIONS">BILLIONS</option>
<option value="HUNDRED_MILLIONS ">HUNDRED_MILLIONS</option>
<option value="HUNDRED_MILLIONS">HUNDRED_MILLIONS</option>
<option value="HUNDREDS">HUNDREDS</option>
<option value="HUNDRED_THOUSANDS">HUNDRED_THOUSANDS</option>
<option value="MILLIONS">MILLIONS</option>
......@@ -2478,136 +2488,91 @@ Format
<option value="TICK_LABEL_POSITION_NEXT_TO">TICK_LABEL_POSITION_NEXT_TO</option>
<option value="TICK_LABEL_POSITION_NONE">TICK_LABEL_POSITION_NONE</option>
</select>
<br>
<div style="width: inherit; height: 1px; background: rgb(127,157,185)"></div>
<br>
<label>Crosses</label>
<br>
<label>auto</label><input type="radio" name="crosses" value="auto" checked="checked"><br>
<label>value</label><input type="radio" name="crosses" value="value"><input type="text" id="crossesValInput" disabled="disabled"><br>
<label>max value</label><input type="radio" name="crosses" value="maxValue">
<label>auto</label><input type="radio" name="crosses" value="auto" checked="checked" id="crossesAutoValAxInput"><br>
<label>value</label><input type="radio" name="crosses" value="value" id="crossesValAxValInput"><input type="text" id="crossesValInput" disabled="disabled"><br>
<label>max value</label><input type="radio" name="crosses" value="maxValue" id="crossesMaxAxValInput">
<br>
<br>
<div style="width: inherit; height: 1px; background: rgb(127,157,185)"></div>
<br>
<button id="valApplyValAxisProps">
Apply
Apply Props
</button>
</div>
<div id="rigthPanelCatAxProps" class="right_panel_drawing_props" style="display: none">
<label>interval between tick</label> <input type="text" id="intervalBetweenTickInput">
<div id="rightPanelCatAxProps" class="right_panel_drawing_props" style="display: none">
<label style="font-weight: bold">Axis Settings</label><br>
<label>interval between tick</label> <input type="text" id="intervalBetweenTickInput" value="1">
<br>
<label>interval between labels:</label>
<br>
<input type="radio" name="intervalBetweenLabels" value="auto"><label>auto</label>
<input type="radio" name="intervalBetweenLabels" value="auto" class="intervalBetweenLabelsCatAxInput" checked="checked"><label>auto</label>
<br>
<input type="radio" name="intervalBetweenLabels" value="manual"><label>manual</label>
<input type="radio" name="intervalBetweenLabels" value="manual" class="intervalBetweenLabelsCatAxInput"><label>manual</label>
<input type="text" id="intervalBetweenLabelsInputCatAxManual" disabled="disabled">
<br>
<input type="checkbox" id="invertCatOrderChaeckBox"><label>Invert Cat Order</label>
<input type="checkbox" id="invertCatOrderCheckBox"><label>Invert Cat Order</label>
<br>
<label>Axis Type:</label>
<label>Labels Axis Distance: </label><input id="labelsAxisInputDistanceInput" type="text" value="100">
<br>
<input type="radio" name="horAxisTypeInput" value="auto"><label>auto</label>
<label>Axis Type:</label>
<br>
<input type="radio" name="horAxisTypeInput" value="auto" checked="checked"><label>auto</label>
<input type="radio" name="horAxisTypeInput" value="text"><label>text</label>
<br>
<input type="radio" name="horAxisTypeInput" value="date"><label>date</label>
<br>
<div style="width: inherit; height: 1px; background: rgb(127,157,185)"></div>
<label>major tick mark</label>
<select id="majorTickMarkSelectCatAx">
<option value="TICK_MARK_CROSS">TICK_MARK_CROSS</option>
<option value="TICK_MARK_IN">TICK_MARK_IN</option>
<option value="TICK_MARK_NONE">TICK_MARK_NONE</option>
<option value="TICK_MARK_OUT">TICK_MARK_OUT</option>
</select>
<br>
<label>minor tick mark</label>
<select id="minorTickMarkSelectCatAx">
<option value="TICK_MARK_CROSS">TICK_MARK_CROSS</option>
<option value="TICK_MARK_IN">TICK_MARK_IN</option>
<option value="TICK_MARK_NONE">TICK_MARK_NONE</option>
<option value="TICK_MARK_OUT">TICK_MARK_OUT</option>
</select>
<br>
<label>tick labels</label>
<select id="tickLabelsSelectCatAx">
<option value="TICK_LABEL_POSITION_HIGH">TICK_LABEL_POSITION_HIGH</option>
<option value="TICK_LABEL_POSITION_LOW">TICK_LABEL_POSITION_LOW</option>
<option value="TICK_LABEL_POSITION_NEXT_TO">TICK_LABEL_POSITION_NEXT_TO</option>
<option value="TICK_LABEL_POSITION_NONE">TICK_LABEL_POSITION_NONE</option>
</select>
<br>
<div style="width: inherit; height: 1px; background: rgb(127,157,185)"></div>
<label>Crosses</label>
<br>
<label>auto</label><input type="radio" name="crosses" value="auto" checked="checked" id="crossesAutoCatAxInput"><br>
<label>value</label><input type="radio" name="crosses" value="value" id="crossesCatAxValInput"><input type="text" id="crossesCatInput" disabled="disabled"><br>
<label>max value</label><input type="radio" name="crosses" value="maxValue" id="crossesMaxAxCatInput">
<br>
<label>Axis Position</label><br>
<label>by divisions:</label><input type="checkbox" id="checkBoxByDivisionsInput">
<br>
<label>between divisions:</label><input type="checkbox" id="checkBoxBetweenDivisionsInput">
<div style="width: inherit; height: 1px; background: rgb(127,157,185)"></div>
<button id="valApplyCatAxisProps">
Apply Props
</button>
</div>
<div id="rightPanelNumFmt" class="right_panel_drawing_props" style="display: none">
<button id="numFmtApplyButton">
Apply
</button>
</div>
</div>
<div id="changeChartTypeDiv" style="background: #ece9d8; z-index:500; width: 619px; height: 515px; position: absolute; left:100px; top:100px; font-family: Tahoma; display: none">
<div id="leftPanelChartType" style="position:absolute; left: 7px; top: 7px; height: 470px; width: 150px; background: #ffffff;border: 1px solid rgb(127,157,185)">
<div class="leftPanelCharPropsItemDiv" id="barTypeLeftPanel">
<p>Bar</p>
</div>
<div class="leftPanelCharPropsItemDiv" id="lineTypeLeftPanel">
<p>Line</p>
</div>
<div class="leftPanelCharPropsItemDiv" id="pieTypeLeftPanel">
<p>Pie</p>
</div>
<div class="leftPanelCharPropsItemDiv" id="hBarTypeLeftPanel">
<p>HBar</p>
</div>
<div class="leftPanelCharPropsItemDiv" id="areaTypeLeftPanel">
<p>Area</p>
</div>
<div class="leftPanelCharPropsItemDiv" id="scatterTypeLeftPanel">
<p>Scatter</p>
</div>
<div class="leftPanelCharPropsItemDiv" id="stockTypeLeftPanel">
<p>Stock</p>
</div>
</div>
<div class="right_panel_drawing_props" id="barTypeRightPanel" style="display: none">
</div>
<div class="right_panel_drawing_props" id="lineTypeRightPanel" style="display: none">
<p>Line</p>
</div>
<div class="right_panel_drawing_props" id="pieTypeRightPanel" style="display: none">
<p>Pie</p>
</div>
<div class="right_panel_drawing_props" id="hBarTypeRightPanel" style="display: none">
<p>HBar</p>
</div>
<div class="right_panel_drawing_props" id="areaTypeRightPanel" style="display: none">
<p>Area</p>
</div>
<div class="right_panel_drawing_props" id="scatterTypeRightPanel" style="display: none">
<p>Scatter</p>
</div>
<div class="right_panel_drawing_props" id="stockTypeRightPanel" style="display: none">
<p>Stock</p>
</div>
</div>
<div id="vertAxisMenuDiv" style="display: none;background: #ece9d8; z-index: 8000; width: 619px; height: 515px; position: absolute; left: 0px; top:0px">
<div id="leftPanelDiv">
<div class="leftPanelItem" id="vertAxisOptionsDiv">
<p>Axis Options</p>
</div>
<div class="leftPanelItem" id="vertAxisNumberDiv">
<p>Number</p>
</div>
<div class="leftPanelItem" id="vertAxisFillDiv">
<p>Fill</p>
</div>
<div class="leftPanelItem" id="vertAxisLineColorDiv">
<p>Line Color</p>
</div>
<div class="leftPanelItem" id="vertAxisLineTypeDiv">
<p>Line Type</p>
</div>
<div class="leftPanelItem" id="vertAxisShadowDiv">
<p>Shadow</p>
</div>
<div class="leftPanelItem" id="vertAxisGlowDiv">
<p>Glow</p>
</div>
<div class="leftPanelItem" id="vertAxis3DFormatDiv">
<p>3D Format</p>
</div>
<div class="leftPanelItem" id="vertAxisTextAlignmentDiv">
<p>Text Alignment</p>
</div>
</div>
</div>
<div id="shapeBox" class="options hidden">
<table>
......
......@@ -2964,5 +2964,108 @@
api.asc_editChartDrawingObject(settings);
}
);
$("#fixedMinValValAxisCheckBox").change(function(){this.checked && $("#minValueAxisInput").removeAttr("disabled");});
$("#autoMinValValAxisCheckBox").change(function(){this.checked && $("#minValueAxisInput").attr("disabled", "disabled");});
$("#fixedMaxValValAxisCheckBox").change(function(){this.checked && $("#maxValueAxisInput").removeAttr("disabled");});
$("#autoMaxValValAxisCheckBox").change(function(){this.checked && $("#maxValueAxisInput").attr("disabled", "disabled");});
$("#logScaleInput").change(function(){this.checked ? $("#logBaseInput").removeAttr("disabled") : $("#logBaseInput").attr("disabled", "disabled")});
$("#crossesValAxValInput").change(function(){this.checked && $("#crossesValInput").removeAttr("disabled");});
$("#crossesAutoValAxInput").change(function(){this.checked && $("#crossesValInput").attr("disabled", "disabled");});
$("#crossesMaxAxValInput").change(function(){this.checked && $("#crossesValInput").attr("disabled", "disabled");});
$(".leftPanelCharPropsItemDiv").mousedown(function()
{
$(".leftPanelCharPropsItemDiv").removeClass("left_panel_chart_props_select");
$(".leftPanelCharPropsItemDiv").addClass("left_panel_chart_props_no_select");
$(this).removeClass("left_panel_chart_props_no_select");
$(this).addClass("left_panel_chart_props_select");
$(".right_panel_drawing_props").css("display", "none");
var id = this.id;
switch(id)
{
case "designChartLeft":
{
$("#rightPanelChartPropsDiv").css("display","");
break;
}
case "valAxisProps":
{
$("#rightPanelValAxisProps").css("display","");
break;
}
case "catAxisProps":
{
$("#rightPanelCatAxProps").css("display","");
break;
}
}
});
$("#valApplyValAxisProps").click(
function()
{
var settings = new asc_ChartSettings()
var axis_settings = new asc_ValAxisSettings();
settings.putVertAxisProps(axis_settings);
if($("#autoMinValValAxisCheckBox").attr("checked"))
{
axis_settings.putMinValRule(c_oAscValAxisRule.auto)
}
else
{
axis_settings.putMinValRule(c_oAscValAxisRule.fixed);
axis_settings.putMinVal(parseInt($("#minValueAxisInput").attr("value")));
}
if($("#autoMaxValValAxisCheckBox").attr("checked"))
{
axis_settings.putMaxValRule(c_oAscValAxisRule.auto)
}
else
{
axis_settings.putMaxValRule(c_oAscValAxisRule.fixed);
axis_settings.putMaxVal(parseInt($("#maxValueAxisInput").attr("value")));
}
$("#invertValOrderValAxisInput").attr("checked") ? axis_settings.putInvertValOrder(true) : axis_settings.putInvertValOrder(false);
if($("#logScaleInput").attr("checked"))
{
axis_settings.putLogScale(true);
axis_settings.putLogBase(parseFloat($("#logBaseInput").attr("value")));
}
else
{
axis_settings.putLogScale(false);
}
axis_settings.putUnits(c_oAscValAxUnits[$("#unitsSelect").attr("value")]);
if($("#showUnitsLabels").attr("checked"))
axis_settings.putShowUnitsOnChart(true);
else
axis_settings.putShowUnitsOnChart(false);
axis_settings.putMajorTickMark(c_oAscTickMark[$("#majorTickMarkSelectValAx").attr("value")]);
axis_settings.putMinorTickMark(c_oAscTickMark[$("#minorTickMarkSelectValAx").attr("value")]);
axis_settings.putTickLabelsPos(c_oAscTickLabelsPos[$("#tickLabelsSelectValAx").attr("value")]);
if($("#crossesAutoValAxInput").attr("checked"))
{
axis_settings.putCrossesRule(c_oAscCrossesRule.auto);
}
else if($("#crossesMaxAxValInput").attr("checked"))
{
axis_settings.putCrossesRule(c_oAscCrossesRule.maxValue);
}
else
{
axis_settings.putCrossesRule(c_oAscCrossesRule.value);
axis_settings.putCrosses(parseFloat($("#crossesValInput").attr("value")));
}
api.asc_editChartDrawingObject(settings);
}
);
});
......@@ -2010,6 +2010,293 @@ CChartSpace.prototype.recalculateAxis = function()
x_ax.posY = x_ax.labels.y;
}
}
else if(chart_type === historyitem_type_RadarChart)
{
var gap_hor_axis = 4;
var axis = chart_object.axId;
var cat_ax, val_ax;
for(i = 0; i < axis.length; ++i)
{
if(!cat_ax && axis[i].getObjectType() === historyitem_type_CatAx)
cat_ax = axis[i];
if(!val_ax && axis[i].getObjectType() === historyitem_type_ValAx)
val_ax = axis[i];
if(cat_ax && val_ax)
break;
}
if(val_ax && cat_ax)
{
val_ax.labels = null;
cat_ax.labels = null;
var sizes = this.getChartSizes();
var rect = {x: sizes.startX, y:sizes.startY, w:sizes.w, h: sizes.h};
var arr_val = this.getValAxisValues();
//Получим строки для оси значений с учетом формата и единиц
var arr_strings = [];
var multiplier;
if(val_ax.dispUnits)
multiplier = val_ax.dispUnits.getMultiplier();
else
multiplier = 1;
var num_fmt = val_ax.numFmt;
if(num_fmt && typeof num_fmt.formatCode === "string" /*&& !(num_fmt.formatCode === "General")*/)
{
var num_format = oNumFormatCache.get(num_fmt.formatCode);
for(i = 0; i < arr_val.length; ++i)
{
var calc_value = arr_val[i]*multiplier;
var rich_value = num_format.format(calc_value, CellValueType.number, 15);
arr_strings.push(rich_value[0].text);
}
}
else
{
for(i = 0; i < arr_val.length; ++i)
{
var calc_value = arr_val[i]*multiplier;
arr_strings.push(calc_value + "");
}
}
//расчитаем подписи для вертикальной оси найдем ширину максимальной и возьмем её удвоенную за ширину подписей верт оси
val_ax.labels = new CValAxisLabels(this);
var max_width = 0;
val_ax.yPoints = [];
for(i = 0; i < arr_strings.length; ++i)
{
var dlbl = new CDLbl();
dlbl.parent = val_ax;
dlbl.chart = this;
dlbl.spPr = val_ax.spPr;
dlbl.txPr = val_ax.txPr;
dlbl.tx = new CChartText();
dlbl.tx.rich = CreateTextBodyFromString(arr_strings[i], this.getDrawingDocument(), dlbl);
dlbl.recalculate();
if(dlbl.tx.rich.content.XLimit > max_width)
max_width = dlbl.tx.rich.content.XLimit;
val_ax.labels.arrLabels.push(dlbl);
val_ax.yPoints.push({val: arr_val[i], pos: null});
}
for(i = 0; i < arr_strings.length; ++i)
{
val_ax.labels.arrLabels[i].tx.rich.content.Set_ApplyToAll(true);
val_ax.labels.arrLabels[i].tx.rich.content.Set_ParagraphAlign(align_Right);
val_ax.labels.arrLabels[i].tx.rich.content.Set_ApplyToAll(false);
val_ax.labels.arrLabels[i].tx.rich.content.Reset(0,0, max_width, 20000);
val_ax.labels.arrLabels[i].tx.rich.content.Recalculate_Page(0, true);
}
val_ax.labels.extX = max_width*2;
//расчитаем подписи для горизонтальной оси
var ser = chart_object.series[0];
var string_pts = [], pts_len = 0;
if(ser && ser.cat)
{
if(ser.cat.strRef && ser.cat.strRef.strCache)
{
string_pts = ser.cat.strRef.strCache.pt;
pts_len = string_pts.length;
}
else if(ser.cat.strLit)
{
string_pts = ser.cat.strLit.pt;
pts_len = string_pts.length;
}
}
if(string_pts.length === 0)
{
if(ser.val)
{
if(ser.val.numRef && ser.val.numRef.numCache)
pts_len = ser.val.numRef.numCache.pts.length;
else if(ser.val.numLit)
pts_len = ser.val.numLit.pts.length;
}
for(i = 0; i < pts_len; ++i)
{
string_pts.push({val:i+1 + ""});
}
}
//расчитаем ширину интервала без учета горизонтальной оси;
var crosses = val_ax.crosses;
if(crosses === CROSSES_AUTO_ZERO)
{
crosses = 0;
}
else
{
crosses -=1;
}
var point_width = rect.w/string_pts.length;
//смотрим выходят ли подписи верт. оси влево: TODO:вправо нужно потом рассмотреть
var left_points_width = point_width*crosses;//общая ширина левых точек если считать что точки занимают все пространство
if(left_points_width < val_ax.labels.extX)//подписи верт. оси выходят за пределы области построения
{
point_width = (rect.w - val_ax.labels.extX)/(string_pts.length - crosses);//делим ширину оставшуюся после вычета ширины на количество оставшихся справа точек
val_ax.labels.x = rect.x;
}
else
{
point_width = rect.w/string_pts.length;
val_ax.labels.x = rect.x + left_points_width - val_ax.labels.extX;
}
//проверим умещаются ли подписи горизонтальной оси в point_width
cat_ax.labels = new CValAxisLabels(this);
var tick_lbl_skip = isRealNumber(cat_ax.tickLblSkip) ? cat_ax.tickLblSkip : 1;
var max_min_width = 0;
var max_max_width = 0;
for(i = 0; i < string_pts.length; ++i)
{
var dlbl = null;
if(i%tick_lbl_skip === 0)
{
dlbl = new CDLbl();
dlbl.parent = cat_ax;
dlbl.chart = this;
dlbl.spPr = cat_ax.spPr;
dlbl.txPr = cat_ax.txPr;
dlbl.tx = new CChartText();
dlbl.tx.rich = CreateTextBodyFromString(string_pts[i].val, this.getDrawingDocument(), dlbl);
dlbl.recalculate();
var min_max = dlbl.tx.rich.content.Recalculate_MinMaxContentWidth();
var max_min_content_width = min_max.Min;
if(max_min_content_width > max_min_width)
max_min_width = max_min_content_width;
if(min_max.Max > max_max_width)
max_max_width = min_max.Max;
}
cat_ax.labels.arrLabels.push(dlbl);
}
if(max_min_width < point_width)//значит текст каждой из точек умещается в point_width
{
var max_height = 0;
for(i = 0; i < cat_ax.labels.arrLabels.length; ++i)
{
var content = cat_ax.labels.arrLabels[i].tx.rich.content;
content.Set_ApplyToAll(true);
content.Set_ParagraphAlign(align_Center);
content.Set_ApplyToAll(false);
content.Reset(0, 0, point_width, 20000);
content.Recalculate_Page(0, true);
var cur_height = content.Get_SummaryHeight();
if(cur_height > max_height)
max_height = cur_height;
}
val_ax.labels.y = rect.y;
val_ax.labels.extY = rect.h;
cat_ax.labels.extY = max_height + gap_hor_axis;
cat_ax.labels.x = val_ax.labels.x+val_ax.labels.extX - left_points_width;
cat_ax.labels.extX = point_width*string_pts.length;
var crosses_at = isRealNumber(cat_ax.crossesAt) ? cat_ax.crossesAt : arr_val[arr_val.length-1];
var interval = arr_val[arr_val.length-1] - arr_val[0];
cat_ax.labels.y = val_ax.labels.y + val_ax.labels.extY - ((arr_val[arr_val.length-1] - crosses_at)/interval)*val_ax.labels.extY;
//посмотрим на сколько выходят подписи вниз за пределы ректа
var gap = cat_ax.labels.y + cat_ax.labels.extY - (rect.y + rect.h);
if(gap > 0)
{
val_ax.labels.extY *= ((rect.h - gap)/rect.h);
cat_ax.labels.y = val_ax.labels.y + val_ax.labels.extY - ((arr_val[arr_val.length-1] - crosses_at)/interval)*val_ax.labels.extY;
}
cat_ax.xPoints = [];
for(i = 0; i <cat_ax.labels.arrLabels.length; ++i)
{
cat_ax.labels.arrLabels[i].setPosition(cat_ax.labels.x + point_width*i, cat_ax.labels.y + gap_hor_axis);
cat_ax.xPoints.push({pos: cat_ax.labels.x + point_width*(i+0.5), val: i});
}
var dist = val_ax.labels.extY/(val_ax.labels.arrLabels.length-1);
for(i = 0; i < val_ax.labels.arrLabels.length; ++i)
{
val_ax.labels.arrLabels[i].setPosition(val_ax.labels.x, val_ax.labels.y + dist*(val_ax.labels.arrLabels.length - i -1)
-val_ax.labels.arrLabels[i].tx.rich.content.Get_SummaryHeight()/2);
val_ax.yPoints[i].pos = val_ax.labels.y + dist*(val_ax.labels.arrLabels.length - i -1);
}
}
else
{
//Пока сделаем без обрезки текста
var min_x = rect.x + rect.w;
var max_height = 0;
var cur_height;
for(i = cat_ax.labels.arrLabels.length - 1; i > -1; --i)
{
cur_height = cat_ax.labels.arrLabels[i].tx.rich.content.Recalculate_MinMaxContentWidth().Max/Math.sqrt(2);
var cur_left = + rect.x + rect.w - cur_height - (cat_ax.labels.arrLabels.length - 1 - i)*point_width - point_width/2;
if(cur_left < min_x)
min_x = cur_left;
if(cur_height > max_height)
max_height = cur_height;
}
if(min_x < rect.x)
{
point_width -= (rect.x - min_x)/string_pts.length;
left_points_width = point_width*crosses;
val_ax.labels.x = rect.x + rect.w - point_width*(string_pts.length - crosses) - val_ax.labels.extX;
cat_ax.labels.x = rect.x;
}
else
{
cat_ax.labels.x = min_x > rect.x + rect.w - point_width*string_pts.length ? rect.x + rect.w - point_width*string_pts.length : min_x;
}
val_ax.labels.y = rect.y;
val_ax.labels.extY = rect.h;
var crosses_at = isRealNumber(cat_ax.crossesAt) ? cat_ax.crossesAt : arr_val[arr_val.length-1];
var interval = arr_val[arr_val.length-1] - arr_val[0];
cat_ax.labels.y = val_ax.labels.y + val_ax.labels.extY - ((arr_val[arr_val.length-1] - crosses_at)/interval)*val_ax.labels.extY;
cat_ax.labels.extX = rect.x + rect.w - cat_ax.labels.x;
cat_ax.labels.extY = max_height + gap_hor_axis;
//посмотрим на сколько выходят подписи вниз за пределы ректа
var gap = cat_ax.labels.y + cat_ax.labels.extY - (rect.y + rect.h);
if(gap > 0)
{
val_ax.labels.extY *=((rect.h - gap)/rect.h);
cat_ax.labels.y = val_ax.labels.y + val_ax.labels.extY - ((arr_val[arr_val.length-1] - crosses_at)/interval)*val_ax.labels.extY;
}
var dist = val_ax.labels.extY/(val_ax.labels.arrLabels.length-1);
for(i = 0; i < val_ax.labels.arrLabels.length; ++i)
{
val_ax.labels.arrLabels[i].setPosition(val_ax.labels.x, val_ax.labels.y + dist*(val_ax.labels.arrLabels.length - i -1)
-val_ax.labels.arrLabels[i].tx.rich.content.Get_SummaryHeight()/2);
val_ax.yPoints[i].pos = val_ax.labels.y + dist*(val_ax.labels.arrLabels.length - i -1);
}
cat_ax.xPoints = [];
for(i = cat_ax.labels.arrLabels.length - 1; i > -1 ; --i)
{
var max_width = cat_ax.labels.arrLabels[i].tx.rich.content.Recalculate_MinMaxContentWidth().Max;
cat_ax.labels.arrLabels[i].tx.rich.content.Reset(0, 0, max_width, 20000);
cat_ax.labels.arrLabels[i].tx.rich.content.Recalculate_Page(0, true);
var x1 = rect.x + rect.w - (cat_ax.labels.arrLabels.length - 1 - i)*point_width - gap_hor_axis/Math.sqrt(2)- point_width/2;
var y1 = cat_ax.labels.y + gap_hor_axis/Math.sqrt(2);
var xc = x1 - max_width/(2*Math.sqrt(2));
var yc = y1 - max_width/(2*Math.sqrt(2));
var t = cat_ax.labels.arrLabels[i].transformText;
t.Reset();
global_MatrixTransformer.TranslateAppend(t, -max_width/2, 0);
global_MatrixTransformer.RotateRadAppend(t, Math.PI/4);
global_MatrixTransformer.TranslateAppend(t, xc, yc + max_width/2);
global_MatrixTransformer.MultiplyAppend(t, this.getTransformMatrix());
cat_ax.xPoints.push({pos:rect.x + rect.w - (cat_ax.labels.arrLabels.length - 1 - i)*point_width - point_width/2, val: i});
}
}
val_ax.posX = val_ax.labels.x + val_ax.labels.extX;
cat_ax.posY = cat_ax.labels.y;
cat_ax.xPoints.sort(function(a, b){return a.val - b.val});
val_ax.yPoints.sort(function(a, b){return a.val - b.val});
}
}
else if(chart_type !== historyitem_type_BarChart && (chart_type !== historyitem_type_PieChart && chart_type !== historyitem_type_DoughnutChart)
|| (chart_type === historyitem_type_BarChart && chart_object.barDir === BAR_DIR_COL))
{
......
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