/// <summary>
        /// Converts the gadget's output to Html
        /// </summary>
        /// <returns></returns>
        public override string ToHTML(string htmlFileName = "", int count = 0, bool useAlternatingColors = false)
        {
            StringBuilder htmlBuilder = new StringBuilder();

            if (string.IsNullOrEmpty(CustomOutputHeading))
            {
                htmlBuilder.AppendLine("<h2 class=\"gadgetHeading\">Chart</h2>");
            }
            else if (CustomOutputHeading != "(none)")
            {
                htmlBuilder.AppendLine("<h2 class=\"gadgetHeading\">" + CustomOutputHeading + "</h2>");
            }

            if (!string.IsNullOrEmpty(CustomOutputDescription))
            {
                htmlBuilder.AppendLine("<p class=\"gadgetsummary\">" + CustomOutputDescription + "</p>");
            }

            int    subCount      = 0;
            string imageFileName = string.Empty;

            foreach (UIElement element in panelMain.Children)
            {
                if (element is Controls.Charting.AberrationChart)
                {
                    imageFileName = htmlFileName + "_" + count.ToString() + "_" + subCount.ToString() + ".png";

                    Controls.Charting.AberrationChart abChart = element as Controls.Charting.AberrationChart;

                    htmlBuilder.Append(abChart.ToHTML(htmlFileName, subCount));
                    subCount++;
                }
            }
            return(htmlBuilder.ToString());
        }
        /// <summary>
        /// TODO: Rename this method
        /// </summary>
        /// <param name="dataList"></param>
        /// <param name="aberrationDetails"></param>
        private void AddChart(List <AberrationChartData> dataList, DataTable aberrationDetails, string strata)
        {
            AberrationDetectionChartParameters AbDetChartParameters = (AberrationDetectionChartParameters)Parameters;

            Controls.Charting.AberrationChart abChart = new Controls.Charting.AberrationChart();
            abChart.DashboardHelper = this.DashboardHelper;
            abChart.SetChartSize(double.Parse(AbDetChartParameters.ChartWidth.ToString()), double.Parse(AbDetChartParameters.ChartHeight.ToString()));
            abChart.SetChartData(dataList, aberrationDetails);
            abChart.SetChartLabels(AbDetChartParameters);
            panelMain.Children.Add(abChart);
            SetVisuals(abChart);

            if (AbDetChartParameters.StrataVariableNames.Count > 0)
            {
                abChart.IndicatorTitle = strata;
            }

            abChart.Margin = new Thickness(0, 0, 0, 48);
        }
        private void SetVisuals(Controls.Charting.AberrationChart aberrationChart)
        {
            AberrationDetectionChartParameters AbDetChartParameters = (AberrationDetectionChartParameters)Parameters;

            aberrationChart.Chart.InnerMargins = new Thickness(20, 30, 30, 50);

            aberrationChart.YAxisLabel = AbDetChartParameters.YAxisLabel;

            switch (AbDetChartParameters.XAxisLabelType)
            {
            case 3:
                aberrationChart.XAxisLabel = AbDetChartParameters.XAxisLabel;
                break;

            case 1:
                Field field = DashboardHelper.GetAssociatedField(AbDetChartParameters.ColumnNames[0]);
                if (field != null && field is IDataField)
                {
                    RenderableField rField = field as RenderableField;
                    aberrationChart.XAxisLabel = rField.PromptText;
                }
                else
                {
                    aberrationChart.XAxisLabel = AbDetChartParameters.ColumnNames[0];
                }
                break;

            case 2:
                aberrationChart.XAxisLabel = string.Empty;
                break;

            default:
                aberrationChart.XAxisLabel = AbDetChartParameters.ColumnNames[0];
                break;
            }

            aberrationChart.ChartTitle = AbDetChartParameters.ChartTitle;
        }