コード例 #1
0
ファイル: SketchPad.cs プロジェクト: philllies/finalproject
        public void DrawIndex(TimeSeries index)
        {
            var ts = new TimeSeries();
            ts.Values.Add(0.5f);
            ts.Values.Add(0.5f);
            Rect offset = _xyAxis.Stroq.BoundingRect.Clone();
            Stroq stroq = ts.ToStroq(offset, false);
            stroq.Color = Colors.Salmon;
            _stroqs.Add(stroq);

            Redraw();
        }
コード例 #2
0
ファイル: SketchPad.cs プロジェクト: philllies/finalproject
        public void DrawStock(TimeSeries timeSeriesData, TimeSeries ts, double start, double end)
        {
            Clear();

            int lx = 230;
            int ly = 120;
            var rect = new Rect((ActualWidth - lx)/2, (ActualHeight - ly)/2 - 50, lx, ly);
            _xyAxis = new XyAxis(rect);

            double stockMin = ts.Values.Min();
            double stockMax = ts.Values.Max();

            var ampDelta = (decimal) (stockMax - stockMin);
            int timeDelta = ts.Values.Count;
            _axisAnnotations[XyAxisLabelPosition.X_Center] = timeDelta.ToString();

            IList<Stroq> ampDeltaStroqs = _letters.StringToStroqs(ampDelta + "M", 10);
            IList<Stroq> timeDeltaStroqs = _letters.StringToStroqs(timeDelta.ToString(), 10);

            Point ampDeltaCoords = _xyAxis.GetLabelCoords(XyAxisLabelPosition.Y_Center);
            ampDeltaCoords.X -= 20;
            Point timeDeltaCoords = _xyAxis.GetLabelCoords(XyAxisLabelPosition.X_Center);
            timeDeltaCoords.X += 15;
            timeDeltaCoords.Y += 10;


            _stroqs.Add(_xyAxis.Stroq);
            ts = ts.GetNormalized();
            ts.Resample(80);
            Stroq s = ts.ToStroq(rect);
            _queryStroqs.Add(s);
            _stroqs.Add(s);

            foreach (Stroq stroq in timeDeltaStroqs)
            {
                stroq.Translate(timeDeltaCoords);
                _stroqs.Add(stroq);
            }

            Redraw();
        }