public override void Initialize()
        {
            base.Initialize();

            m_Chart = nChartControl1.Charts[0];
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            m_Bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar.Values.FillRandom(Random, 10);
            m_Bar.Legend.Mode = SeriesLegendMode.None;

            m_Subset.AddRange(0, 9);
            Subset.Text = m_Subset.ToString();
            FunctionCombo.SelectedIndex = 0;

            ApplyColorToSubset();

            // add a label
            NLabel title = nChartControl1.Labels.AddHeader("Evaluating data");

            title.TextStyle.FontStyle         = new NFontStyle("Times New Roman", 20, FontStyle.Italic);
            title.TextStyle.FillStyle         = new NColorFillStyle(Color.MidnightBlue);
            title.TextStyle.ShadowStyle.Type  = ShadowType.Solid;
            title.TextStyle.ShadowStyle.Color = Color.White;
            title.ContentAlignment            = ContentAlignment.BottomCenter;
            title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));
        }
Exemple #2
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
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FunctionDropDownList.Items.Add("MIN");
                FunctionDropDownList.Items.Add("MAX");
                FunctionDropDownList.Items.Add("AVE");
                FunctionDropDownList.Items.Add("SUM");
                FunctionDropDownList.Items.Add("ABSSUM");
                FunctionDropDownList.Items.Add("FIRST");
                FunctionDropDownList.Items.Add("LAST");
                FunctionDropDownList.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // add header
            NLabel header = nChartControl1.Labels.AddHeader("Evaluating Data");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.TextStyle.FillStyle        = new NColorFillStyle(Color.FromArgb(60, 90, 108));
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // configure the legend
            nChartControl1.Legends.Clear();

            // setup the chart
            NChart chart = nChartControl1.Charts[0];

            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.BoundsMode = BoundsMode.Stretch;
            chart.Location   = new NPointL(
                new NLength(5, NRelativeUnit.ParentPercentage),
                new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(90, NRelativeUnit.ParentPercentage),
                new NLength(80, NRelativeUnit.ParentPercentage));

            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Values.FillRandom(Random, 10);

            NDataSeriesSubset subset = new NDataSeriesSubset();

            subset.AddRange(0, 9);

            string function = FunctionDropDownList.SelectedItem.Text;
            double result   = bar.Values.Evaluate(function, subset);

            ResultTextBox.Text = result.ToString();
        }
        private void ResetFilter()
        {
            m_SubsetAll.Clear();
            m_SubsetFilter.Clear();

            if (m_Bar.Values.Count > 0)
            {
                m_SubsetAll.AddRange(0, m_Bar.Values.Count - 1);
                m_SubsetFilter.AddRange(0, m_Bar.Values.Count - 1);
            }

            OperationList.Items.Clear();
            OperationList.Items.Add("f = all");
            CurrentFilter.Text = m_SubsetFilter.ToString();

            ApplyColorToSubset(m_SubsetFilter, Color.Red);
        }
        private void SetConstline(NDataSeriesDouble ds)
        {
            NAxis axis = m_Chart.Axis(StandardAxis.PrimaryY);

            // add a constline if necessary
            if (axis.ConstLines.Count == 0)
            {
                axis.ConstLines.Add();
            }

            // the line series won't be used
            m_Line.Visible = false;

            // add a new constline
            NAxisConstLine cl = (NAxisConstLine)axis.ConstLines[0];

            cl.StrokeStyle.Width = new NLength(3, NGraphicsUnit.Pixel);
            cl.StrokeStyle.Color = Color.Green;
            cl.Value             = (double)ds.GetValueForIndex(0);

            string text = cl.Value.ToString();

            if (text.Length > 7)
            {
                text = text.Substring(0, 7);
            }

/*			NAxisCustomLabel axisLabel = axis.CustomLabels.Add();
 *                      axisLabel.Offset = 3;
 *                      axisLabel.TextStyle.BackplaneStyle.Visible = true;
 *                      axisLabel.Angle = 180;
 *                      axisLabel.Text = text;
 *                      axisLabel.Value = cl.Value;*/

            // set proper scale for the axis, so that it includes the constline
            NDataSeriesSubset subset = new NDataSeriesSubset();

            subset.AddRange(0, ds.Count - 1);

            double max1 = m_Line1.Values.Evaluate("MAX", subset);
            double min1 = m_Line1.Values.Evaluate("MIN", subset);

            double max2 = m_Line2.Values.Evaluate("MAX", subset);
            double min2 = m_Line2.Values.Evaluate("MIN", subset);

            if (max1 < max2)
            {
                max1 = max2;
            }

            if (min1 > min2)
            {
                min1 = min2;
            }

            if (cl.Value > max1)
            {
                axis.View = new NRangeAxisView(new NRange1DD(double.MinValue, cl.Value), false, true);
            }
            else if (cl.Value < min1)
            {
                axis.View = new NRangeAxisView(new NRange1DD(cl.Value, double.MaxValue), true, false);
            }
        }