Skip to main content

ChartImageUtils Class

Contains APIs for chart images.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.1.dll

NuGet Package: DevExpress.Charts

Declaration

public static class ChartImageUtils

Example

In the example below, a user can switch between series views by selecting them in the drop-down list.

The following code uses the ChartImageUtils.GetViewImage method to obtain view icons and then use them to create an ImageComboBoxEdit‘s items. ImageCollection objects (in the example below, smallViewImages and viewImages) are used to store images:

using DevExpress.Utils.Svg;
using DevExpress.XtraCharts;
using DevExpress.XtraEditors.Controls;
using System;
using System.Drawing;
using System.Windows.Forms;

private void Form1_Load(object sender, EventArgs e) {
    SvgPalette palette = new SvgPalette();
    palette.Colors.Add(new SvgColor("Red", ColorTranslator.FromHtml("#D04D2F")));
    palette.Colors.Add(new SvgColor("Yellow", ColorTranslator.FromHtml("#EEB764")));
    palette.Colors.Add(new SvgColor("Blue", ColorTranslator.FromHtml("#377AB5")));
    palette.Colors.Add(new SvgColor("Green", ColorTranslator.FromHtml("#4DAE89")));
    palette.Colors.Add(new SvgColor("Black", ColorTranslator.FromHtml("#000000")));
    palette.Colors.Add(new SvgColor("White", ColorTranslator.FromHtml("#FFFFFF")));

    imageComboBoxEdit1.Properties.SmallImages = viewImages;
    imageComboBoxEdit1.Properties.LargeImages = smallViewImages;

    viewImages.ImageSize = new Size(16, 16);
    smallViewImages.ImageSize = new Size(32, 32);

    foreach (ViewType vt in Enum.GetValues(typeof(ViewType))) {

        viewImages.AddImage(ChartImageUtils.GetViewImage(vt, palette));
        smallViewImages.AddImage(ChartImageUtils.GetViewImage(vt, palette));

        imageComboBoxEdit1.Properties.Items.Add(new ImageComboBoxItem(vt, imageComboBoxEdit1.Properties.Items.Count));
    }
    imageComboBoxEdit1.EditValue = ViewType.Line;
}
private void imageComboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e) {
    chartControl1.Series[0].ChangeView((ViewType)imageComboBoxEdit1.EditValue);
}

Inheritance

Object
ChartImageUtils
See Also