This is a migrated thread and some comments may be shown as answers.

RadChart CustomPalettes error using LoadFromXml()

1 Answer 43 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 31 Oct 2011, 07:07 PM

If you define a custom palette in RadChart and use the LoadFromXml() method, the control will throw an error in FillStyle.GetHashCode().  Basically, what I think is going on there is that the PalettesCollection.GetPalette() method is throwing an error because the "CustomPalettes" property has not yet loaded the custom palette that is defined declaratively in the control’s XML markup on the aspx page.

 

Relevant code in Telerik.Charting.PalettesCollection.PalettesCollection.cs:

 

public static Palette GetPalette(string name, Chart chart)

{

      if (!chart.CustomPalettes.Contains(name))

      {

        throw new ChartException(string.Format("There is no Palette with name: {0}", name));

      }

 

      return chart.CustomPalettes.GetPalette(name);

}

 

Declarative definition sample in the aspx page:

<CustomPalettes>

            <telerik:Palette Name="CustomPaletteColorful">

                <Items>

                    <telerik:PaletteItem MainColor="0xff, 0xba, 0x4a" SecondColor="0xff, 0xf4, 0xe3">

                    </telerik:PaletteItem>

                    <telerik:PaletteItem MainColor="0x15, 0xc5, 0x16" SecondColor="0xda, 0xf6, 0xda">

                    </telerik:PaletteItem>

                    <telerik:PaletteItem MainColor="0xff, 0x5b, 0" SecondColor="0xff, 0xe5, 0xd7">

                    </telerik:PaletteItem>

                </Items>

            </telerik:Palette>

</CustomPalettes>

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 03 Nov 2011, 10:21 AM
Hi Paul,

Please, find attached a small example with a suggestion for a workaround. Basically, it excludes the SeriesPalette property from the xml file, so that the chart is loaded correctly.

Best regards,
Ves
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Chart (Obsolete)
Asked by
Paul
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or