/// <summary>
        /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.DataSetCollection"/> class.
        /// </summary>
        /// <param name="chart">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this collection.</param>
        /// <param name="previous">The previous data sets to reload into this new collection, or null.</param>
        internal DataSetCollection(ChartJS chart, DataSetCollection previous)
        {
            if (chart == null)
            {
                throw new ArgumentNullException("chart");
            }

            this.chart = chart;

            // preserve the previous data sets.
            if (previous != null)
            {
                foreach (var d in previous)
                {
                    DataSet dataSet = CreateDataSet(d.Label);
                    dataSet.CopyFrom(d);
                    Add(dataSet);
                }
            }
        }
            public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
            {
                if (destinationType == typeof(string))
                {
                    DataSetCollection dataSets = (DataSetCollection)value;

                    if (dataSets == null || dataSets.Count == 0)
                    {
                        return("0 Data Sets");
                    }
                    else if (dataSets.Count == 1)
                    {
                        return("1 Data Set");
                    }
                    else
                    {
                        return(dataSets.Count + " Data Sets");
                    }
                }

                return(base.ConvertTo(context, culture, value, destinationType));
            }
 private void ResetDataSets()
 {
     this._dataSets = null;
     Update();
 }