示例#1
0
        public void AddBarList(IEnumerable <Bar> bars)
        {
            foreach (var bar in bars)
            {
                m_Stock.OpenValues.Add(bar.Open);
                m_Stock.HighValues.Add(bar.Open);
                m_Stock.LowValues.Add(bar.Open);
                m_Stock.CloseValues.Add(bar.Open);

                m_Stock.XValues.Add(bar.DateTime);
            }
            chart.Refresh();
        }
示例#2
0
            /// <summary>
            /// Overriden to perform dragging
            /// </summary>
            /// <param name=`$:7` ></param>
            /// <param name=`$:8` ></param>
            public override void OnDoDrag(object sender, NMouseEventArgs e)
            {
                NChart chart = this.GetDocument().Charts[0];
                NViewToScale2DTransformation viewToScale = new NViewToScale2DTransformation(this.GetChartControlView().Context, chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY);

                NVector2DD pointScale = new NVector2DD();

                if (viewToScale.Transform(new NPointF(e.X, e.Y), ref pointScale))
                {
                    // clamp y value to ruler range
                    double yValue = chart.Axis(StandardAxis.PrimaryX).Scale.RulerRange.GetValueInRange(pointScale.X);
                    m_ConstLine.Value = yValue;

                    chart.Refresh();
                    Repaint();
                }
            }