public static void Test2()
        {
            Library library = WebLibraryManager.Instance.Library_Guest;

            while (!library.LibraryIsLoaded)
            {
                Thread.Sleep(100);
            }

            List <PDFDocument> pdf_documents = library.PDFDocuments;

            HashSet <string>             parent_fingerprints = null;
            MultiMapSet <string, string> map_ratings         = RatingExplorerControl.GetNodeItems(library, parent_fingerprints);
            MultiMapSet <string, string> map_reading_stage   = ReadingStageExplorerControl.GetNodeItems(library, parent_fingerprints);
            MultiMapSet <string, string> map_author          = AuthorExplorerControl.GetNodeItems(library, parent_fingerprints);
            MultiMapSet <string, string> map_year            = YearExplorerControl.GetNodeItems(library, parent_fingerprints);
            MultiMapSet <string, string> map_ai_tag          = AITagExplorerControl.GetNodeItems(library, parent_fingerprints);
            MultiMapSet <string, string> map_tag             = TagExplorerControl.GetNodeItems(library, parent_fingerprints);
            MultiMapSet <string, string> map_publication     = PublicationExplorerControl.GetNodeItems(library, parent_fingerprints);

            MultiMapSet <string, string> map_y_axis = map_tag;
            MultiMapSet <string, string> map_x_axis = map_author;

            PivotResult pivot_result = GeneratePivot(map_y_axis, map_x_axis);
        }
Пример #2
0
 protected override void Context()
 {
     base.Context();
     _statisticalAnalysis.SetPosition(_outputFieldVenousBloodPlasma, PivotArea.DataArea, 0);
     _statisticalAnalysis.Statistics.Each(s => s.Selected = false);
     _pivotResult = ChartDataHelperForSpecs.CreateOutputResults(_statisticalAnalysis, _genderField, _outputFieldVenousBloodPlasma, _outputFieldLiverCell);
 }
Пример #3
0
        public virtual ChartData <TX, TY> CreateFor(PivotResult pivotResult)
        {
            try
            {
                _analysis                = pivotResult.Analysis;
                _data                    = pivotResult.PivotedData;
                _aggreationName          = pivotResult.AggregationName;
                _dataColumnName          = pivotResult.DataColumnName;
                _populationDataCollector = pivotResult.PopulationDataCollector;
                _observedDataCollection  = pivotResult.ObservedDataCollection;

                if (!CheckFields())
                {
                    return(null);
                }

                var chart = BuildChartsData();

                chart.CreatePaneOrder();
                chart.Panes.Each(x => x.CreateCurveOrder());

                return(chart);
            }
            finally
            {
                _analysis = null;
                _data     = null;
                _populationDataCollector = null;
                _observedDataCollection  = null;
            }
        }
Пример #4
0
        protected override void Context()
        {
            base.Context();

            _observedCurveDataList = new List <ObservedCurveData>();
            _observedCurveData     = new ObservedCurveData(AuxiliaryType.Undefined)
            {
                Caption = "Male"
            };

            _observedCurveDataList.Add(_observedCurveData);
            _observedCurveData.Color = Color.Aqua;

            A.CallTo(_observedCurveDataMapper).WithReturnType <IReadOnlyList <ObservedCurveData> >().Returns(_observedCurveDataList);

            _statisticalAnalysis.SetPosition(_genderField, PivotArea.RowArea, 0);
            _statisticalAnalysis.SetPosition(_outputFieldVenousBloodPlasma, PivotArea.DataArea, 0);
            _statisticalAnalysis.SetPosition(_outputFieldLiverCell, PivotArea.DataArea, 1);
            _predefinedStatisticalAggregation.Method   = StatisticalAggregationType.ArithmeticMean;
            _percentileStatisticalAggregation.Selected = true;

            _observedDataCollection = new ObservedDataCollection {
                ApplyGroupingToObservedData = true
            };
            var observedData = DomainHelperForSpecs.ObservedData();

            observedData.ExtendedProperties.Add(new ExtendedProperty <string> {
                Name = _genderField.Name, Value = "Male"
            });
            _observedDataCollection.AddObservedData(observedData);

            _pivotResult = ChartDataHelperForSpecs.CreateOutputResults(_statisticalAnalysis, _genderField, _outputFieldVenousBloodPlasma, _outputFieldLiverCell, _observedDataCollection);
        }
