Free cookie consent management tool by TermsFeed Policy Generator

source: branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableView.cs @ 6012

Last change on this file since 6012 was 6012, checked in by abeham, 12 years ago

#1465

  • fine tuned UI for setting data(table|row) visual properties
  • added control for the data table visual properties
  • added a few more visual properties
File size: 23.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Drawing;
25using System.Linq;
26using System.Windows.Forms;
27using System.Windows.Forms.DataVisualization.Charting;
28using HeuristicLab.Collections;
29using HeuristicLab.Core.Views;
30using HeuristicLab.MainForm;
31
32namespace HeuristicLab.Analysis.Views {
33  /// <summary>
34  /// The visual representation of a <see cref="Variable"/>.
35  /// </summary>
36  [View("DataTable View")]
37  [Content(typeof(DataTable), true)]
38  public partial class DataTableView : NamedItemView {
39    protected List<Series> invisibleSeries;
40    protected Dictionary<IObservableList<double>, DataRow> valuesRowsTable;
41    /// <summary>
42    /// Gets or sets the variable to represent visually.
43    /// </summary>
44    /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
45    /// No own data storage present.</remarks>
46    public new DataTable Content {
47      get { return (DataTable)base.Content; }
48      set { base.Content = value; }
49    }
50
51    /// <summary>
52    /// Initializes a new instance of <see cref="VariableView"/> with caption "Variable".
53    /// </summary>
54    public DataTableView() {
55      InitializeComponent();
56      valuesRowsTable = new Dictionary<IObservableList<double>, DataRow>();
57      invisibleSeries = new List<Series>();
58      chart.CustomizeAllChartAreas();
59      chart.ChartAreas[0].CursorX.Interval = 1;
60    }
61
62    #region Event Handler Registration
63    /// <summary>
64    /// Removes the eventhandlers from the underlying <see cref="Variable"/>.
65    /// </summary>
66    /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
67    protected override void DeregisterContentEvents() {
68      foreach (DataRow row in Content.Rows)
69        DeregisterDataRowEvents(row);
70      Content.VisualPropertiesChanged -= new EventHandler(Content_VisualPropertiesChanged);
71      Content.Rows.ItemsAdded -= new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsAdded);
72      Content.Rows.ItemsRemoved -= new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsRemoved);
73      Content.Rows.ItemsReplaced -= new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsReplaced);
74      Content.Rows.CollectionReset -= new CollectionItemsChangedEventHandler<DataRow>(Rows_CollectionReset);
75      base.DeregisterContentEvents();
76    }
77
78    /// <summary>
79    /// Adds eventhandlers to the underlying <see cref="Variable"/>.
80    /// </summary>
81    /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
82    protected override void RegisterContentEvents() {
83      base.RegisterContentEvents();
84      Content.VisualPropertiesChanged += new EventHandler(Content_VisualPropertiesChanged);
85      Content.Rows.ItemsAdded += new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsAdded);
86      Content.Rows.ItemsRemoved += new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsRemoved);
87      Content.Rows.ItemsReplaced += new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsReplaced);
88      Content.Rows.CollectionReset += new CollectionItemsChangedEventHandler<DataRow>(Rows_CollectionReset);
89      foreach (DataRow row in Content.Rows)
90        RegisterDataRowEvents(row);
91    }
92
93    /// <summary>
94    /// Automatically called for every existing data row and whenever a data row is added
95    /// to the data table. Do not call this method directly.
96    /// </summary>
97    /// <param name="row">The DataRow that was added.</param>
98    protected virtual void RegisterDataRowEvents(DataRow row) {
99      row.NameChanged += new EventHandler(Row_NameChanged);
100      row.VisualPropertiesChanged += new EventHandler(Row_VisualPropertiesChanged);
101      valuesRowsTable.Add(row.Values, row);
102      row.Values.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsAdded);
103      row.Values.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsRemoved);
104      row.Values.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsReplaced);
105      row.Values.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsMoved);
106      row.Values.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_CollectionReset);
107    }
108
109    /// <summary>
110    /// Automatically called for every data row that is removed from the DataTable. Do
111    /// not directly call this method.
112    /// </summary>
113    /// <param name="row">The DataRow that was removed.</param>
114    protected virtual void DeregisterDataRowEvents(DataRow row) {
115      row.Values.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsAdded);
116      row.Values.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsRemoved);
117      row.Values.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsReplaced);
118      row.Values.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsMoved);
119      row.Values.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_CollectionReset);
120      valuesRowsTable.Remove(row.Values);
121      row.VisualPropertiesChanged -= new EventHandler(Row_VisualPropertiesChanged);
122      row.NameChanged -= new EventHandler(Row_NameChanged);
123    }
124    #endregion
125
126    protected override void OnContentChanged() {
127      base.OnContentChanged();
128      invisibleSeries.Clear();
129      chart.Titles[0].Text = string.Empty;
130      chart.ChartAreas[0].AxisX.Title = string.Empty;
131      chart.ChartAreas[0].AxisY.Title = string.Empty;
132      chart.ChartAreas[0].AxisY2.Title = string.Empty;
133      chart.Series.Clear();
134      if (Content != null) {
135        chart.Titles[0].Text = Content.Name;
136        foreach (DataRow row in Content.Rows)
137          AddDataRow(row);
138        chart.ChartAreas[0].AxisX.Title = Content.VisualProperties.XAxisTitle;
139        chart.ChartAreas[0].AxisY.Title = Content.VisualProperties.YAxisTitle;
140        chart.ChartAreas[0].AxisY2.Title = Content.VisualProperties.SecondYAxisTitle;
141      }
142    }
143
144    protected override void SetEnabledStateOfControls() {
145      base.SetEnabledStateOfControls();
146      chart.Enabled = Content != null;
147    }
148
149    /// <summary>
150    /// Add the DataRow as a series to the chart.
151    /// </summary>
152    /// <param name="row">DataRow to add as series to the chart.</param>
153    protected virtual void AddDataRow(DataRow row) {
154      Series series = new Series(row.Name);
155      ConfigureSeries(series, row);
156      FillSeriesWithRowValues(series, row);
157
158      chart.Series.Add(series);
159      chart.ChartAreas[0].RecalculateAxesScale();
160      UpdateYCursorInterval();
161    }
162
163    private void ConfigureSeries(Series series, DataRow row) {
164      RemoveCustomPropertyIfExists(series, "PointWidth");
165      series.BorderWidth = 1;
166      series.BorderDashStyle = ChartDashStyle.Solid;
167
168      switch (row.VisualProperties.ChartType) {
169        case DataRowVisualProperties.DataRowChartType.Line:
170          series.ChartType = SeriesChartType.FastLine;
171          series.BorderWidth = row.VisualProperties.LineWidth;
172          series.BorderDashStyle = ConvertLineStyle(row.VisualProperties.LineStyle);
173          break;
174        case DataRowVisualProperties.DataRowChartType.Bars:
175          series.ChartType = SeriesChartType.Bar;
176          break;
177        case DataRowVisualProperties.DataRowChartType.Columns:
178          series.ChartType = SeriesChartType.Column;
179          break;
180        case DataRowVisualProperties.DataRowChartType.Points:
181          series.ChartType = SeriesChartType.FastPoint;
182          series.BorderWidth = row.VisualProperties.LineWidth;
183          series.BorderDashStyle = ConvertLineStyle(row.VisualProperties.LineStyle);
184          break;
185        case DataRowVisualProperties.DataRowChartType.Histogram:
186          series.ChartType = SeriesChartType.Column;
187          series.SetCustomProperty("PointWidth", "1");
188          break;
189        default:
190          series.ChartType = SeriesChartType.FastPoint;
191          break;
192      }
193      series.YAxisType = row.VisualProperties.SecondYAxis ? AxisType.Secondary : AxisType.Primary;
194      series.XAxisType = row.VisualProperties.SecondXAxis ? AxisType.Secondary : AxisType.Primary;
195      if (row.VisualProperties.Color != Color.Empty)
196        series.Color = row.VisualProperties.Color;
197      else series.Color = Color.Empty;
198      series.ToolTip = row.Name + " X = #INDEX, Y = #VAL";
199    }
200
201    /// <summary>
202    /// Set the Y Cursor interval to visible points of enabled series.
203    /// </summary>
204    protected virtual void UpdateYCursorInterval() {
205      double interestingValuesRange = (
206        from series in chart.Series
207        where series.Enabled
208        let values = (from point in series.Points
209                      where !point.IsEmpty
210                      select point.YValues[0]).DefaultIfEmpty(1.0)
211        let range = values.Max() - values.Min()
212        where range > 0.0
213        select range
214        ).DefaultIfEmpty(1.0).Min();
215
216      double digits = (int)Math.Log10(interestingValuesRange) - 3;
217      double yZoomInterval = Math.Pow(10, digits);
218      this.chart.ChartAreas[0].CursorY.Interval = yZoomInterval;
219    }
220
221
222    /// <summary>
223    /// Remove the corresponding series for a certain DataRow.
224    /// </summary>
225    /// <param name="row">DataRow which series should be removed.</param>
226    protected virtual void RemoveDataRow(DataRow row) {
227      Series series = chart.Series[row.Name];
228      chart.Series.Remove(series);
229      if (invisibleSeries.Contains(series))
230        invisibleSeries.Remove(series);
231      chart.ChartAreas[0].RecalculateAxesScale();
232    }
233
234    #region Event Handlers
235    #region Content Event Handlers
236    protected override void Content_NameChanged(object sender, EventArgs e) {
237      if (InvokeRequired)
238        Invoke(new EventHandler(Content_NameChanged), sender, e);
239      else {
240        chart.Titles[0].Text = Content.Name;
241        base.Content_NameChanged(sender, e);
242      }
243    }
244    private void Content_VisualPropertiesChanged(object sender, EventArgs e) {
245      if (InvokeRequired)
246        Invoke(new EventHandler(Content_VisualPropertiesChanged), sender, e);
247      else {
248        chart.ChartAreas[0].AxisX.Title = Content.VisualProperties.XAxisTitle;
249        chart.ChartAreas[0].AxisX2.Title = Content.VisualProperties.SecondXAxisTitle;
250        chart.ChartAreas[0].AxisY.Title = Content.VisualProperties.YAxisTitle;
251        chart.ChartAreas[0].AxisY2.Title = Content.VisualProperties.SecondYAxisTitle;
252      }
253    }
254    #endregion
255    #region Rows Event Handlers
256    private void Rows_ItemsAdded(object sender, CollectionItemsChangedEventArgs<DataRow> e) {
257      if (InvokeRequired)
258        Invoke(new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsAdded), sender, e);
259      else {
260        foreach (DataRow row in e.Items) {
261          AddDataRow(row);
262          RegisterDataRowEvents(row);
263        }
264      }
265    }
266    private void Rows_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<DataRow> e) {
267      if (InvokeRequired)
268        Invoke(new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsRemoved), sender, e);
269      else {
270        foreach (DataRow row in e.Items) {
271          DeregisterDataRowEvents(row);
272          RemoveDataRow(row);
273        }
274      }
275    }
276    private void Rows_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<DataRow> e) {
277      if (InvokeRequired)
278        Invoke(new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsReplaced), sender, e);
279      else {
280        foreach (DataRow row in e.OldItems) {
281          DeregisterDataRowEvents(row);
282          RemoveDataRow(row);
283        }
284        foreach (DataRow row in e.Items) {
285          AddDataRow(row);
286          RegisterDataRowEvents(row);
287        }
288      }
289    }
290    private void Rows_CollectionReset(object sender, CollectionItemsChangedEventArgs<DataRow> e) {
291      if (InvokeRequired)
292        Invoke(new CollectionItemsChangedEventHandler<DataRow>(Rows_CollectionReset), sender, e);
293      else {
294        foreach (DataRow row in e.OldItems) {
295          DeregisterDataRowEvents(row);
296          RemoveDataRow(row);
297        }
298        foreach (DataRow row in e.Items) {
299          AddDataRow(row);
300          RegisterDataRowEvents(row);
301        }
302      }
303    }
304    #endregion
305    #region Row Event Handlers
306    private void Row_VisualPropertiesChanged(object sender, EventArgs e) {
307      if (InvokeRequired)
308        Invoke(new EventHandler(Row_VisualPropertiesChanged), sender, e);
309      else {
310        DataRow row = (DataRow)sender;
311        Series series = chart.Series[row.Name];
312        series.Points.Clear();
313        ConfigureSeries(series, row);
314        FillSeriesWithRowValues(series, row);
315        chart.ChartAreas[0].RecalculateAxesScale();
316      }
317    }
318    private void Row_NameChanged(object sender, EventArgs e) {
319      if (InvokeRequired)
320        Invoke(new EventHandler(Row_NameChanged), sender, e);
321      else {
322        DataRow row = (DataRow)sender;
323        chart.Series[row.Name].Name = row.Name;
324      }
325    }
326    #endregion
327    #region Values Event Handlers
328    private void Values_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<double>> e) {
329      if (InvokeRequired)
330        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsAdded), sender, e);
331      else {
332        DataRow row = null;
333        valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row);
334        if (row != null) {
335          Series rowSeries = chart.Series[row.Name];
336          if (!invisibleSeries.Contains(rowSeries)) {
337            rowSeries.Points.Clear();
338            FillSeriesWithRowValues(rowSeries, row);
339            UpdateYCursorInterval();
340          }
341        }
342      }
343    }
344    private void Values_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<double>> e) {
345      if (InvokeRequired)
346        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsRemoved), sender, e);
347      else {
348        DataRow row = null;
349        valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row);
350        if (row != null) {
351          Series rowSeries = chart.Series[row.Name];
352          if (!invisibleSeries.Contains(rowSeries)) {
353            rowSeries.Points.Clear();
354            FillSeriesWithRowValues(rowSeries, row);
355            UpdateYCursorInterval();
356          }
357        }
358      }
359    }
360    private void Values_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<double>> e) {
361      if (InvokeRequired)
362        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsReplaced), sender, e);
363      else {
364        DataRow row = null;
365        valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row);
366        if (row != null) {
367          Series rowSeries = chart.Series[row.Name];
368          if (!invisibleSeries.Contains(rowSeries)) {
369            if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram) {
370              rowSeries.Points.Clear();
371              FillSeriesWithRowValues(rowSeries, row);
372            } else {
373              foreach (IndexedItem<double> item in e.Items) {
374                if (IsInvalidValue(item.Value))
375                  rowSeries.Points[item.Index].IsEmpty = true;
376                else {
377                  rowSeries.Points[item.Index].YValues = new double[] { item.Value };
378                  rowSeries.Points[item.Index].IsEmpty = false;
379                }
380              }
381            }
382            UpdateYCursorInterval();
383          }
384        }
385      }
386    }
387    private void Values_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<double>> e) {
388      if (InvokeRequired)
389        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsMoved), sender, e);
390      else {
391        DataRow row = null;
392        valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row);
393        if (row != null) {
394          Series rowSeries = chart.Series[row.Name];
395          if (!invisibleSeries.Contains(rowSeries)) {
396            rowSeries.Points.Clear();
397            FillSeriesWithRowValues(rowSeries, row);
398            UpdateYCursorInterval();
399          }
400        }
401      }
402    }
403
404    private void Values_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<double>> e) {
405      if (InvokeRequired)
406        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_CollectionReset), sender, e);
407      else {
408        DataRow row = null;
409        valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row);
410        if (row != null) {
411          Series rowSeries = chart.Series[row.Name];
412          if (!invisibleSeries.Contains(rowSeries)) {
413            rowSeries.Points.Clear();
414            FillSeriesWithRowValues(rowSeries, row);
415            UpdateYCursorInterval();
416          }
417        }
418      }
419    }
420    #endregion
421    #endregion
422
423    #region Chart Event Handlers
424    private void chart_MouseDown(object sender, MouseEventArgs e) {
425      HitTestResult result = chart.HitTest(e.X, e.Y);
426      if (result.ChartElementType == ChartElementType.LegendItem) {
427        ToggleSeriesVisible(result.Series);
428      }
429    }
430    private void chart_MouseMove(object sender, MouseEventArgs e) {
431      HitTestResult result = chart.HitTest(e.X, e.Y);
432      if (result.ChartElementType == ChartElementType.LegendItem)
433        this.Cursor = Cursors.Hand;
434      else
435        this.Cursor = Cursors.Default;
436    }
437    private void chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e) {
438      foreach (LegendItem legendItem in e.LegendItems) {
439        var series = chart.Series[legendItem.SeriesName];
440        if (series != null) {
441          bool seriesIsInvisible = invisibleSeries.Contains(series);
442          foreach (LegendCell cell in legendItem.Cells) {
443            cell.ForeColor = seriesIsInvisible ? Color.Gray : Color.Black;
444          }
445        }
446      }
447    }
448    private void chart_PropertiesClicked(object sender, EventArgs e) {
449      DataTableVisualPropertiesDialog dialog = new DataTableVisualPropertiesDialog(Content);
450      dialog.ShowDialog();
451    }
452    #endregion
453
454    private void ToggleSeriesVisible(Series series) {
455      if (!invisibleSeries.Contains(series)) {
456        series.Points.Clear();
457        invisibleSeries.Add(series);
458      } else {
459        invisibleSeries.Remove(series);
460        if (Content != null) {
461
462          var row = (from r in Content.Rows
463                     where r.Name == series.Name
464                     select r).Single();
465          FillSeriesWithRowValues(series, row);
466          this.chart.Legends[series.Legend].ForeColor = Color.Black;
467          UpdateYCursorInterval();
468        }
469      }
470    }
471
472    private void FillSeriesWithRowValues(Series series, DataRow row) {
473      switch (row.VisualProperties.ChartType) {
474        case DataRowVisualProperties.DataRowChartType.Histogram:
475          CalculateHistogram(series, row);
476          break;
477        default: {
478            for (int i = 0; i < row.Values.Count; i++) {
479              var value = row.Values[i];
480              DataPoint point = new DataPoint();
481              point.XValue = row.VisualProperties.StartIndexZero ? i : i + 1;
482              if (IsInvalidValue(value))
483                point.IsEmpty = true;
484              else
485                point.YValues = new double[] { value };
486              series.Points.Add(point);
487            }
488          }
489          break;
490      }
491    }
492
493    protected virtual void CalculateHistogram(Series series, DataRow row) {
494      series.Points.Clear();
495      if (!row.Values.Any()) return;
496      int bins = row.VisualProperties.Bins;
497
498      double minValue = row.Values.Min();
499      double maxValue = row.Values.Max();
500      double intervalWidth = (maxValue - minValue) / bins;
501      if (intervalWidth <= 0) return;
502
503      if (!row.VisualProperties.ExactBins) {
504        intervalWidth = HumanRoundRange(intervalWidth);
505        minValue = Math.Floor(minValue / intervalWidth) * intervalWidth;
506        maxValue = Math.Ceiling(maxValue / intervalWidth) * intervalWidth;
507      }
508
509      double current = minValue, intervalCenter = intervalWidth / 2.0;
510      int frequency = 0;
511      foreach (double v in row.Values.Where(x => !IsInvalidValue(x)).OrderBy(x => x)) {
512        while (v > current + intervalWidth) {
513          series.Points.AddXY(current + intervalCenter, frequency);
514          current += intervalWidth;
515          frequency = 0;
516        }
517        frequency++;
518      }
519      series.Points.AddXY(current + intervalCenter, frequency);
520    }
521
522    #region Helpers
523    protected void RemoveCustomPropertyIfExists(Series series, string property) {
524      if (series.IsCustomPropertySet(property)) series.DeleteCustomProperty(property);
525    }
526
527    private double HumanRoundRange(double range) {
528      double base10 = Math.Pow(10.0, Math.Floor(Math.Log10(range)));
529      double rounding = range / base10;
530      if (rounding <= 1.5) rounding = 1;
531      else if (rounding <= 2.25) rounding = 2;
532      else if (rounding <= 3.75) rounding = 2.5;
533      else if (rounding <= 7.5) rounding = 5;
534      else rounding = 10;
535      return rounding * base10;
536    }
537
538    private ChartDashStyle ConvertLineStyle(DataRowVisualProperties.DataRowLineStyle dataRowLineStyle) {
539      switch (dataRowLineStyle) {
540        case DataRowVisualProperties.DataRowLineStyle.Dash:
541          return ChartDashStyle.Dash;
542        case DataRowVisualProperties.DataRowLineStyle.DashDot:
543          return ChartDashStyle.DashDot;
544        case DataRowVisualProperties.DataRowLineStyle.DashDotDot:
545          return ChartDashStyle.DashDotDot;
546        case DataRowVisualProperties.DataRowLineStyle.Dot:
547          return ChartDashStyle.Dot;
548        case DataRowVisualProperties.DataRowLineStyle.NotSet:
549          return ChartDashStyle.NotSet;
550        case DataRowVisualProperties.DataRowLineStyle.Solid:
551          return ChartDashStyle.Solid;
552        default:
553          return ChartDashStyle.NotSet;
554      }
555    }
556
557    /// <summary>
558    /// Determines whether a double value can be displayed (converted to Decimal and not an NaN).
559    /// </summary>
560    /// <param name="x">The number to check.</param>
561    /// <returns><code>true</code> if the value can be safely shwon in the chart,
562    /// <code>false</code> otherwise.</returns>
563    protected static bool IsInvalidValue(double x) {
564      return double.IsNaN(x) || x < (double)decimal.MinValue || x > (double)decimal.MaxValue;
565    }
566    #endregion
567  }
568}
Note: See TracBrowser for help on using the repository browser.