Profile Picture

Not able to bind the datatable to bar chart

Posted By Anupama Vadla 14 Years Ago
Author
Message
Anupama Vadla
Posted 14 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 14 Years Ago
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
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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





Similar Topics


Reading This Topic