Exemple #1
0
 internal ChartPaneMouseEventArgs( MouseEventType type,
                                   TimeSeriesChart chart,
                                   PlotPane pane,
                                   MouseEventArgs mouse,
                                   ITimeSeriesSample sample,
                                   float value)
 {
   this.EventType = type;
   this.Chart = chart;
   this.Pane = pane;
   this.MouseEvent = mouse;
   this.SampleAtX = sample;
   this.ValueAtY = value;
 }
Exemple #2
0
     internal PlotPane(TimeSeriesChart chart, string paneName, int paneOrder ) : base()
     {              
       m_Chart = chart;
       base.Name = paneName;
       this.m_Order = paneOrder;


       //for(var x=0; x<1600; x+= 48)
       //  for(var y=0; y<1800; y+= 16)
       //  {
       //  var elm =  new CheckBoxElement(this);// new TextLabelElement(this);
       //  elm.Region = new Rectangle(x,y, 46, 14);
       // // elm.Text = "Cell " + x+"x"+y;
       //  elm.Visible = true;
       //  }
     }
Exemple #3
0
        internal PlotPane(TimeSeriesChart chart, string paneName, int paneOrder)
            : base()
        {
            m_Chart = chart;
              base.Name = paneName;
              this.m_Order = paneOrder;

              using (var gr = CreateGraphics())
              {
            var fSize = gr.MeasureString("0.00000", m_Chart.RulerStyle.Font); //margin
            m_VLineSpaceHeight = (int)Math.Round(fSize.Height) + VLINE_SPACE_PADDING;
              }

              //for(var x=0; x<1600; x+= 48)
              //  for(var y=0; y<1800; y+= 16)
              //  {
              //  var elm =  new CheckBoxElement(this);// new TextLabelElement(this);
              //  elm.Region = new Rectangle(x,y, 46, 14);
              // // elm.Text = "Cell " + x+"x"+y;
              //  elm.Visible = true;
              //  }
        }
Exemple #4
0
 protected override Elements.Element MakeSampleElement(TimeSeriesChart chart, PlotPane pane, CandleSample sample, int x, float minScale, float maxScale)
 {
   return new CandleBuySellElement(this, pane, sample, x, minScale, maxScale);
 }
Exemple #5
0
 internal TimeScalePane(TimeSeriesChart chart)
 {
     m_Chart      = chart;
       m_TimeCursor = new TimeCursorElement(this);
       TickSpace    = DEFAULT_TICK_SPACE;
 }
Exemple #6
0
      protected override Element MakeSeriesElement(TimeSeriesChart chart,
                                                   PlotPane pane, 
                                                   IEnumerable<CandleSample> data,
                                                   int xStart, 
                                                   float minScale,
                                                   float maxScale,
                                                   int maxSampleWidth,
                                                   out int fitSamplesCount)
      {
        var points = new List<Point>();
       

        var pxTotalHeight = (int)(pane.Height / pane.Zoom);
        var pxPrice = (float)pxTotalHeight / (maxScale - minScale);

        fitSamplesCount = 0;
        var x = xStart+(maxSampleWidth / 2);
        var xcutof = chart.VRulerPosition == VRulerPosition.Right ? pane.Width - 1 - chart.VRulerWidth : pane.Width;
        foreach(var candle in data)
        {
          var midPrice =  MidLineType==Temporal.MidLineType.HighLow ? 
                       (candle.LowPrice + ((candle.HighPrice - candle.LowPrice) / 2f)) :
                       (Math.Min(candle.OpenPrice, candle.ClosePrice) + (Math.Abs(candle.OpenPrice - candle.ClosePrice) / 2f));
          
          
          var y = pxTotalHeight - (int)((midPrice-minScale) * pxPrice);
          points.Add( new Point(x, y));

          
          x += maxSampleWidth;
          x++;
          if ((x*pane.Zoom)>=xcutof) break;
          fitSamplesCount++;
        }

        return new CandleMidLineElement(this, pane, points.ToArray());
      }
Exemple #7
0
 protected override Elements.Element MakeSampleElement(TimeSeriesChart chart, PlotPane pane, CandleSample sample, int x, float minScale, float maxScale)
 {
   return null;
 }
Exemple #8
0
        /// <summary>
        /// Returns how many samples fit
        /// </summary>
        internal int BuildViews(TimeSeriesChart chart, int maxSampleWidth)
        {
            var fitSamples = 0;
              foreach(var view in m_Views.OrderedValues.Where( v => v.Visible))
              {
            var pane = chart.Panes[view.PaneName];
            if (pane==null)
             throw new WFormsException("Pane '{0}' not found in chart".Args(view.PaneName));

            var fit = view.BuildElements(chart, pane, this, maxSampleWidth);
            if (fit>fitSamples)
             fitSamples = fit;
              }

              foreach(var child in m_Children.OrderedValues.Where( c => c.Visible))
               child.BuildViews(chart, maxSampleWidth);

              return fitSamples;
        }
Exemple #9
0
 /// <summary>
 /// Override to build elements that render the data by adding drawable elements to the chart.
 /// Returns how many samples could fit
 /// </summary>
 public abstract int BuildElements(TimeSeriesChart chart, PlotPane pane, TimeSeries series, int maxSampleWidth);
Exemple #10
0
 protected override Elements.Element MakeSampleElement(TimeSeriesChart chart, PlotPane pane, CandleSample sample, int x, float minScale, float maxScale)
 {
     return(null);
 }
Exemple #11
0
 internal TimeScalePane(TimeSeriesChart chart)
 {
     m_Chart      = chart;
     m_TimeCursor = new TimeCursorElement(this);
     TickSpace    = DEFAULT_TICK_SPACE;
 }
Exemple #12
0
 /// <summary>
 /// Override to build elements that render the data by adding drawable elements to the chart.
 /// Returns how many samples could fit
 /// </summary>
 public abstract int BuildElements(TimeSeriesChart chart, PlotPane pane, TimeSeries series, int maxSampleWidth);
Exemple #13
0
 internal TimeScalePane(TimeSeriesChart chart) : base()
 {              
   m_Chart = chart;
   m_TimeCursor = new TimeCursorElement(this);
 }
Exemple #14
0
 protected override Elements.Element MakeSampleElement(TimeSeriesChart chart, PlotPane pane, CandleSample sample, int x, float minScale, float maxScale)
 {
     return(new CandleBuySellElement(this, pane, sample, x, minScale, maxScale));
 }