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
4133
How To Choose X Axis Column To Something Other Than First Column In DataTable
posted

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?

 

Parents
No Data
Reply
  • 53790
    posted

    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

Children