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
646
Column visibility
posted

I came accross the following odd behaviour:

I set the DataSource and DataMember at designtime to a datatable. This I do for the sole purpose of designing the chart at Design-Time. When the program is run the chart is bound programmticaly. The thing I noticed is that if you do it this way the "Data.IncludeColumn" method is not working.

It seems that after calling DataBind the columnlist doesnt get repoulated. If I debug the chart and look at the internal datatable, there are still the columns I bound to at DesginTime, therefore IncludeColumn does not find the column and the internal excludedColumn list is empty.

If I call ResetData() before or if I remove the reference to the datatable at designtime, everything works as expected.

Is this a bug or is my logic faulty?

 

 

  • 28496
    Offline posted

    i'm not sure what the problem is based on your description.  i set up a scenario similar to what you described, and it worked fine for me, producing the chart with one column excluded, as expected.

    private void Form1_Load(object sender, EventArgs e)
    {
        DataSet set = new DataSet();
        DataTable table = new DataTable("TheTable");
        set.Tables.Add(table);
        table.Columns.Add("ValueA", typeof(double));
        table.Columns.Add("ValueB", typeof(double));
        table.Rows.Add(new object[] { 1, 2 });
        table.Rows.Add(new object[] { 3, 4 });
        table.Rows.Add(new object[] { 5, 6 });
        table.Rows.Add(new object[] { 7, 8 });
        this.ultraChart1.Data.DataSource = set;
        this.ultraChart1.Data.DataMember = "TheTable";
        this.ultraChart1.Data.IncludeColumn(1, false);
        this.ultraChart1.Data.DataBind();
    }

    is this basically what you're trying to do?  am i missing a step?