Пример #1
0
/// <summary>
/// Add a new pivot grid field
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void AddPivotField_Click(object sender, EventArgs e)
        {
            QueryManager qm = PivotView.Qm;
            Query        q  = qm.Query;

            FieldSelectorControl.Query      = q;
            FieldSelectorControl.MetaColumn = null;
            Point p = AddPivotField.PointToScreen(new Point(0, AddPivotField.Height));

            Mobius.Data.QueryColumn qc = FieldSelectorControl.ShowMenu(p);
            if (qc == null)
            {
                return;
            }

            PivotGridPropertiesMx pp = PivotView.PivotGridPropertiesMx;

            ResultsField rfld = qm.ResultsFormat.GetResultsField(qc);

            if (rfld == null)
            {
                return;
            }

            PivotGridFieldMx field =             // add new field (must add to base view)
                                     PivotGridView.AddField(rfld, pp.PivotFields, null, GroupingTypeEnum.EqualValues);

            PivotGridFieldMx field2 = new PivotGridFieldMx();

            field.CopyField(field2);
            pp.PivotFields.Remove(field);             // remove from base view

            PivotGrid.BeginUpdate();
            object ds = PivotGrid.DataSource;

            PivotGrid.DataSource = null;
            PivotGrid.Fields.Add(field2);             // add to pivot grid
            PivotView.ConfigurePivotGridControlField(field2);
            PivotGrid.DataSource = ds;
            PivotGrid.EndUpdate();

            FillFieldDetailsGrid();
            return;
        }
Пример #2
0
/// <summary>
/// Create a new view of the specified type
/// </summary>
/// <param name="viewType"></param>
/// <returns></returns>

        public ResultsViewProps NewResultsViewManager(
            ResultsViewModel rvi)
        {
            ResultsViewProps view = null;

            switch (rvi.ViewType)
            {
            case ResultsViewType.Table:
                view = new MoleculeBandedGridViewManager();
                break;

            case ResultsViewType.HtmlTable:
                view = new HtmlTableView();
                break;

            case ResultsViewType.PivotGrid:
                view = new PivotGridView();
                break;

            case ResultsViewType.Spotfire:
                view = new SpotfireViewManager(rvi);
                break;

            case ResultsViewType.ScatterPlot:
                view = new SpotfireViewManager2(rvi);
                break;

            case ResultsViewType.BarChart:
                view = new SpotfireViewManager2(rvi);
                break;


            default:
                DebugLog.Message("Unrecognized view type: " + rvi.ViewType);
                view = new ViewManager();
                break;
                //throw new Exception("Unrecognized view type: " + viewType);

                //case ViewTypeMx.ScatterPlot:
                //	view = new ChartViewBubble();
                //	break;

                //case ViewTypeMx.Heatmap:
                //	view = new ChartViewHeatmap();
                //	break;

                //case ViewTypeMx.TargetSummaryUnpivoted:
                //	view = new TargetSummaryUnpivotedView();
                //	break;

                //case ViewTypeMx.TargetSummaryPivoted:
                //	view = new TargetSummaryPivotedView();
                //	break;

                //case ViewTypeMx.TargetTargetTable:
                //	view = new TargetTargetPivotedView();
                //	break;

                //case ViewTypeMx.TargetSummaryImageMap:
                //	view = new TargetSummaryImageMapView();
                //	break;

                //case ViewTypeMx.TargetSummaryHeatmap:
                //	view = new TargetSummaryHeatmapView();
                //	break;
            }

// Set some key values if not already set by the specifice view manager constructor

            if (view.ViewType == ResultsViewType.Unknown)
            {
                view.ViewType = rvi.ViewType;
            }

            if (Lex.IsUndefined(view.ViewSubtype))
            {
                view.ViewSubtype = rvi.ViewSubtype;
            }

            if (Lex.IsUndefined(view.CustomViewTypeImageName))
            {
                view.CustomViewTypeImageName = rvi.CustomViewTypeImageName;
            }

            if (Lex.IsUndefined(view.Title))
            {
                view.Title = rvi.Title;
            }

            if (view.BaseQuery == null)
            {
                view.BaseQuery = rvi.Query;
            }

            return(view);
        }
