TeeChart.Net Zoom
Posted: Thu Sep 15, 2005 10:17 am
I'm experiencing problems using the tchart zoom feature.
In my chart, annotations describe the contents of the curves. The right border of an annotation is always 15 pixels to the left of a seperator line.
When i use the zoom feature, the annotations remain where they are, although I update the annotations in the "zoom"-event:
this.tChart.Zoomed += new System.EventHandler(this.tChart_Zoomed);
private void tChart_Zoomed(object sender, System.EventArgs e)
{
foreach (object o in tChart.Tools)
{
if (o.GetType() == typeof(Steema.TeeChart.Tools.Annotation))
{
((Steema.TeeChart.Tools.Annotation)o).Invalidate();
((Steema.TeeChart.Tools.Annotation)o).Shape.Invalidate();
((Steema.TeeChart.Tools.Annotation)o).Shape.Visible = false;
}
}
CalcLabelsPositions();
foreach (object o in tChart.Tools)
{
if (o.GetType() == typeof(Steema.TeeChart.Tools.Annotation))
{
//((Steema.TeeChart.Tools.Annotation)o).Invalidate();
//((Steema.TeeChart.Tools.Annotation)o).Shape.Invalidate();
((Steema.TeeChart.Tools.Annotation)o).Shape.Visible = true;
}
}
this.tChart.Invalidate(true);
this.tChart.Refresh();
}
private void CalcLabelsPositions()
{
try
{
Graphics g = this.CreateGraphics();
foreach (VisSeries ser in chartDesc.VisSeriesList.Values)
{
if (ser.MaterialLabels.Count == 0) continue;
foreach (SerLabel serLab in ser.MaterialLabels.Values)
{
int val = tChart.Axes.Bottom.CalcXPosValue(serLab.XPos) - 15
- Convert.ToInt32(Math.Round(
g.MeasureString(serLab.Label.Text, serLab.Label.Shape.Font.DrawingFont).Width, 0));
serLab.Label.Shape.Left = val > 0 ? val : 0;
}
}
g.Dispose();
}
catch(Exception ex)
{
AC.chart2DTracer.E(ex.StackTrace, ex.Message);
}
}
Have you got any idea?
In my chart, annotations describe the contents of the curves. The right border of an annotation is always 15 pixels to the left of a seperator line.
When i use the zoom feature, the annotations remain where they are, although I update the annotations in the "zoom"-event:
this.tChart.Zoomed += new System.EventHandler(this.tChart_Zoomed);
private void tChart_Zoomed(object sender, System.EventArgs e)
{
foreach (object o in tChart.Tools)
{
if (o.GetType() == typeof(Steema.TeeChart.Tools.Annotation))
{
((Steema.TeeChart.Tools.Annotation)o).Invalidate();
((Steema.TeeChart.Tools.Annotation)o).Shape.Invalidate();
((Steema.TeeChart.Tools.Annotation)o).Shape.Visible = false;
}
}
CalcLabelsPositions();
foreach (object o in tChart.Tools)
{
if (o.GetType() == typeof(Steema.TeeChart.Tools.Annotation))
{
//((Steema.TeeChart.Tools.Annotation)o).Invalidate();
//((Steema.TeeChart.Tools.Annotation)o).Shape.Invalidate();
((Steema.TeeChart.Tools.Annotation)o).Shape.Visible = true;
}
}
this.tChart.Invalidate(true);
this.tChart.Refresh();
}
private void CalcLabelsPositions()
{
try
{
Graphics g = this.CreateGraphics();
foreach (VisSeries ser in chartDesc.VisSeriesList.Values)
{
if (ser.MaterialLabels.Count == 0) continue;
foreach (SerLabel serLab in ser.MaterialLabels.Values)
{
int val = tChart.Axes.Bottom.CalcXPosValue(serLab.XPos) - 15
- Convert.ToInt32(Math.Round(
g.MeasureString(serLab.Label.Text, serLab.Label.Shape.Font.DrawingFont).Width, 0));
serLab.Label.Shape.Left = val > 0 ? val : 0;
}
}
g.Dispose();
}
catch(Exception ex)
{
AC.chart2DTracer.E(ex.StackTrace, ex.Message);
}
}
Have you got any idea?