Posted 20 October 2022, 3:16 am EST
- Updated 20 October 2022, 6:38 am EST
Hi,
Thanks for the snapshot.
- To achieve this requirement you can draw annotations on FlexChart as:
private void DrawAnnotation()
{
C1.Win.Chart.Annotation.AnnotationLayer annotationLayer = new C1.Win.Chart.Annotation.AnnotationLayer(flexChart);
C1.Win.Chart.Annotation.Rectangle rect = new C1.Win.Chart.Annotation.Rectangle() { Location = new PointF(130, 60) };
rect.Height = 70;
rect.Width = 180;
rect.Style.Fill = Brushes.White;
rect.Style.Stroke = Brushes.Blue;
rect.Content = "Initial production: Kg 15,8\n" +
"Peak yield: Kg 51,4\n" +
"Milk yearly production: Kg 12.050\n" +
"ECM yearly production: Kg 12.504";
annotationLayer.Annotations.Add(rect);
}
You can refer other Annotations from https://www.grapecity.com/componentone/docs/win/online-flexchart/annotation.html.
- We apologize to inform you that AlarmZone feature is not available in FlexChart. However, you can draw zones by handling FlexChart’s Rendering event as:
private void FlexChart_Rendering(object sender, RenderEventArgs e)
{
var chartMax = ((IAxis)flexChart.AxisY).GetMax();
var chartMin = ((IAxis)flexChart.AxisY).GetMin();
e.Engine.SetFill(Brushes.Orange);
e.Engine.SetStroke(Brushes.Black);
foreach(var zone in zones)
{
var x =flexChart.AxisX.Convert(zone.Min);
var y = flexChart.AxisY.Convert(((IAxis)flexChart.AxisY).GetMax());
var width = flexChart.AxisX.Convert(zone.Max) - flexChart.AxisX.Convert(zone.Min);
var height = Math.Abs(flexChart.AxisY.Convert(chartMax)- flexChart.AxisY.Convert(chartMin));
e.Engine.DrawRect(x,y,width,height);
}
}
Please refer the attached sample for the same: FlexChart_Label_AlarmZone.zip
Best Regards,
Nitin