Пример #5
0
 protected override void Context()
 {
     base.Context();
     _pivotAnalysis.SetPosition(_genderField, PivotArea.FilterArea, 0);
     _pivotAnalysis.SetPosition(_raceField, PivotArea.FilterArea, 0);
     _pivotAnalysis.SetPosition(_bmiClass, PivotArea.FilterArea, 0);
     _pivotResult = ChartDataHelperForSpecs.CreatePivotResult(_pivotAnalysis, _aggregate, _genderField, _raceField, _bmiField, _cmaxField);
 }
Пример #6
0
        protected override void Context()
        {
            base.Context();
            _pivotAnalysis.SetPosition(_genderField, PivotArea.RowArea, 0);
            _pivotAnalysis.SetPosition(_cmaxField, PivotArea.DataArea, 0);
            _pivotAnalysis.SetPosition(_bmiField, PivotArea.DataArea, 1);

            _pivotResult = ChartDataHelperForSpecs.CreatePivotResult(_pivotAnalysis, AggregationFunctions.ValuesAggregation, _genderField, _raceField, _bmiField, _cmaxField);
        }
Пример #7
0
 protected override void Context()
 {
     base.Context();
     _statisticalAnalysis.SetPosition(_genderField, PivotArea.RowArea, 0);
     _statisticalAnalysis.SetPosition(_outputFieldVenousBloodPlasma, PivotArea.DataArea, 0);
     _statisticalAnalysis.SetPosition(_outputFieldLiverCell, PivotArea.DataArea, 1);
     _predefinedStatisticalAggregation.Method = StatisticalAggregationType.Range95;
     _pivotResult = ChartDataHelperForSpecs.CreateOutputResults(_statisticalAnalysis, _genderField, _outputFieldVenousBloodPlasma, _outputFieldLiverCell);
 }
        public static PivotResult GeneratePivot(MultiMapSet <string, string> map_y_axis, MultiMapSet <string, string> map_x_axis)
        {
            List <string> y_keys = new List <string>(map_y_axis.Keys);
            List <string> x_keys = new List <string>(map_x_axis.Keys);

            y_keys.Sort();
            x_keys.Sort();

            List <string>[,] common_fingerprints = new List <string> [y_keys.Count, x_keys.Count];

            StatusManager.Instance.ClearCancelled("LibraryPivot");
            int y_progress = 0;

            Parallel.For(0, y_keys.Count, (y, loop_state) =>
                         //for (int y = 0; y < y_keys.Count; ++y)
            {
                int y_progress_locked = Interlocked.Increment(ref y_progress);

                if (General.HasPercentageJustTicked(y_progress_locked, y_keys.Count))
                {
                    StatusManager.Instance.UpdateStatusBusy("LibraryPivot", "Building library pivot", y_progress_locked, y_keys.Count, true);

                    WPFDoEvents.WaitForUIThreadActivityDone(); // HackityHack

                    if (StatusManager.Instance.IsCancelled("LibraryPivot"))
                    {
                        Logging.Warn("User cancelled library pivot generation");
                        loop_state.Break();
                    }
                }

                string y_key = y_keys[y];
                HashSet <string> y_values = map_y_axis.Get(y_key);

                for (int x = 0; x < x_keys.Count; ++x)
                {
                    string x_key = x_keys[x];
                    HashSet <string> x_values = map_x_axis.Get(x_key);

                    var common_fingerprint = y_values.Intersect(x_values);
                    if (common_fingerprint.Any())
                    {
                        common_fingerprints[y, x] = new List <string>(common_fingerprint);
                    }
                }
            });

            StatusManager.Instance.UpdateStatus("LibraryPivot", "Built library pivot");

            PivotResult pivot_result = new PivotResult();

            pivot_result.y_keys = y_keys;
            pivot_result.x_keys = x_keys;
            pivot_result.common_fingerprints = common_fingerprints;
            return(pivot_result);
        }
