BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
[C#]
ChartCustomPoint ccp = new ChartCustomPoint();
ccp.XValue = this.chartControl1.Series[0].Points[0].X - 0.23;
ccp.YValue = this.chartControl1.Series[0].Points[0].YValues[3];
ccp.CustomType = ChartCustomPointType.ChartCoordinates;
ccp.SeriesIndex = 0;
ccp.PointIndex = 0;
ccp.Border.Color = Color.Black;
ccp.Symbol.Color = Color.Yellow;
ccp.Symbol.Size = new System.Drawing.Size(15, 15);
ccp.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp);
ChartCustomPoint ccp1 = new ChartCustomPoint();
ccp1.XValue = this.chartControl1.Series[1].Points[0].X;
ccp1.YValue = this.chartControl1.Series[1].Points[0].YValues[6];
ccp1.CustomType = ChartCustomPointType.ChartCoordinates;
ccp1.SeriesIndex = 1;
ccp1.PointIndex = 0;
ccp1.Border.Color = Color.Black;
ccp1.Symbol.Color = Color.Yellow;
ccp1.Symbol.Size = new System.Drawing.Size(15, 15);
ccp1.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp1);
ChartCustomPoint ccp2 = new ChartCustomPoint();
ccp2.XValue = this.chartControl1.Series[2].Points[0].X + 0.23;
ccp2.YValue = this.chartControl1.Series[2].Points[0].YValues[3];
ccp2.CustomType = ChartCustomPointType.ChartCoordinates;
ccp2.SeriesIndex = 2;
ccp2.PointIndex = 0;
ccp2.Border.Color = Color.Black;
ccp2.Symbol.Color = Color.Yellow;
ccp2.Symbol.Size = new System.Drawing.Size(15, 15);
ccp2.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp2); |
[C#]
this.chartControl1.ColumnWidthMode = ChartColumnWidthMode.FixedWidthMode;
this.chartControl1.ColumnFixedWidth = 50;
this.chartControl1.ColumnDrawMode = ChartColumnDrawMode.ClusteredMode;
ChartCustomPoint ccp = new ChartCustomPoint();
ccp.XValue = this.chartControl1.Series[0].Points[0].X;
ccp.YValue = this.chartControl1.Series[0].Points[0].YValues[3];
ccp.CustomType = ChartCustomPointType.ChartCoordinates;
ccp.SeriesIndex = 0;
ccp.PointIndex = 0;
ccp.Border.Color = Color.Black;
ccp.Symbol.Color = Color.Yellow;
ccp.Symbol.Size = new System.Drawing.Size(15, 15);
ccp.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp);
ChartCustomPoint ccp1 = new ChartCustomPoint();
ccp1.XValue = this.chartControl1.Series[1].Points[0].X;
ccp1.YValue = this.chartControl1.Series[1].Points[0].YValues[6];
ccp1.CustomType = ChartCustomPointType.ChartCoordinates;
ccp1.SeriesIndex = 1;
ccp1.PointIndex = 0;
ccp1.Border.Color = Color.Black;
ccp1.Symbol.Color = Color.Yellow;
ccp1.Symbol.Size = new System.Drawing.Size(15, 15);
ccp1.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp1);
ChartCustomPoint ccp2 = new ChartCustomPoint();
ccp2.XValue = this.chartControl1.Series[2].Points[0].X;
ccp2.YValue = this.chartControl1.Series[2].Points[0].YValues[3];
ccp2.CustomType = ChartCustomPointType.ChartCoordinates;
ccp2.SeriesIndex = 2;
ccp2.PointIndex = 0;
ccp2.Border.Color = Color.Black;
ccp2.Symbol.Color = Color.Yellow;
ccp2.Symbol.Size = new System.Drawing.Size(15, 15);
ccp2.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp2);
ChartCustomPoint ccp3 = new ChartCustomPoint();
ccp3.XValue = this.chartControl1.Series[3].Points[0].X;
ccp3.YValue = this.chartControl1.Series[3].Points[0].YValues[6];
ccp3.CustomType = ChartCustomPointType.ChartCoordinates;
ccp3.SeriesIndex = 3;
ccp3.PointIndex = 0;
ccp3.Border.Color = Color.Black;
ccp3.Symbol.Color = Color.Yellow;
ccp3.Symbol.Size = new System.Drawing.Size(15, 15);
ccp3.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp3);
ChartCustomPoint ccp4 = new ChartCustomPoint();
ccp4.XValue = this.chartControl1.Series[4].Points[0].X;
ccp4.YValue = this.chartControl1.Series[4].Points[0].YValues[3];
ccp4.CustomType = ChartCustomPointType.ChartCoordinates;
ccp4.SeriesIndex = 4;
ccp4.PointIndex = 0;
ccp4.Border.Color = Color.Black;
ccp4.Symbol.Color = Color.Yellow;
ccp4.Symbol.Size = new System.Drawing.Size(15, 15);
ccp4.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp4);
|
[C#]
public partial class Form1 : MetroForm
{
private bool triggered = true;
private System.Drawing.RectangleF region1;
public Form1()
{
InitializeChartData();
}
protected void InitializeChartData()
{
this.chartControl1.PrimaryXAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.UserMode;
this.chartControl1.PrimaryXAxis.Labels.Clear();
chartControl1.PrimaryXAxis.Labels.Add(new ChartAxisLabel("Arun", 1));
chartControl1.PrimaryXAxis.Labels.Add(new ChartAxisLabel("Dinesh", 2));
chartControl1.PrimaryXAxis.Labels.Add(new ChartAxisLabel("Tania", 3));
ChartSeries BoxPlot = new ChartSeries("Year 1", ChartSeriesType.BoxAndWhisker);
BoxPlot.ConfigItems.BoxAndWhiskerItem.PercentileMode = true;
this.chartControl1.CalcRegions = true;
ChartSeries BoxPlot1 = new ChartSeries("Year 2", ChartSeriesType.BoxAndWhisker);
BoxPlot1.ConfigItems.BoxAndWhiskerItem.PercentileMode = true;
BoxPlot.Points.Add(1, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 10, 20); // Year 1 data for Arun
BoxPlot.Points.Add(2, 30, 40, 50, 60, 70, 80, 90, 100, 110, 100, 100, 10); // Year 1 data for Dinesh
BoxPlot.Points.Add(3, 35, 25, 22, 55, 68, 80, 95, 110, 110, 120, 100, 30); // Year 1 data for Tania
BoxPlot1.Points.Add(1, 10, 20, 30, 40, 50, 40, 30, 20, 10, 50, 20, 10); // Year 2 data for Arun
BoxPlot1.Points.Add(2, 10, 20, 30, 60, 20, 100, 80, 60, 74, 45, 65, 100); // Year 2 data for Dinesh
BoxPlot1.Points.Add(3, 2, 70, 130, 80, 20, 100, 80, 60, 174, 75, 65, 100); // Year 2 data for Tania
this.chartControl1.ChartImage += chartControl1_ChartImage;
this.chartControl1.Resize +=chartControl1_Resize;
this.chartControl1.Series.Add(BoxPlot);
this.chartControl1.Series.Add(BoxPlot1);
}
void chartControl1_ChartImage(object sender, ChartAreaImageEventArgs e)
{
if (triggered)
{
var count = 0;
for (var i = 0; i < this.chartControl1.ChartRegions.Count; i++)
{
if (this.chartControl1.ChartRegions[i].IsChartPoint)
{
region1 = this.chartControl1.ChartRegions[i].Region.GetBounds(Graphics.FromImage(e.BufferImage));
if (count % this.chartControl1.Series.Count == 0)
{
ChartCustomPoint ccp = new ChartCustomPoint();
ccp.CustomType = ChartCustomPointType.Pixel;
ccp.XValue = region1.X + region1.Width / 2;
ccp.YValue = region1.Y + region1.Height / 2;
ccp.Border.Color = Color.Black;
ccp.Symbol.Color = Color.Yellow;
ccp.Symbol.Size = new System.Drawing.Size(15, 15);
ccp.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp);
}
count++;
}
}
}
triggered = false;
this.chartControl1.Redraw(true);
}
void chartControl1_Resize(object sender, EventArgs e)
{
triggered = true;
this.chartControl1.CustomPoints.Clear();
this.chartControl1.Redraw(true);
}
|
[C#]
//...
if (count % this.chartControl1.Series.Count == 0)
{
int YValue = 50; // you can modify this with your y value
ChartCustomPoint ccp = new ChartCustomPoint();
ccp.CustomType = ChartCustomPointType.Pixel;
ccp.XValue = region1.X + region1.Width / 2; // setting x value as pixel
ChartPoint point = new ChartPoint(0, YValue);
ccp.YValue = this.chartControl1.ChartArea.GetPointByValue(point).Y; // converting y value as pixel
ccp.Border.Color = Color.Black;
ccp.Symbol.Color = Color.Yellow;
ccp.Symbol.Size = new System.Drawing.Size(15, 15);
ccp.Symbol.Shape = ChartSymbolShape.Circle;
this.chartControl1.CustomPoints.Add(ccp);
}
//... |
[C#]
//...
this.chartControl1.VisibleRangeChanging += chartControl1_VisibleRangeChanging;
//...
void chartControl1_VisibleRangeChanging(object sender, ChartAxisZoomingArgs args)
{
triggered = true;
this.chartControl1.CustomPoints.Clear();
this.chartControl1.Redraw(true);
} |