Exemplo n.º 1
0
        /// <summary>
        /// Update the <see cref="chart_filters"/> to reflect the gains of the filters.
        /// </summary>
        /// <seealso cref="UpdateAll"/>
        private void UpdateEqualizerGraph()
        {
            //
            // update the series
            //

            // get the list of filters
            SortedList <double, Filter> filters = eqAPI.GetFilters();

            // update the equalizer series
            chart_filters.Series.Clear();
            System.Windows.Forms.DataVisualization.Charting.Series series =
                chart_filters.Series.Add("frequencies");
            foreach (System.Collections.Generic.KeyValuePair <double, Filter> pair in filters)
            {
                Filter filter = pair.Value;
                series.Points.Add(filter.Gain);
            }

            //
            // change the equalizer graph visually
            //

            // make it a line graph instead of bar graph
            series.ChartType =
                System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;

            // set the range of the axis
            double gainMax = equalizerapo_api.GAIN_MAX;

            System.Windows.Forms.DataVisualization.Charting.Axis yaxis =
                chart_filters.ChartAreas["ChartArea1"].AxisY;
            System.Windows.Forms.DataVisualization.Charting.Axis xaxis =
                chart_filters.ChartAreas["ChartArea1"].AxisX;
            yaxis.Interval = gainMax / 3;
            yaxis.Minimum  = -gainMax;
            yaxis.Maximum  = gainMax;
            xaxis.Minimum  = 1;
            xaxis.Maximum  = filters.Count;

            // make grid lines lighter
            xaxis.MajorGrid.LineColor = Color.LightGray;
            yaxis.MajorGrid.LineColor = Color.LightGray;

            // make graph easier to see
            series.BorderWidth = 3;
        }
Exemplo n.º 2
0
        void ChartAreas(RootObject root)
        {
            var axisX = new System.Windows.Forms.DataVisualization.Charting.Axis
            {
                Interval = 30,
                Title    = "Minutes Since Day Open",
            };

            var axisY = new System.Windows.Forms.DataVisualization.Charting.Axis
            {
                Minimum = root.ranges.close.min,
                Maximum = root.ranges.close.max,
                Title   = "Stock Price",
            };

            var chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea
            {
                AxisX = axisX,
                AxisY = axisY,
            };

            this.chart1.ChartAreas.Add(chartArea1);
        }
Exemplo n.º 3
0
        private void Set_Plot_Axes(string min, string max, System.Windows.Forms.DataVisualization.Charting.Axis axis)
        {
            double min_val, max_val;

            if (min != "")
            {
                if (!double.TryParse(min, out min_val))
                {
                    MessageBox.Show("Error - " + min + " is not a valid format for axis plotting");
                }
                else
                {
                    axis.Minimum = min_val;
                }
            }
            else
            {
                axis.Minimum = double.NaN;
            }

            if (max != "")
            {
                if (!double.TryParse(max, out max_val))
                {
                    MessageBox.Show("Error - " + max + " is not a valid format for axis plotting");
                }
                else
                {
                    axis.Maximum = max_val;
                }
            }
            else
            {
                axis.Maximum = double.NaN;
            }
        }
Exemplo n.º 4
0
        private void ChartAreas()
        {
            var axisX = new System.Windows.Forms.DataVisualization.Charting.Axis
            {
                Interval = 1,
            };

            double min = double.MaxValue;
            double max = 0;

            if (points.Count > 0)
            {
                //min = (int)points.Min();
                //max = (int)points.Max();
            }

            min = -0.1;
            max = 0.1;

            foreach (snapShot s in snapShots)
            {
                foreach (coinData c in s.coins)
                {
                    if (c.fiveMin > max)
                    {
                        max = Math.Round((double)c.fiveMin, 2);
                    }

                    if (c.fiveMin < min && c.fiveMin > 0)
                    {
                        min = Math.Round((double)c.fiveMin, 2);
                    }
                }
            }

            //min = -1;
            //max = 1;

            var axisY = new System.Windows.Forms.DataVisualization.Charting.Axis
            {
                Minimum = min,
                Maximum = max,
                Title   = "% gain BTC",
            };

            var chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea
            {
                AxisX = axisX,
                AxisY = axisY,
            };

            chartArea1.AxisX.LabelStyle.Format = "dd/MMM\nhh:mm";
            //chartArea1.AxisX.LabelStyle.Format = "hh:mm";


            chartArea1.AxisX.MajorGrid.Enabled  = false;
            chartArea1.AxisY.MajorGrid.Enabled  = false;
            chartArea1.AxisX.LabelStyle.Enabled = false;

            this.chart1.ChartAreas.Clear();
            this.chart1.ChartAreas.Add(chartArea1);
        }