Hi,
I have a problem where the pie has too much space between its' start (on the left) and the actual border of the panel (I've added an image to demonstrate).
Could you please advice me on how to control that space or eliminate it all together.
Thank you,
Jonathan
Extra white space in pie
Extra white space in pie
- Attachments
-
- Pie chart.jpg (24.83 KiB) Viewed 4174 times
Re: Extra white space in pie
Hello gcrnd,
I found a simple code that I think you could use in your application to control space there are between pie and margins. Please, check next code works as you want:
I hope will helps.
Thanks,
I found a simple code that I think you could use in your application to control space there are between pie and margins. Please, check next code works as you want:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Pie pie1;
private void InitializeChart()
{
//tChart1.Legend.Visible = false;
pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
pie1.FillSampleValues(4);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Rectangle rect = tChart1.Chart.ChartRect;
int w = tChart1.Legend.Visible ? tChart1.Legend.Left - rect.Left : rect.Width;
pie1.CustomXRadius = (w / 2) - getWidestMark(pie1);
pie1.CustomYRadius = rect.Height / 2;
}
private int getWidestMark(Steema.TeeChart.Styles.Series s)
{
int tmp = 0;
if (s.Marks.Visible)
{
for (int i = 0; i < s.Marks.Positions.Count; i++)
{
tmp = Math.Max(tmp,s.Marks.Positions[i].Width);
}
}
return tmp;
}
Thanks,
Best Regards,
Sandra Pazos / 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 |