Exemplo n.º 1
0
        /// <summary>
        /// Copy Constructor
        /// </summary>
        public ColumnChartParameters(ColumnChartParameters parameters)
            : base(parameters)
        {
            //MainVariableNames = parameters.MainVariableNames;
            ColumnNames = parameters.ColumnNames;
            //GadgetStatusUpdate = parameters.GadgetStatusUpdate;
            InputVariableList = parameters.InputVariableList;
            CustomFilter = parameters.CustomFilter;
            CustomSortColumnName = parameters.CustomSortColumnName;
            IncludeFullSummaryStatistics = parameters.IncludeFullSummaryStatistics;
            ShowAllListValues = parameters.ShowAllListValues;
            ShowCommentLegalLabels = parameters.ShowCommentLegalLabels;
            SortHighToLow = parameters.SortHighToLow;
            IncludeMissing = parameters.IncludeMissing;
            CrosstabVariableName = parameters.CrosstabVariableName;
            WeightVariableName = parameters.WeightVariableName;
            StrataVariableNames = parameters.StrataVariableNames;
            IgnoreRowLimits = parameters.IgnoreRowLimits;
            SortVariables = parameters.SortVariables;

            //from ColumnChartGadgetParametersBase
            UseDiffColors = parameters.UseDiffColors ;
            Composition = parameters.Composition ;
            //BarSpacing = parameters.BarSpacing;
            Orientation = parameters.Orientation ;
            BarKind = parameters.BarKind;

            //from ChartGadgetParametersBase
            //Advanced options
            ChartWidth = parameters.ChartWidth;
            ChartHeight = parameters.ChartHeight;
            Y2AxisType = parameters.Y2AxisType;

            //Display options
            //  Color and styles
            UseRefValues = parameters.UseRefValues;
            ShowAnnotations = parameters.ShowAnnotations;
            Y2ShowAnnotations = parameters.Y2ShowAnnotations;
            ShowGridLines = parameters.ShowGridLines;
            Palette = parameters.Palette;
            //Y2LineType = parameters.Y2LineType;
            Y2LineDashStyle = parameters.Y2LineDashStyle;
            Y2LineThickness = parameters.Y2LineThickness;
            //  Labels
            YAxisLabel = parameters.YAxisLabel;
            YAxisFormat = parameters.YAxisFormat;
            Y2AxisLabel = parameters.Y2AxisLabel;
            Y2AxisLegendTitle = parameters.Y2AxisLegendTitle;
            Y2AxisFormat = parameters.Y2AxisFormat;
            XAxisLabelType = parameters.XAxisLabelType;
            XAxisLabel = parameters.XAxisLabel;
            XAxisAngle = parameters.XAxisAngle;
            ChartTitle = parameters.ChartTitle;
            ChartSubTitle = parameters.ChartSubTitle;
            ChartStrataTitle = parameters.ChartStrataTitle;
            //  Legend
            ShowLegend = parameters.ShowLegend;
            ShowLegendBorder = parameters.ShowLegendBorder;
            ShowLegendVarNames = parameters.ShowLegendVarNames;
            //LegendFontSize in ChartGadgetParametersBase.cs
            LegendDock = parameters.LegendDock;
            Y2IsCumulativePercent = parameters.Y2IsCumulativePercent;
        }
        public ColumnChartProperties(
            DashboardHelper dashboardHelper, 
            IGadget gadget, 
            ColumnChartParameters parameters, 
            List<Grid> strataGridList
            )
        {
            InitializeComponent();
            this.DashboardHelper = dashboardHelper;
            this.Gadget = gadget;
            this.Parameters = parameters;
            this.StrataGridList = strataGridList;

            List<string> fields = new List<string>();
            List<string> weightFields = new List<string>();
            List<string> strataItems = new List<string>();

            //Variable fields
            fields.Add(String.Empty);
            ColumnDataType columnDataType = ColumnDataType.Boolean | ColumnDataType.DateTime | ColumnDataType.Numeric | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus")) fields.Add(fieldName);
                }
                else
                {
                    fields.Add(fieldName);
                }
            }
            cmbField.ItemsSource = fields;

            //Weight Fields
            weightFields.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus")) weightFields.Add(fieldName);
                }
                else
                {
                    weightFields.Add(fieldName);
                }
            }
            weightFields.Sort();
            cmbFieldWeight.ItemsSource = weightFields;
            cmbSecondYAxisVariable.ItemsSource = weightFields;

            //Strata Fields
            strataItems.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.Boolean | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus" || fieldName == "FKEY" || fieldName == "GlobalRecordId")) strataItems.Add(fieldName);
                }
                else
                {
                    strataItems.Add(fieldName);
                }
            }
            listboxFieldStrata.ItemsSource = strataItems;
            cmbFieldCrosstab.ItemsSource = strataItems;

            cmbBarSpacing.SelectedIndex = 0;
            txtYAxisLabelValue.Text = "Count";
            txtXAxisLabelValue.Text = String.Empty;
            cmbLegendDock.SelectedIndex = 1;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(cmbField.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory");
            view.GroupDescriptions.Add(groupDescription);

            RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as ColumnChartGadget).DataFilters, true);
            RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelFilters.Children.Add(RowFilterControl);

            txtWidth.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);
            txtHeight.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);
            txtLegendFontSize.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);

            #region Translation

            #endregion // Translation
        }
