Beispiel #1
0
        /// <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;
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Event fired after chart picture was painted.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void ChartPicture_AfterPaint(object sender, ChartPaintEventArgs e)
        {
            ChartService control = Common.Chart;

            if (control != null)
            {
                // Clean up series after drawing
                for (int index = 0; index < Series.Count; index++)
                {
                    Series series = Series[index];
                    if (series.UnPrepareData())
                    {
                        --index;
                    }
                }
            }
        }