Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1810
Persistence Framework: Error Persisting UltraChart
posted

Here's a piece of code that generates an UltraChart (taken from a sample in the documentation) and then serializes it using the persistence framework:

 

 public UltraChart GetChart() {

 

            UltraChart lChart = new UltraChart();

            lChart.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.Composite;

            ChartArea myChartArea = new ChartArea();

            lChart.CompositeChart.ChartAreas.Add(myChartArea);

 

            AxisItem axisX = new AxisItem();

            axisX.OrientationType = AxisNumber.X_Axis;

            axisX.DataType = AxisDataType.String;

            axisX.SetLabelAxisType = SetLabelAxisType.GroupBySeries;

            axisX.Labels.ItemFormatString = "<ITEM_LABEL>";

            axisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;

 

            AxisItem axisY = new AxisItem();

            axisY.OrientationType = AxisNumber.Y_Axis;

            axisY.DataType = AxisDataType.Numeric;

            axisY.Labels.ItemFormatString = "<DATA_VALUE:0.#>";

 

            myChartArea.Axes.Add(axisX);

            myChartArea.Axes.Add(axisY);

 

            NumericSeries seriesA = GetNumericSeriesBound();

            NumericSeries seriesB = GetNumericSeriesUnBound();

            lChart.CompositeChart.Series.Add(seriesA);

            lChart.CompositeChart.Series.Add(seriesB);

 

            ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();

            myColumnLayer.ChartType = ChartType.ColumnChart;

            myColumnLayer.ChartArea = myChartArea;

            myColumnLayer.AxisX = axisX;

            myColumnLayer.AxisY = axisY;

            myColumnLayer.Series.Add(seriesA);

            myColumnLayer.Series.Add(seriesB);

            lChart.CompositeChart.ChartLayers.Add(myColumnLayer);

 

            CompositeLegend myLegend = new CompositeLegend();

            myLegend.ChartLayers.Add(myColumnLayer);

            myLegend.Bounds = new Rectangle(0, 75, 20, 25);

            myLegend.BoundsMeasureType = MeasureType.Percentage;

            myLegend.PE.ElementType = PaintElementType.Gradient;

            myLegend.PE.FillGradientStyle = GradientStyle.ForwardDiagonal;

            myLegend.PE.Fill = Color.CornflowerBlue;

            myLegend.PE.FillStopColor = Color.Transparent;

            myLegend.Border.CornerRadius = 10;

            myLegend.Border.Thickness = 0;

            lChart.CompositeChart.Legends.Add(myLegend);

            return lChart;

        }

        public Stream GetChartStream()

        {

            var lChart = GetChart();

            PersistenceManager lManager = PersistenceManager.GetInstance();

            PersistenceData lData = new PersistenceData();

            lData.Controls.Add(lManager.SaveControl(lChart, "control"));

            return lData.ToStream();

        }

 

 

And it is generating this error:

"The XML element 'EnableTheming' from namespace '' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element."

at line "return lData.ToStream();"

 

Why could this be? 

 

Thanks in advance.