private void UpdateAxes(bool recalculateAll) { if (drawables_.Count != xAxisPositions_.Count || drawables_.Count != yAxisPositions_.Count) { throw new NPlotException("plots and axis position arrays our of sync"); } int position = 0; // if we're not recalculating axes using all iplots then set // position to last one in list. if (!recalculateAll) { position = drawables_.Count - 1; if (position < 0) { position = 0; } } if (recalculateAll) { xAxis1_ = null; yAxis1_ = null; xAxis2_ = null; yAxis2_ = null; } for (int i = position; i < drawables_.Count; ++i) { // only update axes if this drawable is an IPlot. if (!(drawables_[position] is IPlot)) { continue; } IPlot p = (IPlot)drawables_[position]; XAxisPosition xap = (XAxisPosition)xAxisPositions_[position]; YAxisPosition yap = (YAxisPosition)yAxisPositions_[position]; if (xap == XAxisPosition.Bottom) { if (xAxis1_ == null) { xAxis1_ = p.SuggestXAxis(); if (xAxis1_ != null) { xAxis1_.TicksAngle = -(float)Math.PI / 2.0f; } } else { xAxis1_.LUB(p.SuggestXAxis()); } if (xAxis1_ != null) { xAxis1_.MinPhysicalLargeTickStep = 50; if (AutoScaleAutoGeneratedAxes) { xAxis1_.AutoScaleText = true; xAxis1_.AutoScaleTicks = true; xAxis1_.TicksIndependentOfPhysicalExtent = true; } else { xAxis1_.AutoScaleText = false; xAxis1_.AutoScaleTicks = false; xAxis1_.TicksIndependentOfPhysicalExtent = false; } } } if (xap == XAxisPosition.Top) { if (xAxis2_ == null) { xAxis2_ = p.SuggestXAxis(); if (xAxis2_ != null) { xAxis2_.TicksAngle = (float)Math.PI / 2.0f; } } else { xAxis2_.LUB(p.SuggestXAxis()); } if (xAxis2_ != null) { xAxis2_.MinPhysicalLargeTickStep = 50; if (AutoScaleAutoGeneratedAxes) { xAxis2_.AutoScaleText = true; xAxis2_.AutoScaleTicks = true; xAxis2_.TicksIndependentOfPhysicalExtent = true; } else { xAxis2_.AutoScaleText = false; xAxis2_.AutoScaleTicks = false; xAxis2_.TicksIndependentOfPhysicalExtent = false; } } } if (yap == YAxisPosition.Left) { if (yAxis1_ == null) { yAxis1_ = p.SuggestYAxis(); if (yAxis1_ != null) { yAxis1_.TicksAngle = (float)Math.PI / 2.0f; } } else { yAxis1_.LUB(p.SuggestYAxis()); } if (yAxis1_ != null) { if (AutoScaleAutoGeneratedAxes) { yAxis1_.AutoScaleText = true; yAxis1_.AutoScaleTicks = true; yAxis1_.TicksIndependentOfPhysicalExtent = true; } else { yAxis1_.AutoScaleText = false; yAxis1_.AutoScaleTicks = false; yAxis1_.TicksIndependentOfPhysicalExtent = false; } } } if (yap == YAxisPosition.Right) { if (yAxis2_ == null) { yAxis2_ = p.SuggestYAxis(); if (yAxis2_ != null) { yAxis2_.TicksAngle = -(float)Math.PI / 2.0f; } } else { yAxis2_.LUB(p.SuggestYAxis()); } if (yAxis2_ != null) { if (AutoScaleAutoGeneratedAxes) { yAxis2_.AutoScaleText = true; yAxis2_.AutoScaleTicks = true; yAxis2_.TicksIndependentOfPhysicalExtent = true; } else { yAxis2_.AutoScaleText = false; yAxis2_.AutoScaleTicks = false; yAxis2_.TicksIndependentOfPhysicalExtent = false; } } } } }
private void UpdateAxes() { // make sure our lists exist if (plots_.Count == 0 || xAxisPositions_.Count == 0 || yAxisPositions_.Count == 0) { throw new System.Exception("UpdateAxes called from function other than Add."); } int last = plots_.Count - 1; if (last != xAxisPositions_.Count - 1 || last != yAxisPositions_.Count - 1) { throw new System.Exception("plots and axis position arrays our of sync"); } IPlot p = (IPlot)plots_[last]; XAxisPosition xap = (XAxisPosition)xAxisPositions_[last]; YAxisPosition yap = (YAxisPosition)yAxisPositions_[last]; if (xap == XAxisPosition.Bottom) { if (xAxis1_ == null) { xAxis1_ = p.SuggestXAxis(); xAxis1_.TicksAngle = -Math.PI / 2.0f; } else { xAxis1_.LUB(p.SuggestXAxis()); } } if (xap == XAxisPosition.Top) { if (xAxis2_ == null) { xAxis2_ = p.SuggestXAxis(); xAxis2_.TicksAngle = Math.PI / 2.0f; } else { xAxis2_.LUB(p.SuggestXAxis()); } } if (yap == YAxisPosition.Left) { if (yAxis1_ == null) { yAxis1_ = p.SuggestYAxis(); yAxis1_.TicksAngle = Math.PI / 2.0f; } else { yAxis1_.LUB(p.SuggestYAxis()); } } if (yap == YAxisPosition.Right) { if (yAxis2_ == null) { yAxis2_ = p.SuggestYAxis(); yAxis2_.TicksAngle = -Math.PI / 2.0f; } else { yAxis2_.LUB(p.SuggestYAxis()); } } }
private void UpdateAxes(bool recalculateAll) { int position = 0; // if we're not recalculating axes using all iplots then set // position to last one in list. if (!recalculateAll) { position = m_drawables.Count - 1; if (position < 0) { position = 0; } } if (recalculateAll) { m_xAxis1 = null; m_yAxis1 = null; m_xAxis2 = null; m_yAxis2 = null; } for (int i = position; i < m_drawables.Count; ++i) { // only update axes if this drawable is an IPlot. if (!(m_drawables[i] is IPlot)) { continue; } IPlot p = (IPlot)m_drawables[i]; if (m_xAxis1 == null) { m_xAxis1 = p.SuggestXAxis(); if (m_xAxis1 != null) { m_xAxis1.TicksAngle = -(float)Math.PI / 2.0f; } } else { m_xAxis1.LUB(p.SuggestXAxis()); } if (m_xAxis1 != null) { m_xAxis1.MinPhysicalLargeTickStep = 50; if (AutoScaleAutoGeneratedAxes) { m_xAxis1.AutoScaleText = true; m_xAxis1.AutoScaleTicks = true; m_xAxis1.TicksIndependentOfPhysicalExtent = true; } else { m_xAxis1.AutoScaleText = false; m_xAxis1.AutoScaleTicks = false; m_xAxis1.TicksIndependentOfPhysicalExtent = false; } } if (m_yAxis1 == null) { m_yAxis1 = p.SuggestYAxis(); if (m_yAxis1 != null) { m_yAxis1.TicksAngle = (float)Math.PI / 2.0f; } } else { m_yAxis1.LUB(p.SuggestYAxis()); } if (m_yAxis1 != null) { if (AutoScaleAutoGeneratedAxes) { m_yAxis1.AutoScaleText = true; m_yAxis1.AutoScaleTicks = true; m_yAxis1.TicksIndependentOfPhysicalExtent = true; } else { m_yAxis1.AutoScaleText = false; m_yAxis1.AutoScaleTicks = false; m_yAxis1.TicksIndependentOfPhysicalExtent = false; } } } }