hi Everyone,
I have one serious problem,
if you have any solution please let me know.
I have one WPF bar chart.
I am creating this using below function.
public Chart createwpfbar(Chart wpfbar)
{
DataPointSeries datapointseries = new ColumnSeries();
datapointseries.Title = "Quantity";
List<keyvaluepair><string,>> valueList = new List<keyvaluepair><string,>>();
valueList.Add(new KeyValuePair<string,>("Developer", 60));
valueList.Add(new KeyValuePair<string,>("Misc", 20));
valueList.Add(new KeyValuePair<string,>("Tester", 50));
valueList.Add(new KeyValuePair<string,>("QA", 30));
valueList.Add(new KeyValuePair<string,>("Project Manager", 40));
ChartLegendItem item1 = new ChartLegendItem();
item1.MarkerFill = Brushes.YellowGreen;
item1.Label = "Volts";
ChartDefaultView chartdefaultview = new ChartDefaultView();
chartdefaultview.ChartLegend.Items.Add(item1);
chartdefaultview.ChartTitle.HorizontalAlignment = HorizontalAlignment.Center;
BarSeries newbarseries = new BarSeries();
newbarseries.Title = "Volts";
newbarseries.Title = Brushes.Red;
datapointseries.DependentValueBinding = new Binding("Value");
datapointseries.IndependentValueBinding = new Binding("Label");
wpfbar.DataContext = valueList;
return wpfbar;
}
this function returns the WPF Bar chart.
after that for some reasons I am doing clone of Chart using below code.
string GridXAML = XamlWriter.Save(element);
StringReader stringReader = new StringReader(GridXAML);
XmlReader xmlReader = XmlReader.Create(stringReader);
UIElement newGrid = (UIElement)XamlReader.Load(xmlReader);
ClipBoard.PushData(newGrid, element);
in this code I got one error for serialization,
error as follows,
Cannot serialize a non-public type 'System.Windows.Controls.DataVisualization.UniqueObservableCollection`1[System.Windows.Controls.DataVisualization.Charting.IAxis]'.
please help me as I am stucked with this error.
let me know if any solution for this.
Best Regards,
Amol P.Patil