/// <summary> /// Creates a DataTable composed from multiple time series /// </summary> /// <param name="ds">The TimeSeriesDataset passed to the constructor /// should contain time series data.</param> /// <param name="interval">one of : hour,day,year,wy </param> public MultipleSeriesDataTable(GraphData ds, string interval) : base(interval) { this.ds = ds; s_instanceCounter++; Logger.WriteLine("MultipleSeriesDataTable(" + interval + ") + instanceCounter= " + s_instanceCounter); m_instanceNumber = s_instanceCounter; m_tblList = new List <DataTable>(); m_Series = new List <TimeSeriesDataSet.SeriesRow>(); m_seriesIndexList = new List <int>(); m_columnTitle = new List <string>(); for (int i = 0; i < ds.SeriesRows.Count(); i++) { TimeSeriesDataSet.SeriesRow s = ds.SeriesRows.Skip(i).First(); DataTable tbl = ds.Tables[s.TableName]; if (String.Compare(s.Interval, interval, true) == 0) { m_tblList.Add(tbl); // set the sort order so we can do fast lookups in // The TimeSeriesDataSet code : DefaultView.Find(t) tbl.DefaultView.Sort = tbl.Columns[0].ColumnName; tbl.DefaultView.ApplyDefaultSort = true; m_Series.Add(s); string title = s.SiteName + " " + s.ParameterType; title += " " + s.Units; if (s.hdb_r_table == "r_base") {// this is needed because r_base could be any interval. // we need to identify it as different title += " - base"; } m_columnTitle.Add(title); m_seriesIndexList.Add(i); } } CreateMultiColumnTable(); AcceptChanges(); ColumnChanged += new DataColumnChangeEventHandler(m_table_ColumnChanged); SetupPrimaryKey(); SetupReadOnly(); }
internal void AddSeriesRow(TimeSeriesDataSet.SeriesRow row) { ds.Series.AddSeriesRow(row); }