Donut Chart Annotation
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Donut Chart Annotation
Hello,
Many thanks for the links to your code, however, it is not clear to me what your issue is here, or what you would like to achieve. Would you please be so kind as to explain what you would like to see on the Chart?
Many thanks for the links to your code, however, it is not clear to me what your issue is here, or what you would like to achieve. Would you please be so kind as to explain what you would like to see on the 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 |
Re: Donut Chart Annotation
I am sorry , I am not able to position "sample" in center of doughnut
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Donut Chart Annotation
Hello,
No problem, thank you - you can get this to work with:
No problem, thank you - you can get this to work with:
Code: Select all
Steema.TeeChart.Tools.Annotation tAnnot = new Annotation(chart);
tChart1.Tools.Add(tAnnot);
tAnnot.Text = "Sample";
tAnnot.Shape.Transparent = true;
tAnnot.Shape.Font.Size = 25;
tAnnot.Shape.CustomPosition = true;
tChart1.Draw();
tAnnot.Shape.Left = donut1.CircleXCenter - tAnnot.Bounds.Width / 2;
tAnnot.Shape.Top = donut1.CircleYCenter - tAnnot.Bounds.Height / 2;
return param;
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 |
Re: Donut Chart Annotation
Thanks this worked. Just want to let you know we are in process of buying .net version of software.
Thanks for your kind support.
Thanks for your kind support.
Re: Donut Chart Annotation
Is this possible to have Marks in different color based on some condition
- Attachments
-
- untitled.png (16.52 KiB) Viewed 20650 times
Re: Donut Chart Annotation
Hello,
This would be a way to achieve it:
series.ValueColor(e.ValueIndex) would give you the Point colour if you were to wish to check by that.
Regards,
Marc
This would be a way to achieve it:
Code: Select all
//add event
donut1.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(donut1_GetSeriesMark);
private void donut1_GetSeriesMark(Series series, GetSeriesMarkEventArgs e)
{
if (e.ValueIndex == 3) //add your criteria, here 4th point
series.Marks.Font.Color = Color.White;
else
series.Marks.Font.Color = Color.Black;
}
Regards,
Marc
Steema Support
Re: Donut Chart Annotation
Can you please help me to put marks in center in donut chart.
Source :https://github.com/dekajp/TeeChart-for- ... ms-samples
Source :https://github.com/dekajp/TeeChart-for- ... ms-samples
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Donut Chart Annotation
I think you should be able to use the technique for custom positioning of marks which you can see here.rpt wrote:Can you please help me to put marks in center in donut 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 |
Re: Donut Chart Annotation
Hello,
As an alternative approach, you can turn off Marks and plot them yourself to take more control. This code centres them.
Eg.
You could add more sophistication. If the slice is small you could reduce the Font size (eg. if ((dnt.Angles.StartAngle - dnt.Angles.EndAngle) < somevalue) .. make font smaller…)
Or change the colour of the mark if the slice is a dark colour or light, etc.
I hope that may be of help.
Regards,
Marc
As an alternative approach, you can turn off Marks and plot them yourself to take more control. This code centres them.
Eg.
Code: Select all
donut.Marks.Visible = false;
//use Chart’s AfterDraw event
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Steema.TeeChart.Styles.Donut dnt = (Steema.TeeChart.Styles.Donut)tChart1[0];
donut.Marks.Visible = false;
for (int i=0; i < dnt.Count; i++)
{
//use these integers for plot coords
int startxx;
int startyy;
int endxx;
int endyy;
//outside permiter halfway on each point
dnt.AngleToPos(dnt.Angles[i].MidAngle, dnt.XRadius, dnt.YRadius, out startxx, out startyy);
//get halfway as fraction, from donut hole to exterior
double halfwayloc = 1.0-(1.0 - (dnt.DonutPercent / 100.0)) / 2.0;
//get centre location for each Mark
dnt.AngleToPos(dnt.Angles[i].MidAngle, dnt.XRadius * halfwayloc, dnt.YRadius * halfwayloc, out endxx, out endyy);
//setup Font
g.Font.Size = 14;
g.Font.Name = "Microsoft Sans Serif";
//Get Mark text
string myText = dnt.ValueMarkText(i);
//output Text
g.TextOut(endxx - (int)(g.TextWidth(myText)/2), endyy - (g.FontHeight/2), dnt.ValueMarkText(i));
}
}
Or change the colour of the mark if the slice is a dark colour or light, etc.
I hope that may be of help.
Regards,
Marc
Steema Support
Re: Donut Chart Annotation
Perfect and Working. Thank you Marc.