Exemplo n.º 1
0
 static DevExpressChart()
 {
     PerformaceColorizer = new RangeColorizer()
     {
         Palette = PerformancePalette
     };
     PerformaceColorizer.RangeStops.AddRange(new double[] { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 });
 }
        public SCChart AddSeriesColorizer(SeriesColorizerType colorizerType, string seriesName, SeriesColorizerOptions options = null)
        {
            ChartColorizerBase colorizer;

            switch (colorizerType)
            {
            case SeriesColorizerType.Key:
                colorizer = new KeyColorColorizer();
                options ??= new KeySeriesColorizerOptions();
                break;

            case SeriesColorizerType.Object:
                colorizer = new ColorObjectColorizer();
                options ??= new ObjectSeriesColorizerOptions();
                break;

            case SeriesColorizerType.Range:
                colorizer = new RangeColorizer();
                options ??= new RangeSeriesColorizerOptions();
                break;

            default:
                colorizer = new KeyColorColorizer();
                options ??= new KeySeriesColorizerOptions();
                break;
            }

            DevExpress.XtraCharts.Series series;
            if (string.IsNullOrWhiteSpace(seriesName))
            {
                series = CurrentSeries;
            }
            else
            {
                series = Chart.Series[seriesName];
            }
            if (series == null)
            {
                throw new Exception($"Cannot find series '{seriesName}'.");
            }

            options.SetupXtraChartColorizer(this, colorizer);

            series.View.Colorizer = colorizer;

            return(this);
        }
Exemplo n.º 3
0
        // Creates a range colorizer.
        ChartColorizerBase CreateColorizer()
        {
            Palette palette = new Palette("Custom");

            palette.Add(Color.FromArgb(255, 255, 90, 25), Color.FromArgb(255, 255, 90, 25));
            palette.Add(Color.FromArgb(255, 229, 227, 53), Color.FromArgb(255, 229, 227, 53));
            palette.Add(Color.FromArgb(255, 110, 201, 92), Color.FromArgb(255, 110, 201, 92));

            RangeColorizer colorizer = new RangeColorizer()
            {
                LegendItemPattern = "{V1} - {V2} HPI",
                Palette           = palette
            };

            colorizer.RangeStops.AddRange(new double[] { 22, 30, 38, 46, 54, 64 });
            return(colorizer);
        }