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.
Hello rickycl,
I am looking into this matter of any error using the UltraChart with the persistence framework. I will give you a progress update by the end of the day Wednesday.
Sincerely,Mike P.Developer Support EngineerInfragistics, Inc.www.infragistics.com
Hello rickcl,
I have done some research into this matter and I have a question to help clarify the issue. What are you trying to persist with the WebChat? From my understanding it doesn’t seem as though persisting is relevant because the WebChat is an image that is generated.
Sincerely,
Mike P.
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com
There is a method called SavePreset method. This method saves the properties of a control to a file and may be used again using the LoadPreset method.
For more details please refer to the following documentation:
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2011.2/CLR4.0/html/Infragistics4.WebUI.Shared.v11.2~Infragistics.WebUI.WebControls.WebControlBase~SavePreset.html
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2011.1/CLR4.0/html/WebGrid_Save_and_Load_Presets_at_Run_Time.html
If you have any questions, please let me know as well.
We used SavePreset in the past but it had the problem of not saving custom color palletes nor custom renderings. (see http://forums.infragistics.com/forums/t/46896.aspx)
Besides we would need to do something similar with webdatagrid which according to http://forums.infragistics.com/forums/t/56171.aspx does not have SavePreset/LoadPreset methods.
So, any other suggestion?
Thanks!
Thank you for the input they are helpful.
Going back to the exception you are seeing, I am leaning on a duplicate XML node. ASP.NET will create two namespaces and type names if there are duplication occurs. I suggest verifying the schema and attributes you are using.
http://msdn.microsoft.com/en-us/library/ms946381.aspx
I am currently looking into the WebDataGrid inquiry regarding SavePreset/LoadPreset. I will be updating you within the week.
Hi Vivian,
Which schema and attributes you suggest verifying? I am just using the persistence framework to do the job, I have no control over that, do I?
Please let me know if you have any questions.