/// <summary>
        /// This overloaded constructor creates a chart from the provided ChartConfigProvider
        /// </summary>
        /// <param name="ChartConfig">The chart config.</param>
        /// <param name="ThisPage">The this page.</param>
        /// <param name="imageMap">if set to <c>true</c> [image map].</param>
        public ChartBuilder(ChartConfigProvider ChartConfig, Page ThisPage, bool imageMap)
        {
            try
            {
                currConfig = ChartConfig;
                chartToBuild = new Chart();
                chartToBuild.ChartAreas.Add(new ChartArea());
                chartToBuild.Page = ThisPage;

                XmlDocument xmlData = GetXmlData();

                BuildXAxisLabels(xmlData);

                FillSeriesData(xmlData);
                SetObjectParameters(chartToBuild, currConfig.ChartParams);
                SetObjectParameters(chartToBuild.ChartAreas[0], currConfig.ChartAreaParams);
                SetObjectParameters(chartToBuild.ChartAreas[0].AxisX, currConfig.ChartAxisXParams);
                SetObjectParameters(chartToBuild.ChartAreas[0].AxisY, currConfig.ChartAxisYParams);
                SetObjectParameters(chartToBuild.ChartAreas[0].AxisX2, currConfig.ChartAxisX2Params);
                SetObjectParameters(chartToBuild.ChartAreas[0].AxisY2, currConfig.ChartAxisY2Params);

                if (currConfig.ChartLegendParams.Count > 0)
                {
                    Legend l = new Legend();
                    SetObjectParameters(l, currConfig.ChartLegendParams);
                    chartToBuild.Legends.Add(l);
                }

                SetRenderMethod(imageMap);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            XmlDocument xmlInput = new XmlDocument();
            xmlInput.Load(Request.InputStream);

            ChartConfigProvider ccp = new ChartConfigProvider(xmlInput);

            ChartBuilder cb = new ChartBuilder(ccp, Page, true);

            Response.ContentType = "text/html";
            Response.Write(cb.GetChartHtml()+cb.GetHtmlImageMap());
        }
        /// <summary>
        /// Handles the Click event of the Button3 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Button3_Click(object sender, EventArgs e)
        {
            // Variable declarations
            WebClient webClient = new WebClient();
            XmlDocument xmlChartConfig = new XmlDocument();
            XmlDocument xmlData = new XmlDocument();
            // Get the chart config
            Uri uri = new Uri(Server.MapPath("~/Configuration/Charts/TelemetryData1.xml"),
              UriKind.RelativeOrAbsolute);
            Stream configData = webClient.OpenRead(uri);
            XmlTextReader xmlText = new XmlTextReader(configData);
            xmlChartConfig.Load(xmlText);
            configData.Close();

            ChartConfigProvider chartConfig = new ChartConfigProvider(xmlChartConfig);

            ChartBuilder cb = new ChartBuilder(chartConfig, Chart3);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ChartConfig">A populated ChartConfig object</param>
        /// <param name="ChartToBuild">The chart object used to provide the chart</param>
        public ChartBuilder(ChartConfigProvider ChartConfig, Chart ChartToBuild)
        {
            currConfig = ChartConfig;
            chartToBuild = ChartToBuild;

            XmlDocument xmlData = GetXmlData();

            BuildXAxisLabels(xmlData);

            FillSeriesData(xmlData);
            SetObjectParameters(chartToBuild, currConfig.ChartParams);
            SetObjectParameters(chartToBuild.ChartAreas[0], currConfig.ChartAreaParams);
            SetObjectParameters(chartToBuild.ChartAreas[0].AxisX, currConfig.ChartAxisXParams);
            SetObjectParameters(chartToBuild.ChartAreas[0].AxisY, currConfig.ChartAxisYParams);
            SetObjectParameters(chartToBuild.ChartAreas[0].AxisX2, currConfig.ChartAxisX2Params);
            SetObjectParameters(chartToBuild.ChartAreas[0].AxisY2, currConfig.ChartAxisY2Params);

            if (currConfig.ChartLegendParams.Count > 0)
            {
                Legend l = new Legend();
                SetObjectParameters(l, currConfig.ChartLegendParams);
                chartToBuild.Legends.Add(l);
            }

            // Process special params
            if (currConfig.ChartAxisYParams.Contains("GridLines"))
            {
                bool val = Convert.ToBoolean(currConfig.ChartAxisYParams["GridLines"]);
                chartToBuild.ChartAreas[0].AxisY.MajorGrid.Enabled = val;
            }
            if (currConfig.ChartAxisY2Params.Contains("GridLines"))
            {
                bool val = Convert.ToBoolean(currConfig.ChartAxisY2Params["GridLines"]);
                chartToBuild.ChartAreas[0].AxisY2.MajorGrid.Enabled = val;
            }
            if (currConfig.ChartAxisXParams.Contains("GridLines"))
            {
                bool val = Convert.ToBoolean(currConfig.ChartAxisXParams["GridLines"]);
                chartToBuild.ChartAreas[0].AxisX.MajorGrid.Enabled = val;
            }
            if (currConfig.ChartAxisX2Params.Contains("GridLines"))
            {
                bool val = Convert.ToBoolean(currConfig.ChartAxisX2Params["GridLines"]);
                chartToBuild.ChartAreas[0].AxisX2.MajorGrid.Enabled = val;
            }
        }