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
240
Column Chart - Incorrect X-Axis labels
posted

I am creating a column chart using NumericSeries. This chart can draw one or more series based off of a checkbox in the UI. When the user checks to show all columns, the X axis labels are the being set to the DateTime values but rather the NumericSeries.Label property:

 

                   uc_chart.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ColumnChart;
                    uc_chart.Data.SwapRowsAndColumns = true;

                    foreach (DataTable dt in ds.Tables)
                    {

                            NumericSeries nts = new NumericSeries();
                                nts.Label = dt.TableName;

                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                nts.Points.Add(new NumericDataPoint(
                                    (double)dt.Rows[i]["Value"],
                                    ((DateTime)dt.Rows[i]["Date"]).ToShortDateString(),
                                    false));
                            }

                            uc_chart.Series.Add(nts);

                            if (!checkShowAllColumns.Checked)
                                break;
                       
                    }

Parents
No Data
Reply
  • 26458
    Offline posted

    I believe what you're seeing is the result of setting SwapRowsAndColumns = true. It transposes your datasource. For examples, if you have 1 series with 3 points, after swapping you get 3 series with one point each, and so the series label becomes the point label. From your code snippet it's not obvious why you need to have to have the swap, but I suggest removing that property setting.

Children
No Data