Beispiel #1
0
 public void RedrawStockPane()
 {
     if (StockPane == null)
     {
         return;
     }
     StockPane.Draw(CreateGraphics());
 }
Beispiel #2
0
        public string GetTipText(int x, int y)
        {
            var clientPoint = PointToScreen(new Point(x, y));

            clientPoint = StockPane.PointToClient(clientPoint);

            var pointD = Conversion.ScreenToWorld(new PointD(clientPoint.X, clientPoint.Y),
                                                  StockPane.WorldRect, StockPane.CanvasRect);

            var index = (int)(pointD.X + 0.5);

            if (index < 0 || index >= (StockSeries.Data.Count + RightBars))
            {
                return(string.Empty);
            }

            var tipText = new StringBuilder();

            if (index < StockSeries.Data.Count)
            {
                tipText.AppendLine(string.Format(
                                       "Свеча[{0}]:\n{1:dd/MM/yyyy HH:mm}\nopen {2}\nhigh {3}\nlow {4}\nclose {5}",
                                       index, StockSeries.Data[index].timeOpen,
                                       StockSeries.Data[index].open.ToStringUniformPriceFormat(true),
                                       StockSeries.Data[index].high.ToStringUniformPriceFormat(true),
                                       StockSeries.Data[index].low.ToStringUniformPriceFormat(true),
                                       StockSeries.Data[index].close.ToStringUniformPriceFormat(true)));
            }
            foreach (var indicator in Owner.indicators)
            {
                try
                {
                    tipText.AppendLine(indicator.GetHint(x, y, index, pointD.Y, CandleChartControl.MouseHitTolerancePix));
                }
                catch
                {
                }
            }
            return(tipText.ToString());
        }