Hello,
is it possible to have a Polar series with a background image just in the polar circle? I couldn't find any property to set this. It seems that a background image is only available for the whole TeeChart and not just the Polar series.
Am I missing something or is this a bug?
I'm using TeeChart for .NET 2009 (version 4.0.2009.42283).
Thanks in advance,
SurveyBob
Background image in Polar
Re: Background image in Polar
I found a workaround now and draw the image on my own.
In the constructor of the Form, I subscribe to the BeforeDrawValues event of the Polar and in the event handler I draw the image to a clipped region defined by the bounding rectangle of the Polar circle:
Now two problems arise:
1. When the Form is opened for the first time, the image doesn't appear yet. Only if during runtime points are added/changed or if the Form is resized, the image gets drawn.
I already tried overriding OnHandleCreated(), OnLoad(), OnResize(), etc. of Form and from that draw the image, but the problem then is that m_Polar.CircleRect is still empty, so I don't know the position/size of the polar circle.
2. When the Form is resized very quickly, the image is drawn with an offset. See the screenshot:
Do you have any ideas?
Thanks in advance,
SurveyBob
In the constructor of the Form, I subscribe to the BeforeDrawValues event of the Polar and in the event handler I draw the image to a clipped region defined by the bounding rectangle of the Polar circle:
Code: Select all
public Form1()
{
// ...
m_Polar.BeforeDrawValues += new Steema.TeeChart.PaintChartEventHandler( m_Polar_BeforeDrawValues );
// ...
// Some points are added to m_Polar...
}
private void m_Polar_BeforeDrawValues( object sender, Steema.TeeChart.Drawing.Graphics3D g )
{
Image image = Image.FromFile( @"C:\Windows\Web\Wallpaper\img25.jpg" );
g.ClipEllipse( m_Polar.CircleRect );
g.Draw( m_Polar.CircleRect, image, false );
g.ClearClipRegions();
}
1. When the Form is opened for the first time, the image doesn't appear yet. Only if during runtime points are added/changed or if the Form is resized, the image gets drawn.
I already tried overriding OnHandleCreated(), OnLoad(), OnResize(), etc. of Form and from that draw the image, but the problem then is that m_Polar.CircleRect is still empty, so I don't know the position/size of the polar circle.
2. When the Form is resized very quickly, the image is drawn with an offset. See the screenshot:
Do you have any ideas?
Thanks in advance,
SurveyBob
Re: Background image in Polar
Hi SurveyBob,
I think that using Chart's BeforeDraw event would solve it:SurveyBob wrote:1. When the Form is opened for the first time, the image doesn't appear yet. Only if during runtime points are added/changed or if the Form is resized, the image gets drawn.
I already tried overriding OnHandleCreated(), OnLoad(), OnResize(), etc. of Form and from that draw the image, but the problem then is that m_Polar.CircleRect is still empty, so I don't know the position/size of the polar circle.
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Polar polar1 = new Steema.TeeChart.Styles.Polar(tChart1.Chart);
polar1.Circled = true;
polar1.FillSampleValues();
tChart1.BeforeDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_BeforeDraw);
tChart1.Draw();
}
void tChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Image image = Image.FromFile( @"C:\tmp\Yellow_solid_sphere.png" );
g.ClipEllipse((tChart1[0] as Steema.TeeChart.Styles.Polar).CircleRect);
g.Draw((tChart1[0] as Steema.TeeChart.Styles.Polar).CircleRect, image, false);
g.ClearClipRegions();
}
Forcing a chart repaint solves it but, of course, it will be a little bit slower.SurveyBob wrote:2. When the Form is resized very quickly, the image is drawn with an offset. See the screenshot:
Code: Select all
tChart1.Resize += new EventHandler(tChart1_Resize); // in InitializeChart
void tChart1_Resize(object sender, EventArgs e)
{
tChart1.Draw();
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Background image in Polar
Thanks, Yeray, that worked.
The redrawing really slows down resizing of the control pretty much, but for now, that's ok. At least it's drawn correct.
SurveyBob
The redrawing really slows down resizing of the control pretty much, but for now, that's ok. At least it's drawn correct.
SurveyBob