/// <summary>
    /// Convert old graph data to new one (if any)
    /// </summary>
    /// <param name="settings">Old graph data</param>
    private void Convert(ReportCustomData settings)
    {
        // Smooth curves
        bool smoothCurves = ValidationHelper.GetBoolean(settings["SmoothCurves"], false);
        if (smoothCurves)
        {
            drpLineDrawingStyle.SelectedValue = "SpLine";
        }

        // Fill curves
        bool fillCurves = ValidationHelper.GetBoolean(settings["FillCurves"], false);
        if (fillCurves)
        {
            drpStackedBarDrawingStyle.SelectedValue = "Area";
        }

        // Vertical bars
        if (settings.ContainsColumn("VerticalBars"))
        {
            bool verticalBars = ValidationHelper.GetBoolean(settings["VerticalBars"], false);
            drpBarOrientation.SelectedValue = verticalBars ? "Vertical" : "Horizontal";
        }

        // Some types of graph type
        string graphType = mReportGraphInfo.GraphType;
        if (graphType == "baroverlay")
        {
            chkBarOverlay.Checked = true;
            drpChartType.SelectedValue = "bar";
        }

        if (graphType == "barpercentage")
        {
            chkStacked.Checked = true;
            drpChartType.SelectedValue = "barstacked";
        }

        if (graphType == "barstacked")
        {
            chkStacked.Checked = false;
            drpChartType.SelectedValue = "barstacked";
        }

        // Legend
        int value = ValidationHelper.GetInteger(mReportGraphInfo.GraphLegendPosition, ReportGraphDefaults.GraphLegendPosition);
        if (value != ReportGraphDefaults.GraphLegendPosition)
        {
            string position;
            switch (value)
            {
                case 0:
                    position = "TopLeft";
                    break;

                case 1:
                    position = "TopLeft";
                    break;

                case 2:
                    position = "TopRight";
                    break;

                case 3:
                    position = "BottomLeft";
                    break;

                case 4:
                    position = "TopLeft";
                    chkLegendInside.Checked = true;
                    break;

                case 5:
                    position = "TopRight";
                    chkLegendInside.Checked = true;
                    break;

                case 6:
                    position = "BottomLeft";
                    chkLegendInside.Checked = true;
                    break;

                case 7:
                    position = "BottomRight";
                    chkLegendInside.Checked = true;
                    break;

                case 8:
                    position = "TopLeft";
                    break;

                case 9:
                    position = "Top";
                    break;

                case 10:
                    position = "Bottom";
                    break;

                case 11:
                    position = "TopLeft";
                    break;

                case 12:
                    position = "BottomLeft";
                    break;

                case -1:
                    position = "None";
                    break;

                default:
                    position = "None";
                    break;
            }

            drpLegendPosition.SelectedValue = position;
        }

        // If old x axis font defined set same y axis
        if (settings.ContainsColumn("axisFont"))
        {
            chkYAxisUseXSettings.Checked = true;
            ucYAxisTitleFont.Value = ucXAxisTitleFont.Value;
            drpYAxisTitlePosition.SelectedValue = drpYAxisTitlePosition.SelectedValue;
        }
    }
コード例 #2
0
    /// <summary>
    /// Convert old graph data to new one (if any)
    /// </summary>
    /// <param name="settings"></param>
    private void Convert(ReportCustomData settings)
    {
        // Smoothcurves
        bool smoothCurves = ValidationHelper.GetBoolean(settings["SmoothCurves"], false);
        if (smoothCurves == true)
        {
            drpLineDrawingStyle.SelectedValue = "SpLine";
        }

        // Fillcurves
        bool fillCurves = ValidationHelper.GetBoolean(settings["FillCurves"], false);
        if (fillCurves == true)
        {
            drpStackedBarDrawingStyle.SelectedValue = "Area";
        }

        // Verticalbars
        if (settings.ContainsColumn("VerticalBars"))
        {
            bool verticalBars = ValidationHelper.GetBoolean(settings["VerticalBars"], false);
            if (verticalBars)
            {
                drpBarOrientation.SelectedValue = "Vertical";
            }
            else
            {
                drpBarOrientation.SelectedValue = "Horizontal";
            }
        }

        // Some types of graph type
        string graphType = graphInfo.GraphType;
        if (graphType == "baroverlay")
        {
            chkBarOverlay.Checked = true;
            drpChartType.SelectedValue = "bar";
        }

        if (graphType == "barpercentage")
        {
            chkStacked.Checked = true;
            drpChartType.SelectedValue = "barstacked";
        }

        if (graphType == "barstacked")
        {
            chkStacked.Checked = false;
            drpChartType.SelectedValue = "barstacked";
        }

        // Legend
        int value = ValidationHelper.GetInteger(graphInfo.GraphLegendPosition, 100);
        string position = String.Empty;
        if (value != 100)
        {
            switch (value)
            {
                case 0:
                    position = "TopLeft";
                    break;

                case 1:
                    position = "TopLeft";
                    break;

                case 2:
                    position = "TopRight";
                    break;

                case 3:
                    position = "BottomLeft";
                    break;

                case 4:
                    position = "TopLeft";
                    chkLegendInside.Checked = true;
                    break;

                case 5:
                    position = "TopRight";
                    chkLegendInside.Checked = true;
                    break;

                case 6:
                    position = "BottomLeft";
                    chkLegendInside.Checked = true;
                    break;

                case 7:
                    position = "BottomRight";
                    chkLegendInside.Checked = true;
                    break;

                case 8:
                    position = "TopLeft";
                    break;

                case 9:
                    position = "Top";
                    break;

                case 10:
                    position = "Bottom";
                    break;

                case 11:
                    position = "TopLeft";
                    break;

                case 12:
                    position = "BottomLeft";
                    break;

                case -1:
                    position = "None";
                    break;

                default:
                    position = "None";
                    break;
                    ;

            }
            drpLegendPosition.SelectedValue = position;
        }
        // If old x axis font defined set same y axis
        if (settings.ContainsColumn("axisFont"))
        {
            chkYAxisUseXSettings.Checked = true;
            ucYAxisTitleFont.Value = ucXAxisTitleFont.Value;
            drpYAxisTitlePosition.SelectedValue = drpYAxisTitlePosition.SelectedValue;
        }

        // Convert displayItemValue
        if (settings.ContainsColumn("DisplayItemValue"))
        {
            // Conversion - if old graph was bar type set this value to true otherwise set it to false
            string chartType = graphInfo.GraphType.ToLower();
            if ((chartType == "bar") || (chartType == "barstacked") || (chartType == "barpercentage") || (chartType == "baroverlay"))
            {

                chkSeriesDisplayItemValue.Checked = true;
            }
            else
            {
                chkSeriesDisplayItemValue.Checked = false;
            }
        }
    }