Page 1 of 1
Pie Chart Size
Posted: Tue Aug 22, 2006 10:29 am
by 6931524
My Pie Chart gets smaller as the data qty increases, ie a pie with 2 values, one of 4 and one 3, this is correct size. Another pie with the same size but has 2 values one, 3000 and one of 6000 and the pie is very small. The chart size in both cases is Width="508px" Height="221px"
Posted: Tue Aug 22, 2006 12:11 pm
by narcis
Hi MikeTheLad,
This is because the legend strings are longer and this takes space from the rest of the chart area. You can solve this by making the legend not visible or forcing the ValueFormat having 3 fix decimal digits:
Code: Select all
pie1.Add(4);
pie1.Add(3);
pie1.ValueFormat = "#,##0.000";
pie2.Add(2000);
pie2.Add(3000);
Posted: Tue Aug 22, 2006 2:43 pm
by 6931524
Thanks, sorted this. On the legend I would like this to show a £ before the number is this possible?
Posted: Tue Aug 22, 2006 2:54 pm
by narcis
Hi MikeTheLad,
Yes, you can achieve that using the GetLegendText event adding the symbol to the legend text string.
Posted: Tue Aug 22, 2006 3:13 pm
by 6931524
Understand what you are saying, I have created the event as per tuturial 5 but when I build the project I get,
the type name 'GetLegendTextEventArgs' does not exist in the type 'Steema.TeeChart.TChart'
when I type Steema.TeeChart.TChart. in the event on the list of available command GetLegendText is not there.
Posted: Tue Aug 22, 2006 3:28 pm
by narcis
Hi MikeTheLad,
You can automatically create the even at TeeChart's event section in the property window or at run-time like this:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
candle1.FillSampleValues();
tChart1.GetLegendText += new Steema.TeeChart.GetLegendTextEventHandler(tChart1_GetLegendText);
}
void tChart1_GetLegendText(object sender, Steema.TeeChart.GetLegendTextEventArgs e)
{
e.Text = "£" + e.Text;
}
Posted: Wed Aug 23, 2006 9:55 am
by 6931524
Is it possible to position the legend at the bottom of the pie, rather than the right.
Posted: Wed Aug 23, 2006 10:09 am
by narcis
Hi MikeTheLad,
Yes, this is possible. You can do that using the chart editor at design-time or at run-time using:
Code: Select all
tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
Posted: Wed Aug 23, 2006 10:30 am
by 6931524
this has moved the legend to bottom, however the 2 lines of the legend are now side by side, whereas when on the right they we two lines on top of each other. Is it possible to have the two lines on top of each other on legend at the bottom.
Posted: Wed Aug 23, 2006 11:21 am
by narcis
Hi MikeTheLad,
Ok, then you can use legend's custom position:
Code: Select all
tChart1.Legend.CustomPosition = true;
tChart1.Legend.Top = tChart1.Height - 50;
tChart1.Legend.Left = tChart1.Width / 2;
tChart1.Panel.MarginBottom = 15;