pie chart -> other slice -> legend
pie chart -> other slice -> legend
In general, I like the idea of having legend for the other slice, however, it appears at a very odd position. I'd like to have an option, where this "other" legend is part of the main legend, separated by a line or just indented from the main items or something along this line. Also, it would be nice to have an option to set it's title to the other slice's name.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
Yes, this is possible doing something like this:
Yes, this is possible doing something like this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
pie1.FillSampleValues();
pie1.OtherSlice.Style = Steema.TeeChart.Styles.PieOtherStyles.BelowPercent;
pie1.OtherSlice.Value = 10;
pie1.OtherSlice.Legend.Visible = true;
Bitmap bmp = tChart1.Bitmap;
pie1.OtherSlice.Legend.CustomPosition = true;
pie1.OtherSlice.Legend.Left = tChart1.Legend.Left;
pie1.OtherSlice.Legend.Top = tChart1.Legend.Bottom;
}
Best Regards,
Narcís Calvet / 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 |
That is great! But how my user will select this option, while setting up the graph? Remember, I am not the person, who is actually building the final graph. I just provide users with an easy interface to setup a TChart graph with characteristics, they select and data provided by our application based on their selections. So, somewhere on the screen they need to be able to select an option "put this other legend on the reasonable location". Currently, legend has a position property and it would be logical to have another option for it to "attach" it to the main legend.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
In that case you can implement AfterDraw event for your client's charts as shown here:
Anyway, I'll add your request to the wish-list to be considered for inclusion in future releases.
In that case you can implement AfterDraw event for your client's charts as shown here:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
pie1.FillSampleValues();
pie1.OtherSlice.Style = Steema.TeeChart.Styles.PieOtherStyles.BelowPercent;
pie1.OtherSlice.Value = 10;
pie1.OtherSlice.Legend.Visible = true;
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
Bitmap bmp = tChart1.Bitmap;
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
foreach (Steema.TeeChart.Styles.Series s in tChart1.Series)
{
if (s is Steema.TeeChart.Styles.Pie)
{
Steema.TeeChart.Styles.Pie p = s as Steema.TeeChart.Styles.Pie;
if (p.OtherSlice.Style != Steema.TeeChart.Styles.PieOtherStyles.None)
{
p.OtherSlice.Legend.CustomPosition = true;
p.OtherSlice.Legend.Left = tChart1.Legend.Left;
p.OtherSlice.Legend.Top = tChart1.Legend.Bottom;
}
}
}
}
Best Regards,
Narcís Calvet / 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 |