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
890
[Winform_UltraChart]databind a ultrachart to a SeriesCollection
posted

Context : Ultrachart, style : line chart, winform, databinding

Hi,

I am programming a window containing a Graph (LineChart) that can change depending of the user interaction.

I first code something using the series approach shown below :
http://ko.infragistics.com/help/topic/EEB8F42A-9BEF-430E-8BAD-B99BB11B26E8

The result was Ok, but I was reinstantiating my ultrachart after each user interaction, that was not nice at all because of the flash due to reinstantiation.

So I plan to use databinding to modify my Series using SeriesCollection.
This time it was a big fail with the result (no error is thrown when executing) in the ultrachart I got the message :

Line Chart Error: You must have at least one row and one numeric column 


I am doing my databinding this way :

private UltraChart _myUltraChart;

        private UltraChartBindingClass _myBindingClass;

 

        //constructor

        public ChartBuilder()

        {

            //some method returning a linechart

            _myUltraChart = GetDefaultStyleUltraChart();

            _myBindingClass = new UltraChartBindingClass();

 

            //databinding

            //with Series : SeriesCollection Series

            _myUltraChart.DataSource = _myBindingClass.Series;

            _myUltraChart.Data.DataBind();

        }

 

 

        //I got a method that feed my ultrachart :

        public void FeedMyUltraChart(IEnumerable myTimeSeries)

        {

            foreach (var timeSerie in myTimeSeries)

            {

                _myBindingClass.Series.Add(timeSerie);

                //I tried here to use _myUltraChart.Data.DataBind(); or _myUltraChart.Series.DataBind(); but nothing worked

            }

        }

 

        //I got a method to clean my series (can't clean anything now, because adding series doesn't work)

        public void CleanMySeries()

        {

            _myBindingClass.Series.Clear();

        }


What am I doing the wrong way to have my project working?


Regards

Parents
  • 53790
    posted

    Hello pebg,

    I made small sample for you with line chart and DataBinding. Could you please take a look at the attached sample and if you have any questions, please feel free to write me.

    Regards

    CompositeLineChart_Year_5.zip
Reply Children