All docs
V20.2
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

ChartImageUtils.GetViewImage(ViewType, ISvgPaletteProvider) Method

Returns an image that depicts the series view with the specified palette.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.2.dll

Declaration

public static Image GetViewImage(
    ViewType viewType,
    ISvgPaletteProvider provider
)
Public Shared Function GetViewImage(
    viewType As ViewType,
    provider As ISvgPaletteProvider
) As Image

Parameters

Name Type Description
viewType ViewType

The series view type shown in the resulting image.

provider DevExpress.Utils.Design.ISvgPaletteProvider

An ISvgPaletteProvider object that specifies colors used to paint vector images.

Returns

Type Description
Image

The resulting image.

Remarks

You can directly pass an SvgPalette object to the provider parameter. Also, you can obtain the palette from a UserLookAndFeel as follows:

UserLookAndFeel lookAndFeel = new UserLookAndFeel(chartControl1) { SkinName = "DevExpress Dark Style", UseDefaultLookAndFeel = false };
ISvgPaletteProvider paletteProvider = SvgPaletteHelper.GetSvgPalette(lookAndFeel, ObjectState.Normal);
//...
viewImages.AddImage(ChartImageUtils.GetViewImage(vt, paletteProvider));

Examples

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);
}
See Also