We would like to know if there is a way to know if the chart has been resized to a point where the chart cannot be displayed correctly.
As an example this might be a chart where the user can see all of the bars:
But the user resizes the chart until the chart cannot be displayed:
Or even worse until things start overlapping:
So is there any way to know if the chart and legend are overlapping or if the chart cannot be drawn any smaller?
A way to know if the chart is too small to display correctly
-
- Newbie
- Posts: 93
- Joined: Thu Apr 17, 2008 12:00 am
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: A way to know if the chart is too small to display correctly
Hello,
Yes, you should be able to use the GetAxesChartRect event, e.g.
This will limit the width and advise of the same, and the same technique could be used for other ways to control Chart rendering.
Yes, you should be able to use the GetAxesChartRect event, e.g.
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = true;
tChart1.Aspect.Orthogonal = false;
tChart1.Aspect.Chart3DPercent = 40;
tChart1.Series.Add(typeof(Tower)).FillSampleValues();
tChart1.GetAxesChartRect += TChart1_GetAxesChartRect;
}
private void TChart1_GetAxesChartRect(object sender, GetAxesChartRectEventArgs e)
{
Rectangle rect = e.AxesChartRect;
if(rect.Width < 50)
{
MessageBox.Show("Less than 50");
rect.Width = 50;
e.AxesChartRect = rect;
}
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 93
- Joined: Thu Apr 17, 2008 12:00 am
Re: A way to know if the chart is too small to display correctly
Hello:
We are using the latest version of the product -- we will try out your suggestion and get back to you if we have issues.
As a related follow up question: Is there a way to tell if the legend doesn't fit? If we could detect that we could add the "legend scroll bar tool" automatically, unless there's a way to tell you to do that for us?
Thanks
We are using the latest version of the product -- we will try out your suggestion and get back to you if we have issues.
As a related follow up question: Is there a way to tell if the legend doesn't fit? If we could detect that we could add the "legend scroll bar tool" automatically, unless there's a way to tell you to do that for us?
Thanks
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: A way to know if the chart is too small to display correctly
Hello,
Yes, you could use code similar to this:biqpaulson wrote: As a related follow up question: Is there a way to tell if the legend doesn't fit? If we could detect that we could add the "legend scroll bar tool" automatically, unless there's a way to tell you to do that for us?
Code: Select all
private void InitializeChart()
{
Line series = new Line(tChart1.Chart);
series.FillSampleValues(40);
tChart1.BeforeDraw += TChart1_BeforeDraw;
}
LegendScrollBar scrollBar = new LegendScrollBar();
private void TChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
ChartFont oldFont = g.Font;
g.Font = tChart1.Legend.Font;
int height = g.FontHeight;
g.Font = oldFont;
height += tChart1.Legend.VertSpacing;
height *= tChart1[0].Count;
if(tChart1.Chart.ChartBounds.Height < height)
{
scrollBar.Chart = g.Chart;
}
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |