Exemple #1
0
        public SeriesIndic(Series s, SeriesRow sr)
        {
            if (s == null || sr == null)
            {
                throw new ArgumentNullException();
            }

            _series = s;

            var        penSp = SeriesPropsUtil.Create(_series.Data) as PenSeriesProps;
            ChartBrush brush = new ChartBrush(0, 0, 255);

            if (penSp != null)
            {
                brush = new ChartBrush(penSp.Red, penSp.Green, penSp.Blue, penSp.Alpha);
            }
            _chart = new SeriesChart(sr, brush);
        }
        /// <summary>
        /// Saves Time Series Data Set to xml file.
        /// Set SaveEveryting to true to save everything
        /// inculding the time series data loaded from the database.
        /// Otherwise the time series data tables are not saved.
        /// </summary>
        public void Save(string filename, bool SaveEverything)
        {
            this.FileName = filename;
            if (this.Graph.Rows.Count > 0)
            {
                //this.Graph[0].FileName = filename;
            }

            if (SaveEverything)
            {
                WriteXml(filename);
            }
            else
            {//
                TimeSeriesDataSet ds = new TimeSeriesDataSet();
                for (int i = 0; i < Series.Count; i++)
                {
                    SeriesRow r = ds.Series.NewSeriesRow();
                    ds.Series.AddSeriesRow(r);
                    for (int c = 0; c < Series.Columns.Count; c++)
                    {
                        r[c] = Series[i][c];
                    }
                }
                for (int i = 0; i < Graph.Count; i++)
                {
                    GraphRow r = ds.Graph.NewGraphRow();
                    ds.Graph.AddGraphRow(r);
                    for (int c = 0; c < Graph.Columns.Count; c++)
                    {
                        r[c] = Graph[i][c];
                    }
                }

                ds.WriteXml(filename);
            }
        }