Пример #9
0
 protected override void Context()
 {
     base.Context();
     _statisticalAnalysis.SetPosition(_outputFieldVenousBloodPlasma, PivotArea.DataArea, 0);
     _pivotResult = ChartDataHelperForSpecs.CreateOutputResults(_statisticalAnalysis, _genderField, _outputFieldVenousBloodPlasma, _outputFieldLiverCell);
     foreach (DataRow dataRow in _pivotResult.PivotedData.Rows)
     {
         dataRow[_pivotResult.AggregationName] = DBNull.Value;
     }
 }
Пример #10
0
 protected override void Context()
 {
     base.Context();
     _statisticalAnalysis.SetPosition(_genderField, PivotArea.ColumnArea, 0);
     _statisticalAnalysis.ColorField = _genderField;
     _statisticalAnalysis.SetPosition(_outputFieldVenousBloodPlasma, PivotArea.DataArea, 0);
     _statisticalAnalysis.SetPosition(_outputFieldLiverCell, PivotArea.DataArea, 1);
     _predefinedStatisticalAggregation.Method   = StatisticalAggregationType.ArithmeticMean;
     _percentileStatisticalAggregation.Selected = true;
     _pivotResult = ChartDataHelperForSpecs.CreateOutputResults(_statisticalAnalysis, _genderField, _outputFieldVenousBloodPlasma, _outputFieldLiverCell);
 }
Пример #11
0
        protected override void Context()
        {
            base.Context();
            _pivotAnalysis.SetPosition(_bmiClass, PivotArea.ColorArea, 0);
            _pivotAnalysis.SetPosition(_cmaxField, PivotArea.DataArea, 0);
            _pivotAnalysis.SetPosition(_bmiField, PivotArea.DataArea, 1);

            _pivotResult = ChartDataHelperForSpecs.CreatePivotResult(_pivotAnalysis,
                                                                     AggregationFunctions.ValuesAggregation,
                                                                     _genderField, _raceField, _bmiField, _cmaxField,
                                                                     cmaxValues: new double[] { 600, 800, 600 });
        }
Пример #12
0
        public override ChartData <BoxWhiskerXValue, BoxWhiskerYValue> CreateFor(PivotResult pivotResult)
        {
            var chartData          = base.CreateFor(pivotResult);
            var boxWhiskerAnalysis = pivotResult.Analysis as PopulationBoxWhiskerAnalysis;

            if (boxWhiskerAnalysis == null || chartData == null)
            {
                return(chartData);
            }

            chartData.Panes.Each(p => updateIndividualIdForField(pivotResult.PopulationDataCollector, boxWhiskerAnalysis, p));

            return(chartData);
        }
Пример #13
0
        /// <summary>
        /// metóda pre nájdenie pivota v úlohe s pomocnou kriteriálnou funkciou
        /// </summary>
        /// <param name="index">index pivotného stĺpca</param>
        /// <returns>pivot</returns>
        private PivotResult FindPivotWithHelpFunction(int index)
        {
            PivotResult result = null;
            double helper = double.MaxValue;
            bool isPositive = false;

            foreach (Equation item in myConditions)
            {
                if (item.LeftSide[index] > 0.000005)
                {
                    isPositive = true;
                    break;
                }
            }
            if (isPositive == true)
            {
                result = new PivotResult();
                foreach (Equation item in myConditions)
                {
                    if (item.RightSide / item.LeftSide[index] - helper < 0.000005 && item.LeftSide[index] > 0.000005) //hladanie min. pomeru
                    {
                        helper = item.RightSide / item.LeftSide[index];
                        result.Pivot = item.LeftSide[index];
                        result.Index = myConditions.IndexOf(item);
                    }
                }
            }
            return result;
        }
 protected override void Context()
 {
     base.Context();
     _pivotResult = ChartDataHelperForSpecs.CreatePivotResult(_pivotAnalysis, _aggregate, _genderField, _raceField, _bmiField, _cmaxField);
 }