void series_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; args.Style.DisplayText = true; args.Style.TextOrientation = ChartTextOrientation.Smart; args.Style.Text = "T" + this._Id.ToString(); this._Id++; series.Style.Font.Facename = "Segoe UI"; series.Style.Font.Size = 7; }
private void series_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; if (series != null) { args.Style.Symbol.Shape = ChartSymbolShape.Square; args.Style.Symbol.Size = new Size(2, 2); args.Style.Symbol.Color = Color.DarkGreen; } }
protected void ChartControlSeries_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; Random rand = new Random(); if (args.Index == 4) { args.Style.Symbol.Shape = (ChartSymbolShape)Enum.Parse(typeof(ChartSymbolShape), this.cmbSymbolStyle.SelectedItem.ToString(), true); args.Style.Symbol.Size = new Size((int)this.numericUpDown1.Value, (int)this.numericUpDown1.Value); args.Style.Symbol.Color = colorPickerButton1.SelectedColor; } }
/// <summary> /// Set tooltip format using preparestyle event in chart control. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> protected void ChartControlSeries_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { // Style formatting using a callback. You can apply the same settings directly on the series style on the // point styles. ChartSeries series = sender as ChartSeries; if (series != null) { args.Style.Text = string.Format("Value is {0}", series.Points[args.Index].YValues[0]); args.Style.ToolTip = "You are hovering over Day " + series.Points[args.Index].X.ToString(); args.Handled = true; } }
void series_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { // Compose the tooltip for each point: ChartSeries series = sender as ChartSeries; series.PointsToolTipFormat = "{2}"; if (args != null) { DateTime dd = (DateTime)model.GetXData(args.Index); double y = this.chartControl1.Series[0].Points[args.Index].YValues[0]; args.Style.ToolTip = "X= " + this.GetFormattedLabelText(dd) + ", Y= " + y.ToString("F01"); } args.Handled = true; }
void Form1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = this.chartControl1.Series[0]; if (series != null) { if (args.Index == 0) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0x1B, 0xA1, 0xE2)); } else if (args.Index == 1) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0xA0, 0x50, 0x00)); } else if (args.Index == 2) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0x33, 0x99, 0x33)); } else if (args.Index == 3) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39)); } else if (args.Index == 4) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0xD8, 0x00, 0x73)); } else if (args.Index == 5) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0xF0, 0x96, 0x09)); } else if (args.Index == 6) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8)); } else if (args.Index == 7) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0xA2, 0x00, 0xFF)); } else if (args.Index == 8) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0xE5, 0x14, 0x00)); } else if (args.Index == 9) { args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0x00, 0xAB, 0xA9)); } } }
/// <summary> /// Handler for the PrepareStyle event of ChartSeries. /// </summary> /// <param name="sender">The ChartSeries object that raises this event.</param> /// <param name="args">The event data. Can be modified to change series appearance.</param> void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; series.Style.Border.Color = Color.SlateGray; if (series != null) { color1 = new Color[] { Color.FromArgb(0xFF, 0x1B, 0xA1, 0xE2) }; color2 = new Color[] { Color.FromArgb(0xFF, 0xA0, 0x50, 0x00) }; color3 = new Color[] { Color.FromArgb(0xFF, 0x33, 0x99, 0x33) }; color4 = new Color[] { Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39) }; color5 = new Color[] { Color.FromArgb(0xFF, 0xD8, 0x00, 0x73) }; color6 = new Color[] { Color.FromArgb(0xFF, 0xF0, 0x96, 0x09) }; color7 = new Color[] { Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8) }; color8 = new Color[] { Color.FromArgb(0xFF, 0xA2, 0x00, 0xFF) }; if (args.Index == 0) { args.Style.Interior = new BrushInfo(GradientStyle.None, color3); this.chartControl1.Legend.Items[0].Interior = new BrushInfo(GradientStyle.None, color3); } else if (args.Index == 1) { args.Style.Interior = new BrushInfo(GradientStyle.None, color2); this.chartControl1.Legend.Items[1].Interior = new BrushInfo(GradientStyle.None, color2); } else if (args.Index == 2) { args.Style.Interior = new BrushInfo(GradientStyle.None, color5); this.chartControl1.Legend.Items[2].Interior = new BrushInfo(GradientStyle.None, color5); } else if (args.Index == 3) { args.Style.Interior = new BrushInfo(GradientStyle.None, color7); this.chartControl1.Legend.Items[3].Interior = new BrushInfo(GradientStyle.None, color7); } else if (args.Index == 4) { args.Style.Interior = new BrushInfo(GradientStyle.None, color4); this.chartControl1.Legend.Items[4].Interior = new BrushInfo(GradientStyle.None, color4); } else { args.Style.Interior = new BrushInfo(GradientStyle.None, color1); } } }
/// <summary> /// Set the Style based on Index /// </summary> void Form1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = this.chartControl1.Series[0]; if (series != null) { if (args.Index == 0) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 41, 158, 214)); } else if (args.Index == 1) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 206, 215, 41)); } else if (args.Index == 2) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 255, 186, 0)); } else if (args.Index == 3) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 247, 125, 16)); } else if (args.Index == 4) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 129, 115, 27)); } else if (args.Index == 5) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 255, 136, 23)); } else if (args.Index == 6) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 246, 100, 15)); } else if (args.Index == 7) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 188, 200, 6)); } else if (args.Index == 8) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 234, 90, 81)); } else if (args.Index == 9) { args.Style.Interior = new BrushInfo(Color.FromArgb(175, 191, 192, 98)); } } }
protected void ChartControlSeries_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { // Style formatting using a callback. You can apply the same settings directly on the series style on the // point styles. ChartSeries series = sender as ChartSeries; Random rand = new Random(); if (series != null) { if (rbSymbolSeries1.Checked) { args.Style.Symbol.Shape = (ChartSymbolShape)Enum.Parse(typeof(ChartSymbolShape), this.cmbSymbolStyle.SelectedItem.ToString(), true); args.Style.Symbol.Size = new Size(10, 10); } } }
/// <summary> /// Handler for the PrepareStyle event of ChartSeries. /// </summary> /// <param name="sender">The ChartSeries object that raises this event.</param> /// <param name="args">The event data. Can be modified to change series appearance.</param> protected void ChartControlSeries_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { // Style formatting using a callback. You can apply the same settings directly on the series style on the // point styles. ChartSeries series = sender as ChartSeries; if (series != null) { args.Style.DisplayText = true; args.Style.TextFormat = "{0}"; args.Style.TextOrientation = ChartTextOrientation.Up; args.Style.Symbol.Shape = ChartSymbolShape.Circle; args.Style.Symbol.Size = new Size(10, 10); args.Style.Symbol.Color = Color.White; args.Style.Symbol.Border.Color = Color.FromArgb(129, 115, 27); args.Style.Symbol.Border.Width = 2; } }
private void Form1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { var series = chartControl1.Series[0]; if (series == null) { return; } switch (args.Index) { case 0: args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0x1B, 0xA1, 0xE2)); break; case 1: args.Style.Interior = new BrushInfo(Color.FromArgb(0xFF, 0xA0, 0x50, 0x00)); break; } }
/// <summary> /// Paints the stock series with up and down colors. /// </summary> private void series_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; if (series != null) { //Up Series - Open value < Close value - Painted with Green. // Down Series - Open value > Close value - Painted with Red. if (args.Index >= 0) { if (series.Points[args.Index].YValues[3] > series.Points[args.Index].YValues[2]) { args.Style.Interior = new BrushInfo(GradientStyle.Horizontal, Color.Red, Color.Red); args.Style.Border.Color = Color.Red; } else { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(GradientStyle.Horizontal, Color.Green, Color.Green); args.Style.Border.Color = Color.Green; } } } }
void Form1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; if (series == null) { return; } ChartPoint taskPoint = this.chartControl1.Series[1].Points[args.Index]; ChartPoint completionPoint = this.chartControl1.Series[0].Points[args.Index]; DateTime completionStartDate = DateTime.FromOADate(completionPoint.YValues[0]); DateTime completionEndDate = DateTime.FromOADate(completionPoint.YValues[1]); DateTime taskStartDate = DateTime.FromOADate(taskPoint.YValues[0]); DateTime taskEndDate = DateTime.FromOADate(taskPoint.YValues[1]); double percentCompleted = ((double)(completionEndDate.Day - completionStartDate.Day) / (double)(taskEndDate.Day - taskStartDate.Day)) * 100; double percentRemaining = 100 - percentCompleted; args.Style.ToolTip = "Start date:" + taskStartDate.ToShortDateString() + "\nEnd date:" + taskEndDate.ToShortDateString() + "\nPercent Completed:" + Math.Round(percentCompleted, 2) + "%\nPercent Remaining: " + Math.Round(percentRemaining, 2) + "%"; args.Handled = true; }
void series_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { //Specifying different Colors for data points using Prepare style event ChartSeries series = sender as ChartSeries; if (series != null) { if (this.chartControl1.Series[0].Type.ToString() == "Line") { if (args.Index == 0) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Red); } else if (args.Index == 1) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Green); } else if (args.Index == 2) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Blue); } else if (args.Index == 3) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Yellow); } else if (args.Index == 4) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Violet); } else if (args.Index == 5) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.BlanchedAlmond); } else if (args.Index == 6) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Brown); } else if (args.Index == 7) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Aqua); } else if (args.Index == 8) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Red); } else if (args.Index == 9) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Green); } else if (args.Index == 10) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Blue); } else if (args.Index == 11) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Yellow); } else if (args.Index == 12) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Violet); } else if (args.Index == 13) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.BlanchedAlmond); } else if (args.Index == 14) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Brown); } else if (args.Index == 15) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Aqua); } else if (args.Index == 16) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Red); } else if (args.Index == 17) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Green); } else if (args.Index == 18) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Blue); } else if (args.Index == 19) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Yellow); } else if (args.Index == 20) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Violet); } else if (args.Index == 21) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.BlanchedAlmond); } else if (args.Index == 22) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Brown); } else if (args.Index == 23) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Aqua); } else if (args.Index == 24) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Red); } else if (args.Index == 25) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Green); } else if (args.Index == 26) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Blue); } else if (args.Index == 27) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Yellow); } else if (args.Index == 28) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Violet); } else if (args.Index == 29) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.BlanchedAlmond); } else if (args.Index == 30) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Brown); } else if (args.Index == 31) { args.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Red); } } } }
void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; args.Style.Text = series.Points[args.Index].YValues[0].ToString() + " MB"; }
/// <summary> /// Handler for the PrepareStyle event of ChartSeries. /// </summary> /// <param name="sender">The ChartSeries object that raises this event.</param> /// <param name="args">The event data. Can be modified to change series appearance.</param> void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; series.Style.Border.Color = Color.Transparent; series.ConfigItems.PieItem.PieType = ChartPieType.None; if (series != null) { color1 = new Color[] { Color.FromArgb(0xFF, 0x1B, 0xA1, 0xE2) }; color2 = new Color[] { Color.FromArgb(0xFF, 0xA0, 0x50, 0x00) }; color3 = new Color[] { Color.FromArgb(0xFF, 0x33, 0x99, 0x33) }; color4 = new Color[] { Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39) }; color5 = new Color[] { Color.FromArgb(0xFF, 0xD8, 0x00, 0x73) }; color6 = new Color[] { Color.FromArgb(0xFF, 0xF0, 0x96, 0x09) }; color7 = new Color[] { Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8) }; color8 = new Color[] { Color.FromArgb(0xFF, 0xA2, 0x00, 0xFF) }; if (args.Index == 0) { args.Style.Interior = new BrushInfo(GradientStyle.None, color1); this.chartControl1.Legend.Items[0].Interior = new BrushInfo(GradientStyle.None, color1); if (chartControl1.Series[0].Type != ChartSeriesType.Funnel && chartControl1.Series[0].Type != ChartSeriesType.Pyramid) { args.Style.TextColor = Color.White; } } else if (args.Index == 1) { args.Style.Interior = new BrushInfo(GradientStyle.None, color2); this.chartControl1.Legend.Items[1].Interior = new BrushInfo(GradientStyle.None, color2); if (chartControl1.Series[0].Type != ChartSeriesType.Funnel && chartControl1.Series[0].Type != ChartSeriesType.Pyramid) { args.Style.TextColor = Color.White; } } else if (args.Index == 2) { args.Style.Interior = new BrushInfo(GradientStyle.None, color6); this.chartControl1.Legend.Items[2].Interior = new BrushInfo(GradientStyle.None, color6); if (chartControl1.Series[0].Type != ChartSeriesType.Funnel && chartControl1.Series[0].Type != ChartSeriesType.Pyramid) { args.Style.TextColor = Color.White; } } else if (args.Index == 3) { args.Style.Interior = new BrushInfo(GradientStyle.None, color4); this.chartControl1.Legend.Items[3].Interior = new BrushInfo(GradientStyle.None, color4); if (chartControl1.Series[0].Type != ChartSeriesType.Funnel && chartControl1.Series[0].Type != ChartSeriesType.Pyramid) { args.Style.TextColor = Color.White; } } else if (args.Index == 4) { args.Style.Interior = new BrushInfo(GradientStyle.None, color5); this.chartControl1.Legend.Items[4].Interior = new BrushInfo(GradientStyle.None, color5); if (chartControl1.Series[0].Type != ChartSeriesType.Funnel && chartControl1.Series[0].Type != ChartSeriesType.Pyramid) { args.Style.TextColor = Color.White; } } else if (args.Index == 5) { args.Style.Interior = new BrushInfo(GradientStyle.None, color3); this.chartControl1.Legend.Items[5].Interior = new BrushInfo(GradientStyle.None, color3); if (chartControl1.Series[0].Type != ChartSeriesType.Funnel && chartControl1.Series[0].Type != ChartSeriesType.Pyramid) { args.Style.TextColor = Color.White; } } else if (args.Index == 6) { args.Style.Interior = new BrushInfo(GradientStyle.None, color7); this.chartControl1.Legend.Items[6].Interior = new BrushInfo(GradientStyle.None, color7); if (chartControl1.Series[0].Type != ChartSeriesType.Funnel && chartControl1.Series[0].Type != ChartSeriesType.Pyramid) { args.Style.TextColor = Color.White; } } else { args.Style.Interior = new BrushInfo(GradientStyle.None, color1); } } }