PrepareData() public method

Transforms the list of items into something easily usable (a Plots object). Performs also operations such as SUM, COUNT over GROUPBY
public PrepareData ( string xValue, string yValue, GroupAction action ) : Plots
xValue string The name of the column to use as xValue
yValue string The nam of the column to use as yValue
action GroupAction The action to perform, if any...
return Plots
        /// <summary>
        /// When the user click on the export to Excel button
        /// so we build a csv and then make it download with good header to make it opened by excel automatically
        /// </summary>
        protected void ExportExcelButtonClick(object sender, EventArgs e)
        {
            // We first check all settings
            CheckSettings();

            // We transform the list into XML Input
            ListToXmlConverter conv = new ListToXmlConverter(_listName, _viewName);

            // we build the csv string
            StringBuilder csv = new StringBuilder();

            csv.AppendLine(((XTitle != "") ? XTitle : "X") + ";" + ((YTitle != "") ? YTitle : "Y"));

            // We prepare the data in a nice hashtable
            Plots plots = conv.PrepareData(this._xValue, this._yValue, this._action);

            for (int i = 0; i < plots.Count(); i++)
            {
                csv.AppendLine(plots.GetX(i).Replace(",", " ").Replace(";", " ") + ";" + plots.GetY(i).ToString().Replace(",", " ").Replace(";", " "));
            }

            Context.Response.Clear();
            Context.Response.ContentType = "application/octet-stream";
            Context.Response.AddHeader("Content-Disposition", "attachment; filename=ExcelExport.csv");
            Context.Response.AddHeader("Content-Length", csv.Length.ToString());
            Context.Response.Write(csv.ToString());
            Context.Response.End();
        }
        /// <summary>
        /// When the user click on the export to Excel button
        /// so we build a csv and then make it download with good header to make it opened by excel automatically
        /// </summary>
        protected void ExportExcelButtonClick(object sender, EventArgs e)
        {
            // We first check all settings
            CheckSettings();

            // We transform the list into XML Input
            ListToXmlConverter conv = new ListToXmlConverter(_listName, _viewName);

            // we build the csv string
            StringBuilder csv = new StringBuilder();
            csv.AppendLine(((XTitle != "") ? XTitle : "X") + ";" + ((YTitle != "") ? YTitle : "Y"));

            // We prepare the data in a nice hashtable
            Plots plots = conv.PrepareData(this._xValue, this._yValue, this._action);
            for (int i = 0; i < plots.Count(); i++)
            {
                csv.AppendLine(plots.GetX(i).Replace(",", " ").Replace(";", " ") + ";" + plots.GetY(i).ToString().Replace(",", " ").Replace(";", " "));
            }

            Context.Response.Clear();
            Context.Response.ContentType = "application/octet-stream";
            Context.Response.AddHeader("Content-Disposition", "attachment; filename=ExcelExport.csv");
            Context.Response.AddHeader("Content-Length", csv.Length.ToString());
            Context.Response.Write(csv.ToString());
            Context.Response.End();
        }