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
found, logged, and fixed: bug # BR35938
i will look into this "default behavior" response you've been getting, hopefully we can make some improvements in that department as well.
thanks for reporting the issue :)
Certainly seems like an oversight to me; to allow the same column to be added more than once. When would you *want* this to happen? I wonder what situations this might be useful?
Also, if I have re-sourced the chart by setting the DataSource property, the excludedColumns collection should be reset as well, without needing to call the ResetData method.
Well, that's the way I thought it would/should work... just my $.02.
I'm told this is the "default behaviour".
Ah I see. The list of excluded columns ends up containing two entries for the same column if IncludeColumn("blah", false) is called twice. This means that in the future, IncludeColumn("blah", true) must be called twice to include the column!
This behaviour contradicts Infragistics documentaion (http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Win.UltraWinChart.v8.2~Infragistics.UltraChart.Resources.Appearance.DataAppearance~IncludeColumn(String,Boolean).html), so I will report it.
Fortunately it is easy for me to keep track of the calls to IncludeColumn, so I can work around this. Many thanks for yor help.
Luke
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?