Ejemplo n.º 1
0
        /// <summary>
        /// Copy Constructor
        /// </summary>
        public AreaChartParameters(AreaChartParameters 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
            Composition = parameters.Composition ;

            //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;
        }
Ejemplo n.º 2
0
        public AreaChart(DashboardHelper dashboardHelper, AreaChartParameters parameters, List<XYColumnChartData> dataList)
        {
            InitializeComponent();
            //this.Settings = settings;
            //this.AreaChartSettings = settings;
            AreaChartParameters = parameters;
            this.DashboardHelper = dashboardHelper;
            SetChartProperties();
            SetChartData(dataList);

            xyChart.Legend.BorderBrush = Brushes.Gray;
        }
        public AreaChartProperties(
            DashboardHelper dashboardHelper, 
            IGadget gadget, 
            AreaChartParameters 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;

            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 AreaChartGadget).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);
            txtTransTop.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);
            txtTransBottom.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);
            txtLegendFontSize.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);

            #region Translation

            #endregion // Translation
        }
Ejemplo n.º 4
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));

                    AreaChartParameters chtParameters = (AreaChartParameters)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))
                            {
                                AreaChartParameters parameters = new AreaChartParameters(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);
                                GenerateChartData(stratifiedFrequencyTables, strata);
                                System.Threading.Thread.Sleep(100);
                            }
                        }
                        else
                        {
                            Dictionary<DataTable, List<DescriptiveStatistics>> stratifiedFrequencyTables = DashboardHelper.GenerateFrequencyTable(chtParameters);
                            GenerateChartData(stratifiedFrequencyTables);
                        }
                        this.Dispatcher.BeginInvoke(new SimpleCallback(RenderFinish));

                    }
                    catch (Exception ex)
                    {
                        this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), ex.Message);
                    }
                    finally
                    {
                        stopwatch.Stop();
                        Debug.Print("Area chart gadget took " + stopwatch.Elapsed.ToString() + " seconds to complete.");
                        Debug.Print(DashboardHelper.DataFilters.GenerateDataFilterString());
                    }
                }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Copy Constructor
        /// </summary>
        public AreaChartParameters(AreaChartParameters 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
            Composition = parameters.Composition;

            //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;
            YAxisFontSize      = parameters.YAxisFontSize;
            YAxisLabelFontSize = parameters.YAxisLabelFontSize;
            XAxisFontSize      = parameters.XAxisFontSize;
            XAxisLabelFontSize = parameters.XAxisLabelFontSize;
            PaletteColors      = parameters.PaletteColors;
        }