1 // 2 // Authors: 3 // Jonathan Pobst (monkey@jpobst.com) 4 // Francis Fisher (frankie@terrorise.me.uk) 5 // 6 // Copyright (C) 2009 Novell, Inc (http://www.novell.com) 7 // 8 // Permission is hereby granted, free of charge, to any person obtaining 9 // a copy of this software and associated documentation files (the 10 // "Software"), to deal in the Software without restriction, including 11 // without limitation the rights to use, copy, modify, merge, publish, 12 // distribute, sublicense, and/or sell copies of the Software, and to 13 // permit persons to whom the Software is furnished to do so, subject to 14 // the following conditions: 15 // 16 // The above copyright notice and this permission notice shall be 17 // included in all copies or substantial portions of the Software. 18 // 19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 27 using System; 28 using System.Drawing; 29 using System.Drawing.Imaging; 30 using System.IO; 31 using System.ComponentModel; 32 using System.Data.Common; 33 34 namespace System.Windows.Forms.DataVisualization.Charting 35 { 36 public class Chart : Control, ISupportInitialize, IDisposable 37 { Chart()38 public Chart () 39 { 40 BackColor = Color.White; 41 ChartAreas = new ChartAreaCollection (); 42 Series = new SeriesCollection (); 43 } 44 public AnnotationCollection Annotations { get; private set;} 45 public AntiAliasingStyles AntiAliasing { get; set; } 46 public override Color BackColor { get; set; } 47 public GradientStyle BackGradientStyle { get; set; } 48 public override Image BackgroundImage { get; set; } 49 public ChartHatchStyle BackHatchStyle { get; set; } 50 public string BackImage { get; set; } 51 public ChartImageAlignmentStyle BackImageAlignment { get; set; } 52 public Color BackImageTransparentColor { get; set; } 53 public ChartImageWrapMode BackImageWrapMode { get; set; } 54 public Color BackSecondaryColor { get; set; } 55 public Color BorderColor { get; set; } 56 public ChartDashStyle BorderDashStyle { get; set; } 57 public Color BorderlineColor { get; set; } 58 public ChartDashStyle BorderlineDashStyle { get; set; } 59 public int BorderlineWidth { get; set; } 60 public BorderSkin BorderSkin { get; set; } 61 public int BorderWidth { get; set; } 62 public string BuildNumber { get; private set;} 63 public ChartAreaCollection ChartAreas { get; private set; } 64 public DataManipulator DataManipulator { get; private set;} 65 public Object DataSource { get; set; } 66 protected override Size DefaultSize { get { return base.DefaultSize; } }//FIXME 67 public override Color ForeColor { get; set; } 68 public NamedImagesCollection Images { get; private set;} 69 public bool IsSoftShadows { get; set; } 70 public LegendCollection Legends { get; private set; } 71 public ChartColorPalette Palette { get; set; } 72 public Color[] PaletteCustomColors { get; set; } 73 public PrintingManager Printing { get; private set;} 74 public double RenderingDpiX { get; set; } 75 public double RenderingDpiY { get; set; } 76 public ChartSerializer Serializer { get; private set; } 77 public SeriesCollection Series { get; private set; } 78 public bool SuppressExceptions { get; set; } 79 public TextAntiAliasingQuality TextAntiAliasingQuality { get; set; } 80 public TitleCollection Titles { get; private set;} 81 82 #region Protected Properties OnPaint(PaintEventArgs e)83 protected override void OnPaint (PaintEventArgs e) 84 { 85 base.OnPaint (e); 86 87 ChartGraphics g = new ChartGraphics (e.Graphics); 88 89 PaintElement (g, this, new ElementPosition (0, 0, 100, 100)); 90 91 foreach (var area in ChartAreas) 92 PaintElement (g, area, new ElementPosition (9.299009f, 6.15f, 86.12599f, 81.1875f)); 93 94 foreach (var series in Series) 95 PaintElement (g, series, new ElementPosition (9.299009f, 6.15f, 86.12599f, 81.1875f)); 96 } 97 OnPaintBackground(PaintEventArgs pevent)98 protected override void OnPaintBackground (PaintEventArgs pevent) 99 { 100 base.OnPaintBackground (pevent); 101 } 102 OnPostPaint(ChartPaintEventArgs e)103 protected virtual void OnPostPaint (ChartPaintEventArgs e) 104 { 105 } 106 OnPrePaint(ChartPaintEventArgs e)107 protected virtual void OnPrePaint (ChartPaintEventArgs e) 108 { 109 } 110 #endregion 111 112 113 114 public event EventHandler AnnotationPlaced; 115 public event EventHandler AnnotationPositionChanged; 116 public event EventHandler<AnnotationPositionChangingEventArgs> AnnotationPositionChanging; 117 public event EventHandler AnnotationSelectionChanged; 118 public event EventHandler AnnotationTextChanged; 119 public event EventHandler<ScrollBarEventArgs> AxisScrollBarClicked; 120 public event EventHandler<ViewEventArgs> AxisViewChanged; 121 public event EventHandler<ViewEventArgs> AxisViewChanging; 122 public event EventHandler<CursorEventArgs> CursorPositionChanged; 123 public event EventHandler<CursorEventArgs> CursorPositionChanging; 124 public event EventHandler Customize; 125 public event EventHandler<CustomizeLegendEventArgs> CustomizeLegend; 126 public event EventHandler<FormatNumberEventArgs> FormatNumber; 127 public event EventHandler<ToolTipEventArgs> GetToolTipText; 128 public event EventHandler<ChartPaintEventArgs> PostPaint; 129 public event EventHandler<ChartPaintEventArgs> PrePaint; 130 public event EventHandler<CursorEventArgs> SelectionRangeChanged; 131 public event EventHandler<CursorEventArgs> SelectionRangeChanging; 132 133 134 #region Public Methods 135 136 [MonoTODO] AlignDataPointsByAxisLabel()137 public void AlignDataPointsByAxisLabel () 138 { 139 throw new NotImplementedException (); 140 } 141 [MonoTODO] AlignDataPointsByAxisLabel(PointSortOrder sortingOrder)142 public void AlignDataPointsByAxisLabel (PointSortOrder sortingOrder) 143 { 144 throw new NotImplementedException (); 145 } 146 [MonoTODO] AlignDataPointsByAxisLabel(string series)147 public void AlignDataPointsByAxisLabel(string series) 148 { 149 throw new NotImplementedException (); 150 } 151 [MonoTODO] AlignDataPointsByAxisLabel(string series, PointSortOrder sortingOrder)152 public void AlignDataPointsByAxisLabel (string series, PointSortOrder sortingOrder) 153 { 154 throw new NotImplementedException (); 155 } 156 157 [MonoTODO] ApplyPaletteColors()158 public void ApplyPaletteColors () 159 { 160 throw new NotImplementedException (); 161 } 162 163 [MonoTODO] BeginInit()164 public void BeginInit () 165 { 166 throw new NotImplementedException (); 167 } 168 169 [MonoTODO] DataBind()170 public void DataBind () 171 { 172 throw new NotImplementedException (); 173 } 174 175 [MonoTODO] DataBindCrossTable(System.Collections.IEnumerable dataSource, string seriesGroupByField, string xField, string yFields, string otherFields)176 public void DataBindCrossTable (System.Collections.IEnumerable dataSource, string seriesGroupByField, string xField, string yFields, string otherFields) 177 { 178 throw new NotImplementedException (); 179 } 180 [MonoTODO] DataBindCrossTable(System.Collections.IEnumerable dataSource, string seriesGroupByField, string xField, string yFields, string otherFields, PointSortOrder sortingOrder)181 public void DataBindCrossTable (System.Collections.IEnumerable dataSource, string seriesGroupByField, string xField, string yFields, string otherFields, PointSortOrder sortingOrder) 182 { 183 throw new NotImplementedException (); 184 } 185 186 [MonoTODO] DataBindTable(System.Collections.IEnumerable dataSource)187 public void DataBindTable (System.Collections.IEnumerable dataSource) 188 { 189 throw new NotImplementedException (); 190 } 191 [MonoTODO] DataBindTable(System.Collections.IEnumerable dataSource, string xField)192 public void DataBindTable (System.Collections.IEnumerable dataSource, string xField) 193 { 194 throw new NotImplementedException (); 195 } 196 197 [MonoTODO] EndInit()198 public void EndInit () 199 { 200 throw new NotImplementedException (); 201 } 202 203 [MonoTODO] HitTest(int x, int y)204 public HitTestResult HitTest (int x, int y) 205 { 206 throw new NotImplementedException (); 207 } 208 209 [MonoTODO] HitTest(int x, int y, bool ignoreTransparent)210 public HitTestResult HitTest (int x, int y, bool ignoreTransparent) 211 { 212 throw new NotImplementedException (); 213 } 214 [MonoTODO] HitTest(int x, int y, ChartElementType requestedElement)215 public HitTestResult HitTest (int x, int y, ChartElementType requestedElement) 216 { 217 throw new NotImplementedException (); 218 } 219 220 [MonoTODO] HitTest(int x, int y, bool ignoreTransparent, params ChartElementType[] requestedElement)221 public HitTestResult[] HitTest (int x, int y, bool ignoreTransparent, params ChartElementType[] requestedElement) 222 { 223 throw new NotImplementedException (); 224 } 225 226 [MonoTODO] LoadTemplate(Stream stream)227 public void LoadTemplate (Stream stream) 228 { 229 throw new NotImplementedException (); 230 } 231 232 [MonoTODO] LoadTemplate(string name)233 public void LoadTemplate (string name) 234 { 235 throw new NotImplementedException (); 236 } 237 238 [MonoTODO] ResetAutoValues()239 public void ResetAutoValues () 240 { 241 throw new NotImplementedException (); 242 } 243 244 [MonoTODO] SaveImage(Stream imageStream, ImageFormat format)245 public void SaveImage (Stream imageStream, ImageFormat format) 246 { 247 throw new NotImplementedException (); 248 } 249 [MonoTODO] SaveImage(Stream imageStream, ChartImageFormat format)250 public void SaveImage (Stream imageStream, ChartImageFormat format) 251 { 252 throw new NotImplementedException (); 253 } 254 [MonoTODO] SaveImage(string imageFileName, ImageFormat format)255 public void SaveImage (string imageFileName, ImageFormat format) 256 { 257 throw new NotImplementedException (); 258 } 259 [MonoTODO] SaveImage(string imageFileName, ChartImageFormat format)260 public void SaveImage (string imageFileName, ChartImageFormat format) 261 { 262 throw new NotImplementedException (); 263 } 264 #endregion 265 266 #region Protected Methods 267 268 Dispose(bool disposing)269 protected override void Dispose (bool disposing) 270 { 271 } 272 273 274 275 #endregion 276 277 #region Private Methods PaintElement(ChartGraphics g, object element, ElementPosition position)278 private void PaintElement (ChartGraphics g, object element, ElementPosition position) 279 { 280 ChartPaintEventArgs e = new ChartPaintEventArgs (this, element, g, position); 281 282 OnPrePaint (e); 283 OnPostPaint (e); 284 } 285 #endregion 286 } 287 } 288