Exemplo n.º 1
0
 /// <summary>
 /// Create data serial by specified worksheet instance and data range.
 /// </summary>
 /// <param name="dataSource">Data source to read chart data from worksheet.</param>
 /// <param name="worksheet">Instance of worksheet that contains the data to be read.</param>
 /// <param name="labelAddress">The address to locate label of serial on worksheet.</param>
 /// <param name="addressOrName">Serial data specified by address position or range's name.</param>
 public WorksheetChartDataSerial(WorksheetChartDataSource dataSource, Worksheet worksheet, string labelAddress, string addressOrName)
     : this(dataSource, worksheet, new CellPosition(labelAddress))
 {
     if (RangePosition.IsValidAddress(addressOrName))
     {
         this.dataRange = new RangePosition(addressOrName);
     }
     else if (NamedRange.IsValidName(addressOrName))
     {
         if (this.worksheet != null)
         {
             if (worksheet.TryGetNamedRange(addressOrName, out var range))
             {
                 this.dataRange = range;
             }
             else
             {
                 throw new InvalidAddressException(addressOrName);
             }
         }
         else
         {
             throw new ReferenceObjectNotAssociatedException("Data source must associate to valid worksheet instance.");
         }
     }
     else
     {
         throw new InvalidAddressException(addressOrName);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create chart data serial instance with specified worksheet and reference ranges
 /// </summary>
 /// <param name="dataSource">Data source to read chart data from worksheet.</param>
 /// <param name="worksheet">Instance of worksheet that contains the data to be read.</param>
 /// <param name="labelAddress">The address to locate label of serial on worksheet.</param>
 /// <param name="dataRange">Serial data range to read serial data for chart from worksheet.</param>
 public WorksheetChartDataSerial(WorksheetChartDataSource dataSource, Worksheet worksheet, ReferenceRange labelAddress, ReferenceRange dataRange)
 {
     this.dataSource   = dataSource ?? throw new ArgumentNullException("dataSource");
     this.worksheet    = worksheet ?? throw new ArgumentNullException("worksheet");
     this.LabelAddress = labelAddress;
     this.DataRange    = dataRange;
 }
Exemplo n.º 3
0
        protected WorksheetChartDataSerial(WorksheetChartDataSource dataSource, Worksheet worksheet, CellPosition labelAddress)
        {
            if (dataSource == null)
            {
                throw new ArgumentNullException("dataSource");
            }

            if (worksheet == null)
            {
                throw new ArgumentNullException("worksheet");
            }

            this.dataSource   = dataSource;
            this.worksheet    = worksheet;
            this.LabelAddress = labelAddress;

            if (this.worksheet != null)
            {
                this.worksheet.CellDataChanged  += worksheet_CellDataChanged;
                this.worksheet.RangeDataChanged += worksheet_RangeDataChanged;
            }
        }
Exemplo n.º 4
0
 /// <param name="dataSource">Data source to read chart data from worksheet.</param>
 /// <param name="worksheet">Instance of worksheet that contains the data to be read.</param>
 /// <param name="labelAddress">The address to locate label of serial on worksheet.</param>
 /// <param name="dataRange">Serial data range to read serial data for chart from worksheet.</param>
 public WorksheetChartDataSerial(WorksheetChartDataSource dataSource, Worksheet worksheet, CellPosition labelAddress, RangePosition dataRange)
     : this(dataSource, worksheet, labelAddress)
 {
     this.dataRange = dataRange;
 }
Exemplo n.º 5
0
 internal WorksheetChartDataSerialCollection(WorksheetChartDataSource dataSource)
 {
     this.DataSource = dataSource;
     this.serials    = dataSource.serials;
 }