Esempio n. 1
0
        private void UpdateDynamicStick()
        {
            if (_clean == false)
            {
                var cleanchart = new XmlForCandleSticks();
                cleanchart.CleanElement();
                _clean = true;
            }
            if (this._highValue == -1 && _lowValue == -1)
            {
                _highValue = double.Parse(_ticker.Buy.ToString());
                _lowValue = double.Parse(_ticker.Buy.ToString());
                _startValue = double.Parse(_ticker.Buy.ToString());
                _endValue = double.Parse(_ticker.Buy.ToString());
            }
            if (this._highest == -1 && _lowest == -1)
            {
                _highest = double.Parse(_ticker.Buy.ToString());
                _lowest = double.Parse(_ticker.Buy.ToString());
            }
            if (updateHigh(double.Parse(_ticker.Buy.ToString())))
            {
                this._highValue = double.Parse(_ticker.Buy.ToString());
            }
            if (updateLow(double.Parse(_ticker.Buy.ToString())))
            {
                this._lowValue = double.Parse(_ticker.Buy.ToString());
            }
            this._endValue = double.Parse(_ticker.Buy.ToString());

            var chart = new XmlForCandleSticks();
            try
            {
                priceChart.ChartAreas[0].AxisY.Minimum = _lowest - 0.5;
                priceChart.ChartAreas[0].AxisY.Maximum = _highest + 0.5;
                try
                {
                    priceChart.Series["price"].Points[29].SetValueXY(DateTime.Now.ToString("HH:mm:ss tt"), _highValue);
                    priceChart.Series["price"].Points[29].YValues[1] = _lowValue;
                    priceChart.Series["price"].Points[29].YValues[3] = _endValue;
                }
                catch (Exception)
                {
                    for (int count = 0; count < 29; count++)
                    {
                        priceChart.Series["price"].Points.AddXY("00:00:00 AM", 0);
                        priceChart.Series["price"].Points[count].YValues[1] = 0;
                        priceChart.Series["price"].Points[count].YValues[2] = 0;
                        priceChart.Series["price"].Points[count].YValues[3] = 0;
                    }
                    priceChart.Series["price"].Points.AddXY(DateTime.Now.ToString("HH:mm:ss tt"), double.Parse(_ticker.Buy.ToString()));
                    priceChart.Series["price"].Points[29].YValues[1] = double.Parse(_ticker.Buy.ToString());
                    priceChart.Series["price"].Points[29].YValues[2] = double.Parse(_ticker.Buy.ToString());
                    priceChart.Series["price"].Points[29].YValues[3] = double.Parse(_ticker.Buy.ToString());
                }
            }
            catch (Exception) {}
        }