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
95
Bug in IncludeColumn... or a feature I don't understand?
posted

Hello,

 I have a bar chart for which the user can filter the displayed columns. The 7 columns represent states, from "None" (col0) to "Failure" (col6), and the filter allow to display only the column representing states equal or above the chose value.

The problem is that, when I call IncludeColumn, only the data are  filtered out. Columns' labels and colors remains unfiltered. So, if I choose to have only the highest level "Failure" (col6), the chart displays the correct value (40 in the example), but with the label and the color of Col0. See attached screenshots for more details.

 Is that a bug or am I missing something?

Regards

 

I precise I'm building my chart manually by doing:

ultraChart1.DataSource = new int[[ { new int[ { 650, 600, 525, 300, 185, 65, 40 } };
ultraChart1.Data.SetColumnLabels(new string[ { "None", "Info", "Warning", "Minor", "Major", "Critical", "Failure" });
ultraChart1.ColorModel.ModelStyle = ColorModels.CustomLinear;
ultraChart1.ColorModel.CustomPalette = new Color[ { Color.LightGray, Color.LightBlue, SystemColors.ControlLight, Color.Yellow, Color.Orange, Color.Red, Color.Purple };

Here the code to filter:

        private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            State _minDisplayedLevel = (State)toolStripComboBox1.SelectedItem;

            for (int i = NumberOfPriorityLevel - 1; i >= 0; i--)
            {
                bool colWillBeVisible = i >= (int)_minDisplayedLevel;
                if (colWillBeVisible == ultraChart1.Data.IsColumnExcluded(i))
                {
                    ultraChart1.Data.IncludeColumn(i, colWillBeVisible);
                    System.Diagnostics.Debug.WriteLine("Set col " + i + " visibility to " + colWillBeVisible);
                }
            }
        }

 

Parents
No Data
Reply
  • 28496
    Offline posted

    i didn't quite get the same chart as you, using the code you provided ... so it is hard to identify what might be the problem ... but try using a DataTable as the DataSource, instead of an int[, as the concepts of "Row" and "Columns" will be less confusing.

    in the screenshots, it looks like the chart is treating each item as its own row, with one value per row, which would make the IncludeColumn method ineffective.

Children
No Data