Completed
Last Updated: 03 Jan 2017 12:58 by ADMIN
ADMIN
Dimitar
Created on: 30 Oct 2015 07:12
Category: ChartView
Type: Bug Report
0
FIX. RadChartView - the palette name is not set when the palette is changed from the context menu.
To reproduce:
- Set the palette from the default context menu.
- Try to get the palette name.

Workaround:
class MyChartDataPointElementController : ChartDataPointElementController
{
    protected override RadContextMenu CreatePaletteMenu()
    {
        //return base.CreatePaletteMenu();
        RadContextMenu menu = new RadContextMenu();

        RadChartLocalizationProvider localizationProvider = RadChartLocalizationProvider.CurrentProvider;

        RadMenuItem paletteItem = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.Palette));
        menu.Items.Add(paletteItem);

        RadMenuItem item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteArctic));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteAutumn));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteCold));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteFlower));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteForest));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteGrayscale));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteGround));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteLilac));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteMetro));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteNatural));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PalettePastel));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteRainbow));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);


        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteSpring));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);


        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteSummer));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteWarm));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteWindows8));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteSun));
        item.Click += new System.EventHandler(item_Click);
        paletteItem.Items.Add(item);

        return menu;
    }

    void item_Click(object sender, System.EventArgs e)
    {
        RadMenuItem item = sender as RadMenuItem;
        if (item != null)
        {
            this.Area.View.Palette = ChartPalette.FromKnownPalette(item.Text);
            this.Area.View.Palette.Name = item.Text;
        }
    }
}

Change the controller like this:
 radChartView1.Controllers.Add(new MyChartDataPointElementController());
0 comments