Beispiel #1
0
        private void Filter(NBarSeries bar)
        {
            NDataSeriesSubset subsetAll    = new NDataSeriesSubset();
            NDataSeriesSubset subsetFilter = new NDataSeriesSubset();

            subsetAll.AddRange(0, bar.Values.Count - 1);

            try
            {
                double dValue = Double.Parse(ValueTextBox.Text);

                Nevron.Chart.CompareMethod method = (Nevron.Chart.CompareMethod)FilterDropDownList.SelectedIndex;

                subsetFilter = bar.Values.Filter(method, dValue);

                // apply red color only to the bars in the filter subset
                foreach (int index in subsetFilter)
                {
                    bar.FillStyles[index] = new NColorFillStyle(Color.Red);
                }
            }
            catch
            {
            }
        }
        private void ApplyFilter_Click(object sender, System.EventArgs e)
        {
            double dValue;
            string sFilter    = "";
            string sOperation = "";

            // make all colors blue
            ApplyColorToSubset(m_SubsetAll, Color.Blue);

            try
            {
                dValue = Double.Parse(Value.Text);
            }
            catch
            {
                return;
            }

            Nevron.Chart.CompareMethod compareMethod = (Nevron.Chart.CompareMethod)compareMethodCombo.SelectedIndex;

            NDataSeriesSubset subset = m_Bar.Values.Filter(compareMethod, dValue);

            switch (compareMethodCombo.SelectedIndex)
            {
            case 0:
                sFilter = "(> " + dValue.ToString() + ")";
                break;

            case 1:
                sFilter = "(< " + dValue.ToString() + ")";
                break;

            case 2:
                sFilter = "(==" + dValue.ToString() + ")";
                break;

            case 3:
                sFilter = "(>=" + dValue.ToString() + ")";
                break;

            case 4:
                sFilter = "(<=" + dValue.ToString() + ")";
                break;

            case 5:
                sFilter = "(!=" + dValue.ToString() + ")";
                break;
            }

            switch (subsetOperationCombo.SelectedIndex)
            {
            case 0:                     // replace
                m_SubsetFilter = subset;
                OperationList.Items.Clear();
                sOperation = "f = ";
                break;

            case 1:                     // combine
                m_SubsetFilter.Combine(subset);
                sOperation = "f = f combine ";
                break;

            case 2:                     // intersect
                m_SubsetFilter.Intersect(subset);
                sOperation = "f = f intersect ";
                break;

            case 3:                     // subtract
                m_SubsetFilter.Subtract(subset);
                sOperation = "f = f subtract ";
                break;
            }

            OperationList.Items.Add(sOperation + sFilter);
            CurrentFilter.Text = m_SubsetFilter.ToString();

            // apply red color only on the bars in the filter subset
            ApplyColorToSubset(m_SubsetFilter, Color.Red);

            nChartControl1.Refresh();
        }