Converts a SharePoint List (SPList) into a nice XML string that can be directly used by fusion charts
        /// <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 XML button
        /// so we get to xml, and make it download
        /// </summary>
        protected void ExportXmlButtonClick(object sender, EventArgs e)
        {
            // We first check all settings
            CheckSettings();

            // We transform the list into XML Input
            ListToXmlConverter conv = new ListToXmlConverter(_listName, _viewName);
            string chartXmlContent = conv.GenerateXml(ChartTitle, XValue, XTitle, YValue, YTitle, Action, Colors);

            Context.Response.Clear();
            Context.Response.ContentType = "application/octet-stream";
            Context.Response.AddHeader("Content-Disposition", "attachment; filename=XMLExport.xml");
            Context.Response.AddHeader("Content-Length", chartXmlContent.Length.ToString());
            Context.Response.Write(chartXmlContent);
            Context.Response.End();
        }
        /// <summary>
        /// Create all your controls here for rendering.
        /// Try to avoid using the RenderWebPart() method.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_error)
            {
                try
                {

                    base.CreateChildControls();

                    // Your code here...

                    // We first check all settings
                    CheckSettings();

                    // We transform the list into XML Input
                    ListToXmlConverter conv = new ListToXmlConverter(_listName, _viewName);
                    string chartXmlContent = conv.GenerateXml(ChartTitle, XValue, XTitle, YValue, YTitle, Action, Colors);

                    // We generate the graph
                    string chartHtml = Utils.RenderChartHTML(ChartType, chartXmlContent, ChartID.ToString(), ChartWidth.ToString(), ChartHeight.ToString(), false);
                    LiteralControl lc = new LiteralControl(chartHtml);
                    this.Controls.Add(lc);

                    // We add a cariage return to display correctly export buttons
                    if (this._excelExport || this._xmlExport)
                    {
                        this.Controls.Add(new LiteralControl("<br />"));
                    }

                    // display (or not, depending of the user choice option) the button "export to excel"
                    if (this._excelExport)
                    {
                        Button btnExcel = new Button();
                        btnExcel.Text = "Export chart to Excel";
                        btnExcel.Click += new System.EventHandler(this.ExportExcelButtonClick);
                        btnExcel.Style.Add("font-size", "10");
                        btnExcel.Style.Add("margin", "10");
                        this.Controls.Add(btnExcel);
                    }

                    // display (or not, depending of the user choice option) the button "export to xml"
                    if (this._xmlExport)
                    {
                        Button btnXML = new Button();
                        btnXML.Text = "Export chart to XML file";
                        btnXML.Click += new System.EventHandler(this.ExportXmlButtonClick);
                        btnXML.Style.Add("font-size", "10");
                        btnXML.Style.Add("margin", "10");
                        this.Controls.Add(btnXML);
                    }
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        }