Commit 846d472f authored by Sergey Luzyanin's avatar Sergey Luzyanin

Оси спарклайнов

parent 919452a6
......@@ -427,16 +427,38 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
var val_ax_props = new asc_ValAxisSettings();
if(settings.type !== c_oAscChartTypeSettings.barStackedPer)
{
val_ax_props.putMinValRule(c_oAscValAxisRule.auto);
val_ax_props.putMaxValRule(c_oAscValAxisRule.auto);
}
else
{
val_ax_props.putMinValRule(c_oAscValAxisRule.fixed);
val_ax_props.putMinVal(-1);
val_ax_props.putMaxValRule(c_oAscValAxisRule.fixed);
val_ax_props.putMaxVal(1);
}
val_ax_props.putTickLabelsPos(c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE);
if(oSparklineGroup.rightToLeft)
{
val_ax_props.putInvertValOrder(true);
}
else
{
val_ax_props.putInvertValOrder(false);
}
val_ax_props.putDispUnitsRule(c_oAscValAxUnits.none);
val_ax_props.putMajorTickMark(c_oAscTickMark.TICK_MARK_NONE);
val_ax_props.putMinorTickMark(c_oAscTickMark.TICK_MARK_NONE);
val_ax_props.putCrossesRule(c_oAscCrossesRule.auto);
var cat_ax_props = new asc_CatAxisSettings();
cat_ax_props.putIntervalBetweenLabelsRule(c_oAscBetweenLabelsRule.auto);
cat_ax_props.putLabelsPosition(c_oAscLabelsPosition.betweenDivisions);
......@@ -2291,16 +2313,36 @@ function DrawingObjects() {
oSparklineGroup.updateCache(range);
}
};
_this.checkSparklineGroupMinMaxVal = function(oSparklineGroup)
{
var maxVal = null, minVal = null;
if(oSparklineGroup.type !== Asc.ESparklineType.Stacked &&
(Asc.SparklineAxisMinMax.Group === oSparklineGroup.minAxisType || Asc.SparklineAxisMinMax.Group === oSparklineGroup.maxAxisType))
{
for(var i = 0; i < oSparklineGroup.arrSparklines.length; ++i)
{
if (!oSparklineGroup.arrCachedSparklines[j]) {
var oSparklineView = new CSparklineView();
oSparklineView.initFromSparkline(oSparklineGroup.arrSparklines[j], oSparklineGroup, worksheet);
oSparklineGroup.addView(oSparklineView, j);
}
var aPoints = getPtsFromSeries(oSparklineView.chartSpace.chart.plotArea.charts[0].series[0]);
}
}
};
_this.drawSparkLineGroups = function(oDrawingContext, oSparklineGroups, range)
{
oDrawingContext.save();
var graphics = new CGraphics();
graphics.init(oDrawingContext.ctx, oDrawingContext.getWidth(0), oDrawingContext.getHeight(0),
oDrawingContext.getWidth(3)*nSparklineMultiplier, oDrawingContext.getHeight(3)*nSparklineMultiplier);
graphics.m_oFontManager = g_fontManager;
graphics.SaveGrState();
for(var i = 0; i < oSparklineGroups.arrSparklineGroup.length; ++i) {
var oSparklineGroup = oSparklineGroups.arrSparklineGroup[i];
for(var j = 0; j < oSparklineGroup.arrSparklines.length; ++j) {
if (!oSparklineGroup.arrCachedSparklines[j]) {
var oSparklineView = new CSparklineView();
......@@ -2312,8 +2354,9 @@ function DrawingObjects() {
}
oSparklineGroup.arrCachedSparklines[j].draw(graphics);
}
}
oDrawingContext.restore();
graphics.RestoreGrState();
};
_this.rebuildChartGraphicObjects = function(data)
......
......@@ -2317,19 +2317,7 @@ CChartSpace.prototype =
},
recalculateReferences: function()
{
var worksheet = this.worksheet;
//this.pointsMap = {};
if(!worksheet)
return;
if(this.recalcInfo.recalculateBBox)
{
this.recalculateBBox();
this.recalcInfo.recalculateBBox = false;
}
var checkValByNumRef = function(oThis, ser, val, bVertical)
checkValByNumRef: function(workbook, ser, val, bVertical)
{
if(val && val.numRef && typeof val.numRef.f === "string"/*(!val.numRef.numCache || val.numRef.numCache.pts.length === 0)*/)
{
......@@ -2367,7 +2355,7 @@ CChartSpace.prototype =
var parsed_ref = parserHelp.parse3DRef(arr_f[i]);
if(parsed_ref)
{
var source_worksheet = oThis.worksheet.workbook.getWorksheetByName(parsed_ref.sheet);
var source_worksheet = workbook.getWorksheetByName(parsed_ref.sheet);
if(source_worksheet)
{
worksheet_id = source_worksheet.getId() + "";
......@@ -2395,7 +2383,7 @@ CChartSpace.prototype =
pt.setFormatCode(cell.getNumFormatStr())
}
num_cache.addPt(pt);
//addPointToMap(oThis.pointsMap, source_worksheet, range.r1, j, pt);
}
}
pt_index++;
......@@ -2420,7 +2408,7 @@ CChartSpace.prototype =
pt.setFormatCode(cell.getNumFormatStr())
}
num_cache.addPt(pt);
//addPointToMap(oThis.pointsMap, source_worksheet, j, range.c1, pt);
}
}
pt_index++;
......@@ -2438,7 +2426,21 @@ CChartSpace.prototype =
ser.isHiddenForLegend = hidden;
}
}
};
},
recalculateReferences: function()
{
var worksheet = this.worksheet;
//this.pointsMap = {};
if(!worksheet)
return;
if(this.recalcInfo.recalculateBBox)
{
this.recalculateBBox();
this.recalcInfo.recalculateBBox = false;
}
var checkCatByNumRef = function(oThis, ser, cat, bVertical)
{
......@@ -2543,9 +2545,9 @@ CChartSpace.prototype =
{
ser = series[j];
//val
checkValByNumRef(this, ser, ser.val);
this.checkValByNumRef(this.worksheet.workbook, ser, ser.val);
//cat
checkValByNumRef(this, ser, ser.cat, bVert);
this.checkValByNumRef(this.worksheet.workbook, ser, ser.cat, bVert);
checkCatByNumRef(this, ser, ser.cat, bVert);
//tx
checkCatByNumRef(this, ser, ser.tx, isRealBool(bVert) ? !bVert : undefined);
......@@ -2566,8 +2568,8 @@ CChartSpace.prototype =
for(j = 0; j < series.length; ++j)
{
ser = series[j];
checkValByNumRef(this, ser, ser.xVal, bVert);
checkValByNumRef(this, ser, ser.yVal);
this.checkValByNumRef(this.worksheet.workbook, ser, ser.xVal, bVert);
this.checkValByNumRef(this.worksheet.workbook, ser, ser.yVal);
checkCatByNumRef(this, ser, ser.tx, isRealBool(bVert) ? !bVert : undefined);
if(ser.isHidden)
......
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