Not able to bind the datatable to bar chart


Author
Message
Anupama Vadla
Anupama Vadla
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)
Group: Forum Members
Posts: 3, Visits: 1
I am using sample Northwind database
my data is present in datatable which has "CategoryName" and "Tot price" columns. I tried binding this dt to my chart using
NChartControl1.DataBindingManager.AddBinding(0, 0, "Values", dt, "Tot Price");
NChartControl1.DataBindingManager.AddBinding(0, 0, "XValues", dt, "CategoryName");
but the chart is empty.
I need CategoryName on x-axis and TotPrice on Y-axis.
I am following the documentation. But not able to make it.
Can any one pls give me the code how to start building a simple bar chart.
Also How can I bind sqldatasource or object datasource to chart.

I am very new to Nevron.

Thanks in advance.
Urgent please.
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hello Anupama,

You have to add a bar series to the chart:

NBarSeries bar = new NBarSeries();
chart.Series.Add(bar);

Then you can add the data bindings. Please note that the XValues are not labels and you cannot use category names as X values. You can bing the category names to the Labels data series and they will be displayed in the bar data labels. Currently you cannot data bind axis labels, but we will have this feature in the next release. At this point if you need to show custom axis labels you have to add them manually, as demonstrated in the following example in our Windows Forms demo application:

All Examples > Chart Gallery > Area > Standard 2D Area

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search