private void ChartPicture_BeforePaint(object sender, ChartPaintEventArgs e) { int num = 1; for (int i = 0; i < this.Series.Count; i++) { Series series = this.Series[i]; series.xValuesZerosChecked = false; series.xValuesZeros = false; IChartType chartType = e.CommonElements.ChartTypeRegistry.GetChartType(series.ChartTypeName); bool pointsApplyPaletteColors = chartType.ApplyPaletteColorsToPoints; if (series.Palette != 0) { pointsApplyPaletteColors = true; } this.PrepareData(this.Palette != 0 || this.PaletteCustomColors.Length > 0, pointsApplyPaletteColors, series.Name); if (series.tempMarkerStyleIsSet) { series.MarkerStyle = MarkerStyle.None; series.tempMarkerStyleIsSet = false; } if (chartType.GetLegendImageStyle(series) == LegendImageStyle.Marker && series.MarkerStyle == MarkerStyle.None) { series.MarkerStyle = (MarkerStyle)(num++); series.tempMarkerStyleIsSet = true; if (num > 9) { num = 1; } } } }
public void SetAttributes(CommonElements common, Series series) { IChartType chartType = common.ChartTypeRegistry.GetChartType(series.ChartTypeName); this.style = chartType.GetLegendImageStyle(series); this.seriesName = series.Name; this.shadowOffset = series.ShadowOffset; this.shadowColor = series.ShadowColor; bool enable3D = common.Chart.ChartAreas[series.ChartArea].Area3DStyle.Enable3D; this.SetAttributes(series, enable3D); }
/// <summary> /// Event fired when chart picture is going to be painted. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void ChartPicture_BeforePaint(object sender, ChartPaintEventArgs e) { // Prepare series for drawing int markerIndex = 1; for (int index = 0; index < Series.Count; index++) { Series series = Series[index]; // Reset series "X values are zeros" flag series.xValuesZerosChecked = false; series.xValuesZeros = false; // Set series colors from palette IChartType chartType = e.CommonElements.ChartTypeRegistry.GetChartType(series.ChartTypeName); bool paletteColorsInPoints = chartType.ApplyPaletteColorsToPoints; // if the series palette is set the we can color all data points, even on column chart. if (series.Palette != ChartColorPalette.None) { paletteColorsInPoints = true; } PrepareData( paletteColorsInPoints, series.Name); // Clear temp. marker style if (series.tempMarkerStyleIsSet) { series.MarkerStyle = MarkerStyle.None; series.tempMarkerStyleIsSet = false; } // Set marker style for chart types based on markes if (chartType.GetLegendImageStyle(series) == LegendImageStyle.Marker && series.MarkerStyle == MarkerStyle.None) { series.MarkerStyle = (MarkerStyle)markerIndex++; series.tempMarkerStyleIsSet = true; if (markerIndex > 9) { markerIndex = 1; } } } }