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
115
Bug in IncludeColumn?
posted

Hi all,

Can anyone reproduce this behaviour in UltraWinChart? I run the code below:

using System.Data;
using Infragistics.Win.UltraWinChart;
using Infragistics.UltraChart.Shared.Styles;
using System.Windows.Forms;

namespace ConsoleApplication4
{
  class Program
  {
    static void Main(string[ args)
    {
      DataTable dt = new DataTable();
      dt.Columns.Add("Key", typeof(int));
      dt.Columns.Add("Labels", typeof(string));
      dt.Columns.Add("Column1", typeof(double));
      dt.Columns.Add("Column2", typeof(double));
      dt.Columns.Add("Column3", typeof(double));
      dt.Columns.Add("Column4", typeof(double));

      for (int i = 0; i < 10; i++)
      {
        DataRow dr = dt.NewRow();
        dr["Key"] = i;
        dr["Labels"] = i.ToString();
        dr["Column1"] = (double)i;
        dr["Column2"] = (double)i;
        dr["Column3"] = (double)i;
        dr["Column4"] = (double)i;
        dt.Rows.Add(dr);
      }

      DataView dv = new DataView(dt);
      UltraChart uc = new UltraChart();
      uc.ChartType = ChartType.BarChart;
      uc.DataSource = dv;
      uc.DataBind();

      Form f = new Form();
      f.Controls.Add(uc);
      f.Show();

      uc.Data.IncludeColumn("Key", false);
      uc.Data.IncludeColumn("Labels", true);
      uc.Data.IncludeColumn("Column1", true);
      uc.Data.IncludeColumn("Column2", true);
      uc.Data.IncludeColumn("Column3", true);
      uc.Data.IncludeColumn("Column4", true);

      uc.Data.IncludeColumn("Column1", true);
      uc.Data.IncludeColumn("Column2", true);
      uc.Data.IncludeColumn("Column3", true);
      uc.Data.IncludeColumn("Column4", false);

      uc.Data.IncludeColumn("Column1", true);
      uc.Data.IncludeColumn("Column2", true);
      uc.Data.IncludeColumn("Column3", false);
      uc.Data.IncludeColumn("Column4", false);

      uc.Data.IncludeColumn("Column1", true);
      uc.Data.IncludeColumn("Column2", true);
      uc.Data.IncludeColumn("Column4", true);
      uc.Data.IncludeColumn("Column3", false);

      Application.Run();
    }
  }
}

I would expect that the code above would cause three columns of data to be displayed in the chart (ie Columns 1, 2 and 3), but I only see two. Does anyone know if this behaviour is by design?

Many thanks,
Luke

 

Parents
  • 125
    posted

    Not sure if this will help in your situation or not...

     The problem I noticed with the IncludeColumn method was that the collection it populates (excludedColumns) seemed to simply accumulate columns (even a column with the same key) as I was dynamically creating charts from different DataTables.

     By utilizing the ResetData() method of the UltraChart the collection cleared out for me before the creation of each chart and the right columns were being included/excluded.

     Have you looked at the excludedColumns member (so uc.Data.excludedColumns) to see how many elements it contains?

     

     

Reply Children