Commit 93758bdf 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@54898 954022d7-b5bf-4e40-9824-e11837661b57
parent 517fb5d5
......@@ -1749,6 +1749,195 @@ DrawingObjectsController.prototype =
checkDataLabels(chart_type).setSeparator(chartSettings.separator);
}
if(chart_type.getAxisByTypes )
{
axis_by_types = chart_type.getAxisByTypes();
if(axis_by_types.catAx.length > 0 && axis_by_types.valAx.length > 0)
{
cat_ax = axis_by_types.catAx[0];
val_ax = axis_by_types.valAx[0];
}
var scaling;
var vert_axis_props = chartSettings.getVertAxisProps();
if(vert_axis_props)
{
if(!val_ax.scaling)
val_ax.setScaling(new CScaling());
scaling = val_ax.scaling;
if(isRealNumber(vert_axis_props.minValRule))
{
if(vert_axis_props.minValRule === c_oAscValAxisRule.auto)
{
if(isRealNumber(scaling.min))
scaling.setMin(null);
}
else
{
if(isRealNumber(vert_axis_props.minVal))
scaling.setMin(vert_axis_props.minVal);
}
}
if(isRealNumber(vert_axis_props.maxValRule))
{
if(vert_axis_props.maxValRule === c_oAscValAxisRule.auto)
{
if(isRealNumber(scaling.max))
scaling.setMax(null);
}
else
{
if(isRealNumber(vert_axis_props.maxVal))
scaling.setMax(vert_axis_props.maxVal);
}
}
if(isRealBool(vert_axis_props.invertValOrder))
scaling.setOrientation(vert_axis_props.invertValOrder ? ORIENTATION_MAX_MIN : ORIENTATION_MIN_MAX);
if(isRealBool(vert_axis_props.logScale) && isRealNumber(vert_axis_props.logBase) && vert_axis_props.logBase > 0)
scaling.setLogBase(vert_axis_props.logBase);
if(isRealNumber(vert_axis_props.units))
{
if(vert_axis_props.units === c_oAscValAxUnits.none)
{
if(val_ax.dispUnits)
val_ax.setDispUnits(null);
}
else if(isRealNumber(MENU_SETTINGS_MAP[vert_axis_props.units]))
{
if(!val_ax.dispUnits)
val_ax.setDispUnits(new CDispUnits());
val_ax.dispUnits.setBuiltInUnit(MENU_SETTINGS_MAP[vert_axis_props.units]);
if(isRealBool(val_ax.showUnitsOnChart))
val_ax.dispUnits.setDispUnitsLbl(new CDLbl());
}
}
if(isRealNumber(vert_axis_props.majorTickMark) && isRealNumber(MENU_SETTINGS_TICK_MARK[vert_axis_props.majorTickMark]))
val_ax.setMajorTickMark(MENU_SETTINGS_TICK_MARK[vert_axis_props.majorTickMark]);
if(isRealNumber(vert_axis_props.minorTickMark) && isRealNumber(MENU_SETTINGS_TICK_MARK[vert_axis_props.minorTickMark]))
val_ax.setMinorTickMark(MENU_SETTINGS_TICK_MARK[vert_axis_props.minorTickMark]);
if(isRealNumber(vert_axis_props.tickLabelsPos) && isRealNumber(MENU_SETTINGS_LABELS_POS[vert_axis_props.tickLabelsPos]))
val_ax.setTickLblPos(MENU_SETTINGS_LABELS_POS[vert_axis_props.tickLabelsPos]);
if(isRealNumber(vert_axis_props.crossesRule) && isRealObject(val_ax.crossAx))
{
if(vert_axis_props.crossesRule === c_oAscCrossesRule.auto)
{
val_ax.crossAx.setCrossesAt(null)
val_ax.crossAx.setCrosses(CROSSES_AUTO_ZERO);
}
else if(vert_axis_props.crossesRule === c_oAscCrossesRule.value)
{
if(isRealNumber(vert_axis_props.crosses))
{
val_ax.crossAx.setCrossesAt(vert_axis_props.crosses)
val_ax.crossAx.setCrosses(null);
}
}
else if(vert_axis_props.crossesRule === c_oAscCrossesRule.maxValue)
{
val_ax.crossAx.setCrossesAt(null)
val_ax.crossAx.setCrosses(CROSSES_MAX);
}
}
var hor_axis_props = chartSettings.getHorAxisProps();
if(hor_axis_props)
{
var intervalBetweenTick = hor_axis_props.getIntervalBetweenTick();
var intervalBetweenLabelsRule = hor_axis_props.getIntervalBetweenLabelsRule();
var intervalBetweenLabels = hor_axis_props.getIntervalBetweenLabels();
var invertCatOrder = hor_axis_props.getInvertCatOrder();
var labelsAxisDistance = hor_axis_props.getLabelsAxisDistance();
var axisType = hor_axis_props.getAxisType();
var majorTickMark = hor_axis_props.getMajorTickMark();
var minorTickMark = hor_axis_props.getMinorTickMark();
var tickLabelsPos = hor_axis_props.getTickLabelsPos();
var crossesRule = hor_axis_props.getCrossesRule();
var crosses = hor_axis_props.getCrosses();
var labelsPosition = hor_axis_props.getLabelsPosition();
if(isRealNumber(intervalBetweenTick))
cat_ax.setTickMarkSkip(intervalBetweenTick);
if(isRealNumber(intervalBetweenLabelsRule))
{
if(intervalBetweenLabelsRule === c_oAscBetweenLabelsRule.auto)
{
if(isRealNumber(cat_ax.tickLblSkip))
{
cat_ax.setTickLblSkip(null);
}
}
else if(intervalBetweenLabelsRule === c_oAscBetweenLabelsRule.manual && isRealNumber(intervalBetweenLabels))
{
cat_ax.setTickLblSkip(intervalBetweenLabels);
}
}
if(!cat_ax.scaling)
cat_ax.setScaling(new CScaling());
scaling = cat_ax.scaling;
if(isRealBool(invertCatOrder))
scaling.setOrientation(invertCatOrder ? ORIENTATION_MAX_MIN : ORIENTATION_MIN_MAX);
if(isRealNumber(labelsAxisDistance))
cat_ax.setLblOffset(labelsAxisDistance);
if(isRealNumber(axisType))
{
//TODO
}
if(isRealNumber(majorTickMark) && isRealNumber(MENU_SETTINGS_TICK_MARK[majorTickMark]))
cat_ax.setMajorTickMark(MENU_SETTINGS_TICK_MARK[majorTickMark]);
if(isRealNumber(minorTickMark) && isRealNumber(MENU_SETTINGS_TICK_MARK[minorTickMark]))
cat_ax.setMinorTickMark(MENU_SETTINGS_TICK_MARK[minorTickMark]);
if(isRealNumber(tickLabelsPos) && isRealNumber(MENU_SETTINGS_LABELS_POS[tickLabelsPos]))
cat_ax.setTickLblPos(MENU_SETTINGS_LABELS_POS[tickLabelsPos]);
if(isRealNumber(crossesRule) && isRealObject(cat_ax.crossAx))
{
if(crossesRule === c_oAscCrossesRule.auto)
{
cat_ax.crossAx.setCrossesAt(null)
cat_ax.crossAx.setCrosses(CROSSES_AUTO_ZERO);
}
else if(crossesRule === c_oAscCrossesRule.value)
{
if(isRealNumber(crosses))
{
cat_ax.crossAx.setCrossesAt(crosses)
cat_ax.crossAx.setCrosses(null);
}
}
else if(crossesRule === c_oAscCrossesRule.maxValue)
{
cat_ax.crossAx.setCrossesAt(null)
cat_ax.crossAx.setCrosses(CROSSES_MAX);
}
}
if(isRealNumber(labelsPosition) && isRealObject(cat_ax.crossAx))
cat_ax.crossAx(labelsPosition === c_oAscLabelsPosition.byDivisions ? CROSS_BETWEEN_MID_CAT : CROSS_BETWEEN_BETWEEN)
}
}
}
chart_space.addToRecalculate(); //TODO
chart_space.setRecalculateInfo();//TODO: обязательно переделать
this.startRecalculate();
......
......@@ -6810,6 +6810,30 @@ UNIT_MULTIPLIERS[BUILT_IN_UNIT_TEN_MILLIONS] = 1.0/10000000.0;
UNIT_MULTIPLIERS[BUILT_IN_UNIT_TEN_THOUSANDS] = 1.0/10000.0;
UNIT_MULTIPLIERS[BUILT_IN_UNIT_TRILLIONS] = 1.0/1000000000000.0;
var MENU_SETTINGS_MAP = [];
MENU_SETTINGS_MAP[c_oAscValAxUnits.BILLIONS] = BUILT_IN_UNIT_BILLIONS;
MENU_SETTINGS_MAP[c_oAscValAxUnits.HUNDRED_MILLIONS] = BUILT_IN_UNIT_HUNDRED_MILLIONS;
MENU_SETTINGS_MAP[c_oAscValAxUnits.HUNDREDS] = BUILT_IN_UNIT_HUNDREDS;
MENU_SETTINGS_MAP[c_oAscValAxUnits.HUNDRED_THOUSANDS] = BUILT_IN_UNIT_HUNDRED_THOUSANDS;
MENU_SETTINGS_MAP[c_oAscValAxUnits.MILLIONS] = BUILT_IN_UNIT_MILLIONS;
MENU_SETTINGS_MAP[c_oAscValAxUnits.TEN_MILLIONS] = BUILT_IN_UNIT_TEN_MILLIONS;
MENU_SETTINGS_MAP[c_oAscValAxUnits.TEN_THOUSANDS] = BUILT_IN_UNIT_TEN_THOUSANDS;
MENU_SETTINGS_MAP[c_oAscValAxUnits.TRILLIONS] = BUILT_IN_UNIT_TRILLIONS;
var MENU_SETTINGS_TICK_MARK = []
MENU_SETTINGS_TICK_MARK[c_oAscTickMark.TICK_MARK_CROSS] = TICK_MARK_CROSS;
MENU_SETTINGS_TICK_MARK[c_oAscTickMark.TICK_MARK_IN ] = TICK_MARK_IN ;
MENU_SETTINGS_TICK_MARK[c_oAscTickMark.TICK_MARK_NONE ] = TICK_MARK_NONE ;
MENU_SETTINGS_TICK_MARK[c_oAscTickMark.TICK_MARK_OUT ] = TICK_MARK_OUT ;
var MENU_SETTINGS_LABELS_POS = [];
MENU_SETTINGS_LABELS_POS[c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH ] = TICK_LABEL_POSITION_HIGH ;
MENU_SETTINGS_LABELS_POS[c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW ] = TICK_LABEL_POSITION_LOW ;
MENU_SETTINGS_LABELS_POS[c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO] = TICK_LABEL_POSITION_NEXT_TO;
MENU_SETTINGS_LABELS_POS[c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE ] = TICK_LABEL_POSITION_NONE ;
function CDispUnits()
{
this.builtInUnit = null;
......
......@@ -588,23 +588,31 @@
prot["getCrossesRule"] = prot.getCrossesRule ;
prot["getCrosses"] = prot.getCrosses ;
window["asc_ValAxisSettings"] = asc_ValAxisSettings;
function asc_CatAxisSettings()
{
this.intervalBetweenTick = null;
this.intervalBetweenLabelsRule = null;
this.intervalBetweenLabels = null;
this.invertCatOrder = null;
this.labelsAxisDistance = null;
this.axisType = null;
this.majorTickMark = null;
this.minorTickMark = null;
this.tickLabelsPos = null;
this.crossesRule = null;
this.crosses = null;
this.labelsPosition = null;
}
asc_CatAxisSettings.prototype =
{
putIntervalBetweenTick: function(v)
{
this.intervalBetweenTick = v;
},
putIntervalBetweenLabelsRule: function(v)
{
this.intervalBetweenLabelsRule = v;
......@@ -642,6 +650,21 @@
this.crosses = v;
},
putAxisType: function(v)
{
this.axisType = v;
},
putLabelsPosition: function(v)
{
this.labelsPosition = v;
},
getIntervalBetweenTick: function(v)
{
return this.intervalBetweenTick;
},
getIntervalBetweenLabelsRule: function()
{
return this.intervalBetweenLabelsRule ;
......@@ -677,10 +700,21 @@
getCrosses: function()
{
return this.crosses;
},
getAxisType: function()
{
return this.axisType;
},
getLabelsPosition: function()
{
return this.labelsPosition;
}
};
prot = asc_CatAxisSettings.prototype;
prot["putIntervalBetweenTick"] = prot.putIntervalBetweenTick;
prot["putIntervalBetweenLabelsRule"] = prot.putIntervalBetweenLabelsRule;
prot["putIntervalBetweenLabels"] = prot.putIntervalBetweenLabels ;
prot["putInvertCatOrder"] = prot.putInvertCatOrder ;
......@@ -690,9 +724,11 @@
prot["putTickLabelsPos"] = prot.putTickLabelsPos;
prot["putCrossesRule"] = prot.putCrossesRule;
prot["putCrosses"] = prot.putCrosses;
prot["putAxisType"] = prot.putAxisType;
prot["putLabelsPosition"] = prot.putLabelsPosition;
prot["getIntervalBetweenTick"] = prot.getIntervalBetweenTick;
prot["getIntervalBetweenLabelsRule"] = prot.getIntervalBetweenLabelsRule;
prot["getIntervalBetweenLabels"] = prot.getIntervalBetweenLabels ;
prot["getInvertCatOrder"] = prot.getInvertCatOrder ;
......@@ -702,9 +738,11 @@
prot["getTickLabelsPos"] = prot.getTickLabelsPos ;
prot["getCrossesRule"] = prot.getCrossesRule ;
prot["getCrosses"] = prot.getCrosses ;
prot["getAxisType"] = prot.getAxisType ;
prot["getLabelsPosition"] = prot.getLabelsPosition;
window["asc_CatAxisSettings"] = asc_CatAxisSettings;
}
)(window);
......
......@@ -245,4 +245,10 @@ var c_oAscBetweenLabelsRule =
{
auto: 0,
manual: 1
};
var c_oAscLabelsPosition =
{
byDivisions: 0,
betweenDivisions: 1
};
\ No newline at end of file
......@@ -2491,7 +2491,7 @@ Format
<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="crossesAutoValAxInput"><br>
<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>
......@@ -2508,7 +2508,7 @@ Format
<br>
<label>interval between labels:</label>
<br>
<input type="radio" name="intervalBetweenLabels" value="auto" class="intervalBetweenLabelsCatAxInput" checked="checked"><label>auto</label>
<input type="radio" name="intervalBetweenLabels" value="auto" class="intervalBetweenLabelsCatAxInput" checked="checked" id="autoIntervalBetweenLabelsInputCat"><label>auto</label>
<br>
<input type="radio" name="intervalBetweenLabels" value="manual" class="intervalBetweenLabelsCatAxInput"><label>manual</label>
<input type="text" id="intervalBetweenLabelsInputCatAxManual" disabled="disabled">
......@@ -2519,9 +2519,9 @@ Format
<br>
<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>
<input type="radio" name="horAxisTypeInput" value="date"><label>date</label>
<input type="radio" class = "catAxisTypeInputAuto" name="horAxisTypeInput" value="auto" checked="checked"><label>auto</label>
<input type="radio" class = "catAxisTypeInputText" name="horAxisTypeInput" value="text"><label>text</label>
<input type="radio" class = "catAxisTypeInputDate" 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>
......@@ -2551,14 +2551,14 @@ Format
<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">
<label>auto</label><input type="radio" name="crossesCat" value="auto" checked="checked" id="crossesAutoCatAxInput"><br>
<label>value</label><input type="radio" name="crossesCat" value="value" id="crossesCatAxValInput"><input type="text" id="crossesCatInput" disabled="disabled"><br>
<label>max value</label><input type="radio" name="crossesCat" value="maxValue" id="crossesMaxAxCatInput">
<br>
<label>Axis Position</label><br>
<label>by divisions:</label><input type="checkbox" id="checkBoxByDivisionsInput">
<label>by divisions:</label><input type="radio" id="checkBoxByDivisionsInput" checked="checked">
<br>
<label>between divisions:</label><input type="checkbox" id="checkBoxBetweenDivisionsInput">
<label>between divisions:</label><input type="radio" id="checkBoxBetweenDivisionsInput">
<div style="width: inherit; height: 1px; background: rgb(127,157,185)"></div>
<button id="valApplyCatAxisProps">
Apply Props
......
......@@ -2741,9 +2741,6 @@
$("#chartPropsMenuDiv").draggable();
api.asc_registerCallback("asc_onSelectChart", function (chartSpace) {
$("#chartPropsMenuDiv").css("display", "");
$("#styleIndexInput").attr( "value", chartSpace.style + "");
......@@ -3096,5 +3093,59 @@
}
);
$("#valApplyCatAxisProps").click(
function()
{
var settings = new asc_ChartSettings();
var axis_settings = new asc_CatAxisSettings();
settings.putHorAxisProps(axis_settings);
axis_settings.putIntervalBetweenLabels(parseInt($("intervalBetweenTickInput").attr("value")));
if($("#autoIntervalBetweenLabelsInputCat").attr("checked"))
{
axis_settings.putIntervalBetweenLabelsRule(c_oAscBetweenLabelsRule.auto);
}
else
{
axis_settings.putIntervalBetweenLabelsRule(c_oAscBetweenLabelsRule.manual);
axis_settings.putIntervalBetweenLabels(parseInt($("#intervalBetweenLabelsInputCatAxManual").attr("value")));
}
if($("#invertCatOrderCheckBox").attr("checked"))
axis_settings.putInvertCatOrder(true);
else
axis_settings.putInvertCatOrder(false);
axis_settings.putLabelsAxisDistance(parseInt($("#labelsAxisInputDistanceInput").attr("value")));
if($("#catAxisTypeInputAuto").attr("checked"))
axis_settings.putAxisType(c_oAscHorAxisType.auto);
else if($("#catAxisTypeInputText").attr("checked"))
axis_settings.putAxisType(c_oAscHorAxisType.text);
else
axis_settings.putAxisType(c_oAscHorAxisType.date);
axis_settings.putMajorTickMark(c_oAscTickMark[$("#majorTickMarkSelectCatAx").attr("value")]);
axis_settings.putMinorTickMark(c_oAscTickMark[$("#minorTickMarkSelectCatAx").attr("value")]);
axis_settings.putTickLabelsPos(c_oAscTickLabelsPos[$("#tickLabelsSelectCatAx").attr("value")]);
if($("#crossesAutoCatAxInput").attr("checked"))
{
axis_settings.putCrossesRule(c_oAscCrossesRule.auto);
}
else if($("#crossesCatAxValInput").attr("checked"))
{
axis_settings.putCrossesRule(c_oAscCrossesRule.value);
axis_settings.putCrosses($("#crossesCatInput").attr("value"));
}
else
{
axis_settings.putCrossesRule(c_oAscCrossesRule.maxValue);
}
if($("#checkBoxByDivisionsInput").attr("checked"))
axis_settings.putLabelsPosition(c_oAscLabelsPosition.byDivisions);
else
axis_settings.putLabelsPosition(c_oAscLabelsPosition.betweenDivisions);
api.asc_editChartDrawingObject(settings);
}
);
});
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