private void cbMethod_SelectedIndexChanged(object sender, System.EventArgs e) { C1.Win.C1Chart.PointStyle ps = c1Chart1.ChartGroups[0].ChartData.PointStylesList[0]; ps.Selection = (PointStyleSelectionEnum)cbMethod.SelectedItem; InitStyle(); if (ps.Selection == PointStyleSelectionEnum.Index) { udPointIndex.Enabled = true; } else { udPointIndex.Enabled = false; } if (ps.Selection == PointStyleSelectionEnum.Index || ps.Selection == PointStyleSelectionEnum.SeriesMaxX || ps.Selection == PointStyleSelectionEnum.SeriesMaxY || ps.Selection == PointStyleSelectionEnum.SeriesMinX || ps.Selection == PointStyleSelectionEnum.SeriesMinY) { udSeriesIndex.Enabled = true; } else { udSeriesIndex.Enabled = false; } }
void PointStyle_Select(object sender, C1.Win.C1Chart.PointStyleSelectEventArgs e) { double val = Convert.ToDouble(c1Chart1.ChartGroups[0].ChartData[e.SeriesIndex].Y[e.PointIndex]); double maxy = c1Chart1.ChartGroups[0].ChartData.MaxY; double miny = c1Chart1.ChartGroups[0].ChartData.MinY; ChartDataSeries ds = c1Chart1.ChartGroups[0].ChartData[e.SeriesIndex]; C1.Win.C1Chart.PointStyle ps = (C1.Win.C1Chart.PointStyle)sender; if (val > 0) { //Color clr = Color.FromArgb( (int)(255 * ( 1 - (maxy -val) / maxy)), Color.Red); Color clr = Color.FromArgb((int)(255 * (1 - (maxy - val) / maxy)), ds.LineStyle.Color); ps.LineStyle.Color = clr; ps.SymbolStyle.Color = clr; ps.SymbolStyle.OutlineColor = Color.Red; } else { val = Math.Abs(val); miny = Math.Abs(miny); //Color clr = Color.FromArgb( (int)(255 * ( 1 - (miny -val) / miny)), Color.Blue); Color clr = Color.FromArgb((int)(255 * (1 - (miny - val) / miny)), ds.LineStyle.Color); ps.LineStyle.Color = clr; ps.SymbolStyle.Color = clr; ps.SymbolStyle.OutlineColor = Color.Blue; } e.Selected = true; }
private void InitStyle() { C1.Win.C1Chart.PointStyle ps = c1Chart1.ChartGroups[0].ChartData.PointStylesList[0]; ps.LineStyle.Color = Color.Red; ps.SymbolStyle.Color = Color.LightYellow; ps.SymbolStyle.Size = 15; ps.SymbolStyle.OutlineColor = Color.Red; ps.SymbolStyle.OutlineWidth = 2; ps.SymbolStyle.Shape = SymbolShapeEnum.Diamond; }
private void Form1_Load(object sender, System.EventArgs e) { // show grid c1Chart1.ChartArea.AxisX.GridMajor.Visible = true; c1Chart1.ChartArea.AxisY.GridMajor.Visible = true; C1.Win.C1Chart.PointStyle ps = c1Chart1.ChartGroups[0].ChartData.PointStylesList.AddNewPointStyle(); InitStyle(); ps.Select += new C1.Win.C1Chart.PointStyleSelectEventHandler(PointStyle_Select); GenerateData(); InitComboFromEnum(cbMethod, typeof(PointStyleSelectionEnum)); cbChartType.SelectedIndex = 0; udPointIndex.Maximum = np - 1; }
private void udSeriesIndex_ValueChanged(object sender, System.EventArgs e) { C1.Win.C1Chart.PointStyle ps = c1Chart1.ChartGroups[0].ChartData.PointStylesList[0]; ps.SeriesIndex = (int)udSeriesIndex.Value; }