Exemplo n.º 3
0
        protected override void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            lock (syncLock)
                {
                    Stopwatch stopwatch = new Stopwatch();
                    stopwatch.Start();

                    this.Dispatcher.BeginInvoke(new SimpleCallback(SetGadgetToProcessingState));
                    this.Dispatcher.BeginInvoke(new SimpleCallback(ClearResults));
                    ColumnChartParameters chtParameters = (ColumnChartParameters)Parameters;

                    string freqVar = chtParameters.ColumnNames[0];
                    string weightVar = chtParameters.WeightVariableName;
                    string crosstabVar = chtParameters.CrosstabVariableName;
                    bool includeMissing = chtParameters.IncludeMissing;
                    List<string> stratas = new List<string>();

                    try
                    {
                        RequestUpdateStatusDelegate requestUpdateStatus = new RequestUpdateStatusDelegate(RequestUpdateStatusMessage);
                        CheckForCancellationDelegate checkForCancellation = new CheckForCancellationDelegate(IsCancelled);

                        chtParameters.GadgetStatusUpdate += new GadgetStatusUpdateHandler(requestUpdateStatus);
                        chtParameters.GadgetCheckForCancellation += new GadgetCheckForCancellationHandler(checkForCancellation);

                        if (this.DataFilters != null && this.DataFilters.Count > 0)
                        {
                            chtParameters.CustomFilter = this.DataFilters.GenerateDataFilterString(false);
                        }
                        else
                        {
                            chtParameters.CustomFilter = string.Empty;
                        }

                        if (!string.IsNullOrEmpty(crosstabVar.Trim()))
                        {
                            List<string> crosstabVarList = new List<string>();
                            crosstabVarList.Add(crosstabVar);

                            foreach (Strata strata in DashboardHelper.GetStrataValuesAsDictionary(crosstabVarList, false, false))
                            {
                                ColumnChartParameters parameters = new ColumnChartParameters(chtParameters);

                                if (!string.IsNullOrEmpty(chtParameters.CustomFilter))
                                {
                                    parameters.CustomFilter = "(" + parameters.CustomFilter + ") AND " + strata.SafeFilter;
                                }
                                else
                                {
                                    parameters.CustomFilter = strata.SafeFilter;
                                }
                                parameters.CrosstabVariableName = string.Empty;
                                Dictionary<DataTable, List<DescriptiveStatistics>> stratifiedFrequencyTables = DashboardHelper.GenerateFrequencyTable(parameters);
                                GenerateColumnChartData(stratifiedFrequencyTables, strata);
                                System.Threading.Thread.Sleep(100);
                            }
                        }
                        else
                        {
                            Dictionary<DataTable, List<DescriptiveStatistics>> stratifiedFrequencyTables = DashboardHelper.GenerateFrequencyTable(chtParameters);
                            GenerateColumnChartData(stratifiedFrequencyTables);
                        }

                        this.Dispatcher.BeginInvoke(new SimpleCallback(RenderFinish));

                    }
                    catch (Exception ex)
                    {
                        this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), ex.Message);
                    }
                    finally
                    {
                        stopwatch.Stop();
                        Debug.Print("Column chart gadget took " + stopwatch.Elapsed.ToString() + " seconds to complete.");
                        Debug.Print(DashboardHelper.DataFilters.GenerateDataFilterString());
                    }
                }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Copy Constructor
        /// </summary>
        public ColumnChartParameters(ColumnChartParameters parameters)
            : base(parameters)
        {
            //MainVariableNames = parameters.MainVariableNames;
            ColumnNames = parameters.ColumnNames;
            //GadgetStatusUpdate = parameters.GadgetStatusUpdate;
            InputVariableList            = parameters.InputVariableList;
            CustomFilter                 = parameters.CustomFilter;
            CustomSortColumnName         = parameters.CustomSortColumnName;
            IncludeFullSummaryStatistics = parameters.IncludeFullSummaryStatistics;
            ShowAllListValues            = parameters.ShowAllListValues;
            ShowCommentLegalLabels       = parameters.ShowCommentLegalLabels;
            SortHighToLow                = parameters.SortHighToLow;
            IncludeMissing               = parameters.IncludeMissing;
            CrosstabVariableName         = parameters.CrosstabVariableName;
            WeightVariableName           = parameters.WeightVariableName;
            StrataVariableNames          = parameters.StrataVariableNames;
            IgnoreRowLimits              = parameters.IgnoreRowLimits;
            SortVariables                = parameters.SortVariables;

            //from ColumnChartGadgetParametersBase
            UseDiffColors = parameters.UseDiffColors;
            Composition   = parameters.Composition;
            //BarSpacing = parameters.BarSpacing;
            Orientation = parameters.Orientation;
            BarKind     = parameters.BarKind;

            //from ChartGadgetParametersBase
            //Advanced options
            ChartWidth  = parameters.ChartWidth;
            ChartHeight = parameters.ChartHeight;
            Y2AxisType  = parameters.Y2AxisType;

            //Display options
            //  Color and styles
            UseRefValues      = parameters.UseRefValues;
            ShowAnnotations   = parameters.ShowAnnotations;
            Y2ShowAnnotations = parameters.Y2ShowAnnotations;
            ShowGridLines     = parameters.ShowGridLines;
            Palette           = parameters.Palette;
            PaletteColors     = parameters.PaletteColors;
            //Y2LineType = parameters.Y2LineType;
            Y2LineDashStyle = parameters.Y2LineDashStyle;
            Y2LineThickness = parameters.Y2LineThickness;
            //  Labels
            YAxisLabel        = parameters.YAxisLabel;
            YAxisFormat       = parameters.YAxisFormat;
            YAxisFrom         = parameters.YAxisFrom;
            YAxisTo           = parameters.YAxisTo;
            YAxisStep         = parameters.YAxisStep;
            XAxisStart        = parameters.XAxisStart;
            XAxisEnd          = parameters.XAxisEnd;
            Y2AxisLabel       = parameters.Y2AxisLabel;
            Y2AxisLegendTitle = parameters.Y2AxisLegendTitle;
            Y2AxisFormat      = parameters.Y2AxisFormat;
            XAxisLabelType    = parameters.XAxisLabelType;
            XAxisLabel        = parameters.XAxisLabel;
            XAxisAngle        = parameters.XAxisAngle;
            ChartTitle        = parameters.ChartTitle;
            ChartSubTitle     = parameters.ChartSubTitle;
            ChartStrataTitle  = parameters.ChartStrataTitle;
            //  Legend
            ShowLegend         = parameters.ShowLegend;
            ShowLegendBorder   = parameters.ShowLegendBorder;
            ShowLegendVarNames = parameters.ShowLegendVarNames;
            //LegendFontSize in ChartGadgetParametersBase.cs
            LegendDock         = parameters.LegendDock;
            YAxisFontSize      = parameters.YAxisFontSize;
            YAxisLabelFontSize = parameters.YAxisLabelFontSize;
            XAxisFontSize      = parameters.XAxisFontSize;
            XAxisLabelFontSize = parameters.XAxisLabelFontSize;
            SortStringValues   = parameters.SortStringValues;
        }