Exemple #1
0
        /// <summary>
        ///   Constructs a new instance of the HistogramView.
        /// </summary>
        ///
        public HistogramView()
        {
            InitializeComponent();

            this.histogram  = new BestCS.Statistics.Visualizations.Histogram();
            graphBars       = new ZedGraph.BarItem(String.Empty);
            graphBars.Color = Color.DarkBlue;
            zedGraphControl.GraphPane.Title.FontSpec.IsBold            = true;
            zedGraphControl.GraphPane.Title.FontSpec.Size              = 32f;
            zedGraphControl.GraphPane.Title.IsVisible                  = true;
            zedGraphControl.GraphPane.XAxis.Type                       = AxisType.Text;
            zedGraphControl.GraphPane.XAxis.Title.IsVisible            = false;
            zedGraphControl.GraphPane.XAxis.MinSpace                   = 0;
            zedGraphControl.GraphPane.XAxis.MajorGrid.IsVisible        = false;
            zedGraphControl.GraphPane.XAxis.MinorGrid.IsVisible        = false;
            zedGraphControl.GraphPane.XAxis.MajorTic.IsBetweenLabels   = true;
            zedGraphControl.GraphPane.XAxis.MajorTic.IsInside          = false;
            zedGraphControl.GraphPane.XAxis.MajorTic.IsOpposite        = false;
            zedGraphControl.GraphPane.XAxis.MinorTic.IsAllTics         = false;
            zedGraphControl.GraphPane.XAxis.Scale.FontSpec.IsBold      = true;
            zedGraphControl.GraphPane.XAxis.Scale.FontSpec.IsAntiAlias = true;
            zedGraphControl.GraphPane.YAxis.MinorTic.IsAllTics         = false;
            zedGraphControl.GraphPane.YAxis.MajorTic.IsOpposite        = false;
            zedGraphControl.GraphPane.YAxis.Title.Text                 = "„астота";
            zedGraphControl.GraphPane.YAxis.Title.FontSpec.Size        = 24f;
            zedGraphControl.GraphPane.YAxis.Title.FontSpec.IsBold      = true;
            zedGraphControl.GraphPane.Border.IsVisible                 = false;
            zedGraphControl.GraphPane.BarSettings.MinBarGap            = 0;
            zedGraphControl.GraphPane.BarSettings.MinClusterGap        = 0;
            zedGraphControl.GraphPane.CurveList.Add(graphBars);
        }
Exemple #2
0
 /// <summary>
 ///   Displays a histogram.
 /// </summary>
 ///
 /// <param name="histogram">The histogram to show.</param>
 ///
 public static HistogramBox Show(BestCS.Statistics.Visualizations.Histogram histogram)
 {
     return(show(histogram.Title, histogram.Values.ToDouble()));
 }
Exemple #3
0
        private void onDataBind()
        {
            samples = null;

            if (dataSource == null)
            {
                return;
            }

            BestCS.Statistics.Visualizations.Histogram source = dataSource as BestCS.Statistics.Visualizations.Histogram;

            if (source == null)
            {
                if (histogram == null)
                {
                    histogram = new BestCS.Statistics.Visualizations.Histogram();
                }

                if (dataSource is DataSet)
                {
                    // throw new NotSupportedException();
                }
                else if (dataSource is DataTable)
                {
                    DataTable table = dataSource as DataTable;

                    if (dataMember != null && dataMember.Length > 0)
                    {
                        if (table.Columns.Contains(dataMember))
                        {
                            DataColumn column = table.Columns[dataMember];
                            samples = Matrix.ToArray(column);
                        }
                        else
                        {
                            samples = new double[0];
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else if (dataSource is double[])
                {
                    samples = dataSource as double[];
                }
                else if (dataSource is IListSource)
                {
                    // throw new NotSupportedException();
                }
                else
                {
                    return; // invalid data source
                }

                if (binWidth != null)
                {
                    this.histogram.Compute(samples, binWidth.Value);
                }
                else if (numberOfBins != null)
                {
                    this.histogram.Compute(samples, numberOfBins.Value);
                }
                else
                {
                    this.histogram.Compute(samples);
                }
            }
            else
            {
                this.histogram = source;
            }

            this.UpdateTrackbar();
            this.UpdateGraph();

            if (histogram.Bins.Count > 0 &&
                histogram.Bins.Count < trackBar.Maximum)
            {
                trackBar.Value = histogram.Bins.Count;
            }
        }
Exemple #4
0
 /// <summary>
 ///   Adds one histogram from the other, storing
 ///   results in a new histogram, without changing the
 ///   current instance.
 /// </summary>
 ///
 /// <param name="histogram">The histogram whose bin values will be added.</param>
 ///
 /// <returns>A new <see cref="Histogram"/> containing the result of this operation.</returns>
 ///
 public Histogram Add(Histogram histogram)
 {
     return(Add(histogram.Values));
 }
Exemple #5
0
 /// <summary>
 ///   Subtracts one histogram from the other, storing
 ///   results in a new histogram, without changing the
 ///   current instance.
 /// </summary>
 ///
 /// <param name="histogram">The histogram whose bin values will be subtracted.</param>
 ///
 /// <returns>A new <see cref="Histogram"/> containing the result of this operation.</returns>
 ///
 public Histogram Subtract(Histogram histogram)
 {
     return(Subtract(histogram.Values));
 }
Exemple #6
0
 internal HistogramBin(Histogram histogram, int index)
 {
     this.index     = index;
     this.histogram = histogram;
 }