private void _updateCandleSize(ChartZoomEventArgs obj = null)
        {
            int zoom = (obj == null) ? Chart.ZoomLevel : obj.Chart.ZoomLevel;

            if (zoom <= 5)
            {
                CandleWidth = 1;
                WickWidth   = 1;
            }
            else if (zoom <= 10)
            {
                CandleWidth = 2;
                WickWidth   = 1;
            }
            else if (zoom <= 30)
            {
                CandleWidth = 3;
                WickWidth   = 1;
            }
            else if (zoom <= 40)
            {
                CandleWidth = 5;
                WickWidth   = 2;
            }
            else if (zoom <= 60)
            {
                CandleWidth = 7;
                WickWidth   = 2;
            }
            else if (zoom <= 75)
            {
                CandleWidth = 9;
                WickWidth   = 2;
            }
            else if (zoom <= 90)
            {
                CandleWidth = 11;
                WickWidth   = 3;
            }
            else if (zoom <= 105)
            {
                CandleWidth = 13;
                WickWidth   = 3;
            }
            else if (zoom <= 120)
            {
                CandleWidth = 15;
                WickWidth   = 3;
            }
            else if (zoom <= 150)
            {
                CandleWidth = 19;
                WickWidth   = 4;
            }
            else
            {
                CandleWidth = 0;
                WickWidth   = 0;
            }
        }
        private void chartControl1_Zoom(object sender, ChartZoomEventArgs e)
        {
            ChartControl chart   = (ChartControl)sender;
            XYDiagram    diagram = (XYDiagram)chart.Diagram;

            diagram.SecondaryAxesY[0].VisualRange.SetMinMaxValues(Convert.ToDouble(e.NewYRange.MinValue) / 2,
                                                                  Convert.ToDouble(e.NewYRange.MaxValue));
        }
        private void _repaint(ChartZoomEventArgs obj = null)
        {
            _updateCandleSize(obj);

            for (int i = 0; i < Bars.Count - 1; i++)
            {
                Calculate(i);
            }
        }
Exemplo n.º 4
0
        private void chartControl1_Zoom(object sender, ChartZoomEventArgs e)
        {
            ChartControl chart = sender as ChartControl;

            ReDrawAxisY(chart, e.NewXRange);
        }