I am trying to create a column chart. I am building a datatable with several columns in it and I need to pick the column that will be represented along the X-axis. I can bind to my dataview with no problem, but I can't figure out how to show a column other than the first column in the datatable along the x-axis. How do I do that in code?
Hello Rehemann,
There are different approaches to solve this task. Maybe one possible solution could be if you are using DataBind method of your series. For example:
// DataSource
DataTable dt = new DataTable();
dt.Columns.Add("Items", typeof(string));
dt.Columns.Add("Miles Column", typeof(decimal));
dt.Columns.Add("Fillups Column", typeof(decimal));
NumericSeries columnSeries = new NumericSeries();
columnSeries.DataBind(dt,"Miles Column", "Items");
columnSeries.PEs.Add(new PaintElement(Color.Gold));
columnSeries.Label ="Miles [nm]";
Please take a look at the attached sample for more details and if you have any questions, feel free to write me
Regards
Please take a look at the attached picture. My data is represented correctly. The problem is that the labels along the X-axis are for the wrong column in my data table. 3145 is an autonumber field in my table and happens to be the first column in the table. I really want to display a customer name column instead. How do I pick another column in my bound datatable to be represented as the label? I cannot alter the structure of the table.
Hi,
It is very difficult for me to guess what is your scenario, looking the screenshot. Are you using Composite chart ? Did you have a time to try my suggestion from previous response ?
Another possible solution for you could be :
ultraChart1.Data.UseRowLabelsColumn =true;
ultraChart1.Data.RowLabelsColumn = 2;
Let me know if you have any questions.
That is exactly what I needed! Thanks!