/// <summary> /// Updates the chart to use the chart data /// </summary> /// <exception cref="NotSupportedException">Data type {0} is not supported for Y value</exception> public virtual void UpdateChart() { PrepareChart(); if ((DataColumns != null) && (DataColumns.Length > 1)) { global::Visifire.Charts.DataSeries ds = new global::Visifire.Charts.DataSeries(); ds.RenderAs = RenderAs; Chart.Series.Add(ds); foreach (DataRowView rowView in DataView) { global::Visifire.Charts.DataPoint dp = new global::Visifire.Charts.DataPoint(); ds.RenderAs = RenderAs; ds.DataPoints.Add(dp); dp.AxisXLabel = rowView[DataColumns[0]].ToString(); Type type = DataView.Table.Columns[DataColumns[1]].DataType; try { dp.YValue = FormatValue(rowView[DataColumns[1]], type); } catch (NotSupportedException) { throw new NotSupportedException("Data type " + type + " is not supported for Y value"); } if (DataColumns.Length > 2) { type = DataView.Table.Columns[DataColumns[2]].DataType; try { dp.ZValue = FormatValue(rowView[DataColumns[2]], type); } catch (NotSupportedException) { throw new NotSupportedException("Data type " + type + " is not supported for Z value"); } } } } Children.Clear(); Children.Add(Chart); UpdateLayout(); }
/// <summary> /// Updates the chart to use the chart data /// </summary> /// <exception cref="NotSupportedException">Data type {0} is not supported for Y value</exception> public virtual void UpdateChart() { PrepareChart(); if ((DataColumns != null) && (DataColumns.Length > 1)) { global::Visifire.Charts.DataSeries ds = new global::Visifire.Charts.DataSeries(); ds.RenderAs = _renderAs; _chart.Series.Add(ds); foreach (DataRowView rowView in DataView) { global::Visifire.Charts.DataPoint dp = new global::Visifire.Charts.DataPoint(); ds.RenderAs = _renderAs; ds.DataPoints.Add(dp); dp.AxisXLabel = rowView[DataColumns[0]].ToString(); Type type = DataView.Table.Columns[DataColumns[1]].DataType; try { dp.YValue = FormatValue(rowView[DataColumns[1]], type); } catch (NotSupportedException) { throw new NotSupportedException("Data type " + type.ToString() + " is not supported for Y value"); } if (DataColumns.Length > 2) { type = DataView.Table.Columns[DataColumns[2]].DataType; try { dp.ZValue = FormatValue(rowView[DataColumns[2]], type); } catch (NotSupportedException) { throw new NotSupportedException("Data type " + type.ToString() + " is not supported for Z value"); } } } } Children.Clear(); Children.Add(_chart); UpdateLayout(); }