Chart Control Data Element Throws NotImplementedException

I pass a Microsoft Chart control using IEnumerable of my own ChartPoint class

    public class ChartPoint
    {
        public double Xvalue { get; set; }
        public double Yvalue { get; set; }
        public string Url { get; set; }
        public string Tooltip { get; set; }
    }

then I'm trying DataBind IEnumerable <ChartPoint>:

serie.Points.DataBind(points, "Xvalue", "Yvalue", "Tooltip=Tooltip,Url=Url");

but then removes NotImplementedException on this line:

 System.Linq.Iterator`1.System.Collections.IEnumerator.Reset() +29
   System.Web.UI.DataVisualization.Charting.DataPointCollection.DataBind(IEnumerable dataSource, String xField, String yFields, String otherFields) +313

What am I doing wrong?

+5
source share
3 answers

Do you use a C # iterator?

C # iterators do not implement the Reset function in the generated IEnumerator and will throw a NotImplementedException if it is thrown. Concrete controls appear to require this method to be present.

, , , Reset . - List<T> IEnumerable<T>

List<ChartPoint> list = new List<ChartPoint>(points);
serie.Points.DataBind(list, "Xvalue", "Yvalue", "Tooltip=Tooltip,Url=Url");
+12

(.. yield return)? Reset, , Reset, NotImplementedException.

+2

See Connect bug report here . Please vote for it and maybe MS will fix it in the next release of Chart.

0
source

All Articles