예제 #1
0
            public static void ColorUpdate(ChartLine line)
            {
                if (line.color == Brushes.Lime || line.color == Brushes.Red)
                {
                    bool upLine = line.getP1().X > line.getP2().X ?
                                  line.getP1().Y <line.getP2().Y : line.getP1().Y> line.getP2().Y;

                    if (upLine)
                    {
                        line.color = line.linePath.Stroke = Brushes.Lime;
                    }
                    else
                    {
                        line.color = line.linePath.Stroke = Brushes.Red;
                    }
                }
            }
예제 #2
0
        public static bool LineValueOnSdd(ChartLine line, Data.SymbolDayData sdd)
        {
            DrawingInfo di = line.GetDrawingInfo();

            double PDR = DateToPixel(di, sdd.Date, 0);

            double PVRLO = Math.Round(RemapRangeValToPix(sdd.Low, di), 6);
            double PVRHI = Math.Round(RemapRangeValToPix(sdd.Hi, di), 6);

            Point pLO = new Point(PDR, PVRLO);
            Point pHI = new Point(PDR, PVRHI);

            return(DoIntersect(line.getP1(), line.getP2(), pLO, pHI));
        }
예제 #3
0
        public void AddLoadedChartLines(Dictionary <string, DataToSerialize> symbolsDrawingsToSerialize, string name)
        {
            // add loaded chart lines
            foreach (var data in symbolsDrawingsToSerialize)
            {
                if (data.Key == name)
                {
                    // found drawing for symbol
                    foreach (var line in data.Value.chartLines)
                    {
                        ChartLine lineToAdd = new ChartLine(this);

                        // Create and add new points
                        lineToAdd.setP1(Misc.LineStringToPoint(drawingInfo, line.StartPointDV));
                        lineToAdd.setP2(Misc.LineStringToPoint(drawingInfo, line.EndPointDV));

                        lineToAdd.color           = Misc.StringToBrush(line.Color);
                        lineToAdd.linePath.Stroke = lineToAdd.color;

                        // default layer is L1
                        lineToAdd.layerData = line.Data;
                        if (line.Data == null)
                        {
                            lineToAdd.layerData = "L1";
                        }
                        if (line.Data == "")
                        {
                            lineToAdd.layerData = "L1";
                        }
                        if (lineToAdd.layerData.Contains("L1") == false)
                        {
                            lineToAdd.linePath.Visibility = Visibility.Hidden;
                        }

                        lineToAdd.mode        = ChartLine.Mode.Normal;
                        lineToAdd.drawingMode = ChartLine.DrawingMode.Invalid;
                        lineToAdd.Select(false);

                        chartLines.Add(lineToAdd);
                        canvas.Children.Add(lineToAdd.linePath);
                        canvas.Children.Add(lineToAdd.rectPath);

                        lineToAdd.MoveP1(lineToAdd.getP1());
                        lineToAdd.MoveP2(lineToAdd.getP2());
                    }
                    break;
                }
            }
        }