Add an arrow and a label to a radar chart
Hi, I would like to know if it is possible to add an arrow with its origin at the origin of the radar chart, and end-point at the edge of the Circle axis style, at a given angle, and attach a label to it (end point of the arrow) - Thanks in advance! - Nicolas
SIGN IN To post a reply.
9 Replies
NI
Nicolas
October 13, 2016 04:12 AM UTC
Got the arrow fixed using Drawline and FillPolygon methods, if you have a better way, let me know! However, there are some questions left unanswered
- How to place a custom label at a given pointF on the chart;
- How to place a custom label on each point of a scatter diagram;
Thanks in advance! - Nicolas
DD
Dharanidharan Dharmasivam
Syncfusion Team
October 13, 2016 12:50 PM UTC
Hi Nicolas,
Thanks for using Syncfusion product.
We have analyzed your query and we have created sample with respect to your requirement. In this by using Callout feature you can add custom label. Find the code snippet below,
Code snippet:
|
Windows forms:
//...
series.Style.DisplayText = true;
series.Style.Callout.Enable = true;
series.Style.Callout.DisplayTextAndFormat = "custom text";
//...
|
In the sample we have added custom label to all the points in the series. If you want you can add custom label to specific point also and you can place it anywhere in the chart by click and drag on the custom label.
Screenshot:
For your reference we have attached the sample. Kindly find the sample from below location,
If this is not your scenario, kindly revert us.
Thanks,
Dharani.
NI
Nicolas
October 14, 2016 04:46 AM UTC
Hi Dharanidharan, the item 1 (How to place a custom label at a given pointF on the chart - this can be any chart like scatter or radar, ...) has been left unanswered, and I will clarify, I would like to add several different labels, and be able to control its font, orientation, etc.
As for the answer you gave for the item 2 (How to place a custom label on each point of a scatter diagram), this does not help as the label is the same for all points. I would like to be able to add a 3rd value dynamically, say the client name related to this data. If it is not possible in the current configuration, maybe I could use this labeling but I would need to generate new series in the iteration
Thank you! - Nicolas
NI
Nicolas
October 14, 2016 04:55 PM UTC
Please consider Item 2 as closed, I used iteration which worked out, leaving Item 1 - Thanks! - Nicolas
DD
Dharanidharan Dharmasivam
Syncfusion Team
October 17, 2016 08:29 AM UTC
Hi Nicolas,
Thanks for your update and sorry for the inconvenience caused.
We have prepared sample with respect to your requirement. You can add custom labels at specific point using CustomPoint feature. Kindly find the code snippet below,
Code snippet:
|
Windows forms:
//...
ChartCustomPoint cp1 = new ChartCustomPoint();
//specify the required text
cp1.Text = "CustomText1";
//specify custom point type as chart coordinates to place the custom text at any location in the chart
cp1.CustomType = ChartCustomPointType.ChartCoordinates;
//specify the coordinates to place the custom label in chart
cp1.XValue = 100;
cp1.YValue = 58;
//customize the custom label
cp1.Color = Color.Red;
cp1.Font.Size = 13;
cp1.Font.FontStyle = FontStyle.Italic;
this.chart.CustomPoints.Add(cp1);
//...
|
Screenshot:
For your reference we have attached the sample, Kindly find the attachment from below link,
Thanks,
Dharani.
NI
Nicolas
October 17, 2016 10:01 PM UTC
Works like a charm! I was firstly a bit confused as I thought the coordinates in question were the ones for the control, but soon realized that these coordinate are those used in the chart and defined by the range. So this label works great for any label to be placed inside the chart. After some trial and errors, I noticed that the text will disappear when exceeding the chart edge, so here comes a sub-question - do you have an alternate way of placing a label for all regions of the control - thanks in advance! - Nicolas
DD
Dharanidharan Dharmasivam
Syncfusion Team
October 18, 2016 11:24 AM UTC
Hi Nicolas,
Thanks for your update.
The behavior of customPoint feature is to render the text within the chart area only. As a workaround, by using the paint event, you can place the text for all regions of the control. Kindly find the code snippet below,
Code Snippet:
|
private void Form1_Load(object sender, EventArgs e)
{
this.chart.Paint += Chart_Paint;
//...
}
private void Chart_Paint(object sender, PaintEventArgs e)
{
this.DrawString(e.Graphics, 10.0F, 80.0F);
}
public void DrawString(Graphics formGraphics, float x, float y)
{
string drawString = "Custom Text 1";
string drawString2 = "Custom Text 3";
System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat();
formGraphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
formGraphics.DrawString(drawString2, drawFont, drawBrush, x, y+160,drawFormat);
drawFont.Dispose();
drawBrush.Dispose();
} |
Screenshot:
For your reference we have attached the sample. Kindly find the sample from below location,
Thanks,
Dharani.
NI
Nicolas
October 18, 2016 04:50 PM UTC
That works great! Additionally, we can rotate the text at a given angle using formGraphics.RotateTransform, and place it using TranslateTransform, a bit of headache there, but still Thank you! - Nicolas
DD
Dharanidharan Dharmasivam
Syncfusion Team
October 19, 2016 12:35 PM UTC
Hi Nicolas,
Thanks for your update. Kindly revert us, if you require further assistance on this.
Thanks,
Dharani.
SIGN IN To post a reply.
- 9 Replies
- 2 Participants
-
NI Nicolas
- Oct 12, 2016 06:35 PM UTC
- Oct 19, 2016 12:35 PM UTC