00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 using System;
00053 using System.Drawing;
00054
00055 namespace NPlot
00056 {
00057
00061 public class PointPlot : BaseSequencePlot, ISequencePlot, IPlot
00062 {
00063 private Marker marker_;
00064
00068 public PointPlot()
00069 {
00070 marker_ = new Marker();
00071 }
00072
00077 public PointPlot( Marker marker )
00078 {
00079 marker_ = marker;
00080 }
00081
00082
00089 public virtual void Draw( Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis )
00090 {
00091 SequenceAdapter data_ =
00092 new SequenceAdapter( this.DataSource, this.DataMember, this.OrdinateData, this.AbscissaData );
00093
00094 for (int i=0; i<data_.Count; ++i)
00095 {
00096 if ( !Double.IsNaN(data_[i].X) && !Double.IsNaN(data_[i].Y) )
00097 {
00098 PointF xPos = xAxis.WorldToPhysical( data_[i].X, false);
00099 PointF yPos = yAxis.WorldToPhysical( data_[i].Y, false);
00100 marker_.Draw( g, (int)xPos.X, (int)yPos.Y );
00101 if (marker_.DropLine)
00102 {
00103 PointD yMin = new PointD( data_[i].X, Math.Max( 0.0f, yAxis.Axis.WorldMin ) );
00104 PointF yStart = yAxis.WorldToPhysical( yMin.Y, false );
00105 g.DrawLine( marker_.Pen, new Point((int)xPos.X,(int)yStart.Y), new Point((int)xPos.X,(int)yPos.Y) );
00106 }
00107 }
00108 }
00109 }
00110
00111
00116 public Axis SuggestXAxis()
00117 {
00118 SequenceAdapter data_ =
00119 new SequenceAdapter( this.DataSource, this.DataMember, this.OrdinateData, this.AbscissaData );
00120
00121 return data_.SuggestXAxis();
00122 }
00123
00124
00129 public Axis SuggestYAxis()
00130 {
00131 SequenceAdapter data_ =
00132 new SequenceAdapter( this.DataSource, this.DataMember, this.OrdinateData, this.AbscissaData );
00133
00134 return data_.SuggestYAxis();
00135 }
00136
00137
00143 public void DrawInLegend( Graphics g, Rectangle startEnd )
00144 {
00145 marker_.Draw( g, (startEnd.Left+startEnd.Right)/2, (startEnd.Top + startEnd.Bottom)/2 );
00146 }
00147
00148
00152 public Marker Marker
00153 {
00154 set
00155 {
00156 marker_ = value;
00157 }
00158 get
00159 {
00160 return marker_;
00161 }
00162 }
00163
00164
00165
00166 }
00167 }