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
40
Using ArrayList instead of DataTable
posted

Hi, 

I have an ArrayList which contains integers, which I want to plot directly. For ex: if arraylist contains {2, 3, 5, 6}, The elements in the arraylist should be treated as values on y-axis and the graph plotted should have points (2,0), (3,1), (5,2) and (6,3). How can we do this ??

I saw some basic examples which use DataTable and values are added to rows and columns of DataTable, but i want to use arraylist directly. Is it possible ??

Any help will be appreciated.

 

Parents
No Data
Reply
  • 26458
    Offline posted

    yes, you can use an arraylist or any numeric array as the chart's datasource.

    ArrayList list = new ArrayList(new int[]{1,2,3,4,5});
    ultraChart1.Data.DataSource = list;

    or

    ultraChart1.Data.DataSource = new int[]{1,2,3,4,5};

Children
No Data