Пример #3
0
        /// <summary>
        /// Render the view into the specified results control
        /// </summary>

        public override void ConfigureRenderingControl()
        {
            Query         q;
            ResultsFormat rf = ResultsFormat;

            ResultsTable rt;
            QueryTable   qt;
            MetaTable    mt;

            ResultsField rfld;

            Mobius.Data.QueryColumn qc;
            MetaColumn mc;

            PivotGridField pgf;

            bool includeActivityClass = true;

            if (!BuildUnpivotedResults(includeActivityClass))
            {
                return;
            }

            PivotGridPropertiesMx p = PivotGridPropertiesMx;

            if (p == null)
            {
                return;
            }

            if (p.PivotFields == null)             // if not defined then configure
            {
                PivotGridCtl.Fields.Clear();       // clear any prev display
                PivotGridCtl.Groups.Clear();

                if (DataIncludesDates)
                {
                    DialogResult dr = DateGroupingDialog.ShowDialog(ref DateGroupInterval);
                }

                p.PivotFields = new List <PivotGridFieldMx>();

                foreach (ResultsTable rt0 in rf.Tables)                 // determine visible fields
                {
                    rt = rt0;
                    qt = rt.QueryTable;
                    mt = qt.MetaTable;
                    if (Lex.Eq(mt.Name, MultiDbAssayDataNames.CombinedNonSumTableName))
                    {
                        if ((rfld = rt.GetResultsFieldByName("activity_bin")) != null)
                        {
                            pgf = PivotGridView.AddField(rfld, p.PivotFields, PivotArea.RowArea, true, null, GroupingTypeEnum.EqualValues);
                        }

                        if ((rfld = rt.GetResultsFieldByName("run_dt")) != null &&
                            DataIncludesDates && DateGroupInterval != GroupingTypeEnum.EqualValues)
                        {
                            GroupingTypeEnum pgi = DateGroupInterval;

                            int  intervalCnt = 0;
                            bool week = false, month = false, year = false;                             // include larger date units up to year
                            if (pgi == GroupingTypeEnum.DateDayOfWeek)
                            {
                                week        = month = year = true;
                                intervalCnt = 3;
                            }

                            else if (pgi == GroupingTypeEnum.DateWeekOfMonth)
                            {
                                intervalCnt = 3;

                                month = year = true;
                            }

                            else if (pgi == GroupingTypeEnum.DateMonth ||
                                     pgi == GroupingTypeEnum.DateQuarter)
                            {
                                year = true;
                            }

                            PivotGridGroup g = null;

                            if (intervalCnt > 1)
                            {
                                g = new PivotGridGroup();
                                PivotGridCtl.Groups.Add(g);
                            }

                            if (year)
                            {
                                PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, g, GroupingTypeEnum.DateYear);
                            }
                            if (month)
                            {
                                PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, g, GroupingTypeEnum.DateMonth);
                            }
                            if (week)
                            {
                                PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, g, GroupingTypeEnum.DateWeekOfMonth);
                            }
                            PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, g, pgi);
                        }

                        if ((rfld = rt.GetResultsFieldByName("assy_nm")) != null)
                        {
                            pgf = PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, null, GroupingTypeEnum.EqualValues);
                        }

                        if ((rfld = rt.GetResultsFieldByName("rslt_val")) != null)
                        {
                            pgf = PivotGridView.AddField(rfld, p.PivotFields, PivotArea.DataArea, true, null, GroupingTypeEnum.EqualValues);
                        }
                    }

                    else                     // tables other than the standard pivoted table
                    {
                        foreach (ResultsField rfld0 in rt.Fields)
                        {
                            rfld = rfld0;
                            qc   = rfld.QueryColumn;
                            mc   = qc.MetaColumn;
                        }
                    }
                }
            }                                                             // done defining initial set of fields

            SyncMxFieldListWithSourceQuery(BaseQuery, ref p.PivotFields); // be sure main grid & pivot view fields are in synch

            ConfigurePivotGridControl();                                  // configure the control to display the data

            PivotGridCtl.DataSource = Qm.DataTableManager.DataSource;     // set the data table to start rendering

            return;
        }
Пример #4
0
        /// <summary>
        /// Copy values from view to form
        /// </summary>

        void Setup()
        {
            Mobius.Data.QueryColumn qc;
            string txt;
            int    fi, fi2;

            InSetup = true;

            PivotGridView view = PivotView;

            // Setup General tab

            Title.Text       = view.Title;
            Description.Text = view.Description;

            SetRowTotalsControlEnable();

            ShowColumnTotals.Checked      = PivotGrid.OptionsView.ShowColumnTotals;
            ShowColumnGrandTotals.Checked = PivotGrid.OptionsView.ShowColumnGrandTotals;
            ShowRowTotals.Checked         = PivotGrid.OptionsView.ShowRowTotals;
            ShowRowGrandTotals.Checked    = PivotGrid.OptionsView.ShowRowGrandTotals;

            ChartType.Text = PivotGridPanel.ChartType;
            ChartShowSelectionOnly.Checked = PivotGrid.OptionsChartDataSource.SelectionOnly;
            ProvideDataByColumns.Checked   = PivotGrid.OptionsChartDataSource.ProvideDataByColumns;
            //ChartShowPointLabels.Checked = DefaultBooleanMx.Convert(Chart.SeriesTemplate.LabelsVisibility);
            ProvideColumnGrandTotals.Checked = PivotGrid.OptionsChartDataSource.ProvideColumnGrandTotals;
            ProvideRowGrandTotals.Checked    = PivotGrid.OptionsChartDataSource.ProvideRowGrandTotals;

            DataTable dt = CreateFieldGridDataTable();             // build the field grid

            PivotGridField[] Fields = new PivotGridField[PivotGrid.Fields.Count];
            for (fi = 0; fi < Fields.Length; fi++)
            {
                Fields[fi] = PivotGrid.Fields[fi];             // copy ref
            }
            for (fi = 1; fi < Fields.Length; fi++)             // order fields by caption
            {
                PivotGridField f0 = Fields[fi];
                for (fi2 = fi - 1; fi2 >= 0; fi2--)
                {
                    if (Lex.Le(Fields[fi2].Caption, Fields[fi].Caption))
                    {
                        break;
                    }
                    Fields[fi2 + 1] = Fields[fi2];                   // move down one
                }

                Fields[fi] = Fields[fi2 + 1];
            }

            for (fi = 0; fi < Fields.Length; fi++)
            {
                PivotGrid.Fields[fi].Index = fi;                 // reorder indexes
            }
            FillFieldDetailsGrid();

            PivotGrid.FieldsCustomization();             // integrate the Dx customization form

            InSetup = false;

            return;
        }